From patchwork Fri Apr 25 13:45:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 4063411 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3AFFBC0ACC for ; Fri, 25 Apr 2014 14:24:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 244B72039C for ; Fri, 25 Apr 2014 14:24:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D50F520268 for ; Fri, 25 Apr 2014 14:24:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 06D942658E9; Fri, 25 Apr 2014 16:24:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0C1D62656EE; Fri, 25 Apr 2014 16:00:39 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 672C12654FB; Fri, 25 Apr 2014 16:00:31 +0200 (CEST) Received: from smtp310.phy.lolipop.jp (smtp310.phy.lolipop.jp [210.157.22.78]) by alsa0.perex.cz (Postfix) with ESMTP id 4B4DC2654F3 for ; Fri, 25 Apr 2014 15:46:26 +0200 (CEST) Received: from smtp310.phy.lolipop.lan (HELO smtp310.phy.lolipop.jp) (172.17.1.10) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp310.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Fri, 25 Apr 2014 22:46:25 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp310.phy.lolipop.jp (LOLIPOP-Fsecure); Fri, 25 Apr 2014 22:45:31 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz Date: Fri, 25 Apr 2014 22:45:05 +0900 Message-Id: <1398433530-13136-25-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398433530-13136-1-git-send-email-o-takashi@sakamocchi.jp> References: <1398433530-13136-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 24/49] fireworks/firewire-lib: Add a quirk for wrong dbs in tx packets X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP One of Fireworks firmware, named as 'AudioFire9', seems to transmit packets with wrong value of dbs. It's always 0x11 but actual size of data block is different. This commit adds a flag for this quirk and some codes to calculate correct size. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp.c | 2 ++ sound/firewire/amdtp.h | 3 +++ sound/firewire/fireworks/fireworks.c | 2 ++ sound/firewire/fireworks/fireworks.h | 3 +++ sound/firewire/fireworks/fireworks_stream.c | 3 +++ 5 files changed, 13 insertions(+) diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index 51aad68..3903387 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c @@ -653,6 +653,8 @@ static void handle_in_packet(struct amdtp_stream *s, cip_header[0]); goto err; } + if (s->flags & CIP_WRONG_DBS) + data_block_quadlets = s->data_block_quadlets; data_blocks = (payload_quadlets - 2) / data_block_quadlets; } diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h index 1ca1a19..f334ae5 100644 --- a/sound/firewire/amdtp.h +++ b/sound/firewire/amdtp.h @@ -21,6 +21,8 @@ * @CIP_EMPTY_WITH_TAG0: Only for in-stream. Empty in-packets have TAG0. * @CIP_DBC_IS_END_EVENT: Only for in-stream. The value of dbc in an in-packet * corresponds to the end of event in the packet. Out of IEC 61883. + * @CIP_WRONG_DBS: Only for in-stream. The value of dbs is wrong in in-packets. + * The value of data_block_quadlets is used instead of reported value. */ enum cip_flags { CIP_NONBLOCKING = 0x00, @@ -28,6 +30,7 @@ enum cip_flags { CIP_SYNC_TO_DEVICE = 0x02, CIP_EMPTY_WITH_TAG0 = 0x04, CIP_DBC_IS_END_EVENT = 0x08, + CIP_WRONG_DBS = 0x10, }; /** diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c index 307fb2f..02b3259 100644 --- a/sound/firewire/fireworks/fireworks.c +++ b/sound/firewire/fireworks/fireworks.c @@ -205,6 +205,8 @@ efw_probe(struct fw_unit *unit, err = get_hardware_info(efw); if (err < 0) goto error; + if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9) + efw->is_af9 = true; err = snd_efw_stream_init_duplex(efw); if (err < 0) diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h index ce511be..9534e93 100644 --- a/sound/firewire/fireworks/fireworks.h +++ b/sound/firewire/fireworks/fireworks.h @@ -61,6 +61,9 @@ struct snd_efw { u32 seqnum; bool resp_addr_changable; + /* for quirks */ + bool is_af9; + unsigned int midi_in_ports; unsigned int midi_out_ports; diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c index d687b04..7447af7 100644 --- a/sound/firewire/fireworks/fireworks_stream.c +++ b/sound/firewire/fireworks/fireworks_stream.c @@ -198,6 +198,9 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw) efw->tx_stream.flags |= CIP_EMPTY_WITH_TAG0; /* Fireworks has its own meaning for dbc. */ efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT; + /* AudioFire9 always reports wrong dbs. */ + if (efw->is_af9) + efw->tx_stream.flags |= CIP_WRONG_DBS; err = init_stream(efw, &efw->rx_stream); if (err < 0) {