From patchwork Mon Nov 23 08:53:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 11924661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9086AC2D0E4 for ; Mon, 23 Nov 2020 09:09:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCAAF20756 for ; Mon, 23 Nov 2020 09:09:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="fq9be/j8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCAAF20756 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3A19E16FE; Mon, 23 Nov 2020 10:08:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3A19E16FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1606122573; bh=qYIwPJbAZ7pdo/HRQSB8WMU5/Gap9p3jhRZH3q/G3jQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fq9be/j8+/VcZgl8GwgzGOjaEGXYEURFBU/1hfKmhWSXkHDAsC+KNuqqyBslcKYt4 dX2PlslENsitKYC6PHsQw6SnaaeHbjHecEAQX0BjdheDjEH8WoY/FeVTf6bsMOL4zG 9g8wgD5NnHkWaVOWZvXnddjyuuOXIKOFSL7Bd3Uk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C6321F80612; Mon, 23 Nov 2020 09:55:16 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 69D7EF8055C; Mon, 23 Nov 2020 09:54:51 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AAD0DF804F3 for ; Mon, 23 Nov 2020 09:54:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AAD0DF804F3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E75F3AF82; Mon, 23 Nov 2020 08:53:58 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 36/41] ALSA: usb-audio: Quirk for BOSS GT-001 Date: Mon, 23 Nov 2020 09:53:42 +0100 Message-Id: <20201123085347.19667-37-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201123085347.19667-1-tiwai@suse.de> References: <20201123085347.19667-1-tiwai@suse.de> Cc: Matwey Kornilov , Dylan Robinson , Keith Milner X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The capture stream of BOSS GT-001 seems always requiring to be tied with the playback stream. OTOH, the playback stream of this device doesn't seem working in the implicit fb mode, per se, since the playback must be running before the capture stream. This patch tries to address the points above: - Avoid the implicit fb mode for the playback - Set up a fake sync EP for the capture stream with the hard-coded playback stream using the implicit fb mode Reported-by: Keith Milner Tested-by: Keith Milner Tested-by: Dylan Robinson Signed-off-by: Takashi Iwai --- sound/usb/pcm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 5953e22a72c5..676acc20595b 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -403,6 +403,9 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip, case USB_ID(0x0582, 0x01d8): /* BOSS Katana */ /* BOSS Katana amplifiers do not need quirks */ return 0; + case USB_ID(0x0582, 0x01e5): /* BOSS GT-001 */ + /* BOSS GT-001 needs no implicit fb for playback */ + return 0; } /* Generic UAC2 implicit feedback */ @@ -454,6 +457,30 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip, return 1; } +static int audioformat_capture_quirk(struct snd_usb_audio *chip, + struct audioformat *fmt, + struct usb_host_interface *alts) +{ + struct usb_device *dev = chip->dev; + + switch (chip->usb_id) { + case USB_ID(0x0582, 0x01e5): /* BOSS GT-001 */ + if (!snd_usb_get_host_interface(chip, 0x01, 0x01)) + return 0; + fmt->sync_ep = 0x0d; + fmt->sync_iface = 0x01; + fmt->sync_altsetting = 0x01; + fmt->sync_ep_idx = 0; + fmt->implicit_fb = 1; + dev_dbg(&dev->dev, "%d:%d: added fake capture sync sync_ep=%x, iface=%d, alt=%d\n", + fmt->iface, fmt->altsetting, fmt->sync_ep, fmt->sync_iface, + fmt->sync_altsetting); + return 1; + } + return 0; + +} + int snd_usb_audioformat_set_sync_ep(struct snd_usb_audio *chip, struct audioformat *fmt) { @@ -474,6 +501,10 @@ int snd_usb_audioformat_set_sync_ep(struct snd_usb_audio *chip, err = audioformat_implicit_fb_quirk(chip, fmt, alts); if (err > 0) return 0; + } else { + err = audioformat_capture_quirk(chip, fmt, alts); + if (err > 0) + return 0; } if (altsd->bNumEndpoints < 2)