From patchwork Tue May 13 14:27:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 4168181 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CE0D79F334 for ; Tue, 13 May 2014 14:40:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C1942020A for ; Tue, 13 May 2014 14:40:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D51F02010B for ; Tue, 13 May 2014 14:40:12 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F3A10265688; Tue, 13 May 2014 16:40:11 +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 DF36D265584; Tue, 13 May 2014 16:31:45 +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 3A78F2656D3; Tue, 13 May 2014 16:31:43 +0200 (CEST) Received: from smtp303.phy.lolipop.jp (smtp303.phy.lolipop.jp [210.157.22.87]) by alsa0.perex.cz (Postfix) with ESMTP id 15334265597 for ; Tue, 13 May 2014 16:28:19 +0200 (CEST) Received: from smtp303.phy.lolipop.lan (HELO smtp303.phy.lolipop.jp) (172.17.1.87) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp303.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Tue, 13 May 2014 23:28:18 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp303.phy.lolipop.jp (LOLIPOP-Fsecure); Tue, 13 May 2014 23:27:53 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de Date: Tue, 13 May 2014 23:27:48 +0900 Message-Id: <1399991272-5807-12-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1399991272-5807-1-git-send-email-o-takashi@sakamocchi.jp> References: <1399991272-5807-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, stefanr@s5r6.in-berlin.de, fenlason@redhat.com, ffado-devel@lists.sf.net, linux1394-devel@lists.sourceforge.net Subject: [alsa-devel] [PATCH 11/15] oxfw: Add a quirk for Griffin FireWave 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 Griffin FireWave has 7 entries for stream formation. But via 'LIST' subfunction of AV/C Stream Format Information command, 6 of them can be retrieved. The rest can be retrieved via 'SINGLE' subfunction of the command. This commit adds a workaround for this quirk. Signed-off-by: Takashi Sakamoto --- sound/firewire/oxfw/oxfw_stream.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sound/firewire/oxfw/oxfw_stream.c b/sound/firewire/oxfw/oxfw_stream.c index 0d81bba..4d66648 100644 --- a/sound/firewire/oxfw/oxfw_stream.c +++ b/sound/firewire/oxfw/oxfw_stream.c @@ -365,8 +365,8 @@ static int fill_stream_formations(struct snd_oxfw *oxfw, unsigned short pid) { u8 *buf; - struct snd_oxfw_stream_formation *formations; - unsigned int len, eid = 0; + struct snd_oxfw_stream_formation *formations, tmp; + unsigned int i, len, eid = 0; int err; buf = kmalloc(AVC_GENERIC_FRAME_MAXIMUM_BYTES, GFP_KERNEL); @@ -416,6 +416,25 @@ static int fill_stream_formations(struct snd_oxfw *oxfw, break; } } + + if (eid >= SND_OXFW_STREAM_FORMAT_ENTRIES) + goto end; + + /* Griffin FireWave have another entry in current formation. */ + len = AVC_GENERIC_FRAME_MAXIMUM_BYTES; + err = avc_stream_get_format_single(oxfw->unit, dir, 0, buf, &len); + if (err < 0) + goto end; + err = parse_stream_formation(buf, len, &tmp); + if (err < 0) + goto end; + /* Store this if no duplicates. */ + for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { + if (memcmp(&formations[i], &tmp, sizeof(tmp)) == 0) + break; + } + if (i == SND_OXFW_STREAM_FORMAT_ENTRIES) + formations[eid] = tmp; end: kfree(buf); return err;