From patchwork Fri Mar 23 10:20:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobutaka Okabe X-Patchwork-Id: 10303723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65ECE60385 for ; Fri, 23 Mar 2018 10:20:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54D78285A2 for ; Fri, 23 Mar 2018 10:20:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49E3D28DB0; Fri, 23 Mar 2018 10:20:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92A4F285A2 for ; Fri, 23 Mar 2018 10:20:24 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6A7AC2673DC; Fri, 23 Mar 2018 11:20:23 +0100 (CET) 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 3E6D226743C; Fri, 23 Mar 2018 11:20:21 +0100 (CET) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by alsa0.perex.cz (Postfix) with ESMTP id 34FB12673D2 for ; Fri, 23 Mar 2018 11:20:18 +0100 (CET) Received: by mail-pg0-f68.google.com with SMTP id t9so3027798pgo.3 for ; Fri, 23 Mar 2018 03:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UEa68I4MZmRI5lEkDSWyrM08/AmYaf0DVmp5YO6Yzzo=; b=hEDq68mxMV/79RrZAakjdo7JmKGlc/1RONAZ6RA6D8/CIqeckkHk0i+i68GtZmVFIi urtLKd3OwIFQMHVbps0qwDiNiv/e3z3svkiMIKJSg0djQQGGcU/nAaZ0HKdiiy8pOjcl uBL8c+ifvldPwv0yowM52M/q+ojH4DaOzKCfg1kYtVUQhwjh1p13bkDqShUuAlkPdqjG 0ev+Qr/1SXBGZNZycDBQ/bzGf/IYgh9oRsX27PzChWhIDb9KUVZmIQ0eyqQ/HnL0Tvkk Rtd78jPjDMTyKzKvwnyM+o6qa5OS1p+bxk9agrDhMICNHaqQ1BFEmdR0HayqNVcboDZn fXUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UEa68I4MZmRI5lEkDSWyrM08/AmYaf0DVmp5YO6Yzzo=; b=su8Cs1dqVmv3BFy5B08PxjEQzt3LioBM8oaga6BpoDAXreWxvxSi9uzfcw163YunIt UMfamsquiB1iyK4AZeFFwl3t0qciVqtDPGxdWn8n1ssCrr5vYqY/mzmqfyaeuP4ALv6W rqkLisE08Nat4MR67DN5/oVWwGO77HZG2Qz+SOZ5y1sS6HV2Y9i2wGmAtkJ3bWVh8uUL +lnFF78XzxoNsirxqKo0SWz4KIZqJHO2amxE2o56evgQbkRDqIDJDvmR1RzjWq6mnyNN 1rUJswyyXEUAWXPP+NgZsDDjHdmdUZm+u03Y/5iaUPrzI7eiPSasAMS8/JpkGSmaQvKK H/Yg== X-Gm-Message-State: AElRT7HS4nEO860FFzpt0PugwK0NFJ7W5dUsE2w03mznTyJVeCKtwK37 0BqEPN6yKDJRH2wshXk4NcTrqw== X-Google-Smtp-Source: AG47ELuN5r427mpRYMyRREylxtlrNluUT3UMHGpBUyeb7bJ7WrLjuBQUs4TmMLwUv7GB/7wDimxtFg== X-Received: by 10.167.129.195 with SMTP id c3mr23574785pfn.14.1521800417598; Fri, 23 Mar 2018 03:20:17 -0700 (PDT) Received: from tiger24.localdomain (p58058-ipngnfx01hodogaya.kanagawa.ocn.ne.jp. [153.156.31.58]) by smtp.gmail.com with ESMTPSA id e8sm13348163pfd.116.2018.03.23.03.20.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 03:20:16 -0700 (PDT) From: Nobutaka Okabe To: alsa-devel@alsa-project.org Date: Fri, 23 Mar 2018 19:20:00 +0900 Message-Id: <20180323102000.6577-1-nob77413@gmail.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20180323101822.6529-1-nob77413@gmail.com> References: <20180323101822.6529-1-nob77413@gmail.com> Cc: Nobutaka Okabe , Jurgen Kramer Subject: [alsa-devel] [PATCH 2/3] ALSA: usb-audio: FIX native DSD support for TEAC UD-501 DAC 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 There are two versions of TEAC UD-501, the normal version and the vendor updated version(UD-501V2). They have the same VID/PID, but the num of the altsetting is different, UD-501 has 2 altsets for stream, and UD-501V2 has 3. So, add the logic to distinguish them by the Product Name, not by the PID. Signed-off-by: Nobutaka Okabe --- sound/usb/quirks.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 006da37ad0d9..3d2437e88122 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1153,14 +1153,23 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) * between PCM and native DSD mode * (2 altsets version) */ -static bool is_itf_usb_dsd_2alts_dac(unsigned int id) +static bool is_itf_usb_dsd_2alts_dac(struct snd_usb_audio *chip) { - switch (id) { + char *product = chip->dev->product; /* DAC product name */ + + switch (chip->usb_id) { case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ case USB_ID(0x1852, 0x5065): /* Luxman DA-06 */ return true; + case USB_ID(0x0644, 0x8043): + /* TEAC UD-501 */ + if (product && strcmp("UD-501", product)) { + return true; + } else { + return false; + } } return false; } @@ -1169,13 +1178,21 @@ static bool is_itf_usb_dsd_2alts_dac(unsigned int id) * between PCM and native DSD mode * (3 altsets version) */ -static bool is_itf_usb_dsd_3alts_dac(unsigned int id) +static bool is_itf_usb_dsd_3alts_dac(struct snd_usb_audio *chip) { - switch (id) { - case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */ + char *product = chip->dev->product; /* DAC product name */ + + switch (chip->usb_id) { case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ return true; + case USB_ID(0x0644, 0x8043): + /* TEAC UD-501V2/UD-503/NT-503 */ + if (product && !strcmp("UD-501", product)) { + return true; + } else { + return false; + } } return false; } @@ -1186,7 +1203,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, struct usb_device *dev = subs->dev; int err; - if (is_itf_usb_dsd_2alts_dac(subs->stream->chip->usb_id)) { + if (is_itf_usb_dsd_2alts_dac(subs->stream->chip)) { /* First switch to alt set 0, otherwise the mode switch cmd * will not be accepted by the DAC */ @@ -1207,7 +1224,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, break; } mdelay(20); - } else if (is_itf_usb_dsd_3alts_dac(subs->stream->chip->usb_id)) { + } else if (is_itf_usb_dsd_3alts_dac(subs->stream->chip)) { /* Vendor mode switch cmd is required. */ switch (fmt->altsetting) { case 3: /* DSD mode (DSD_U32) requested */ @@ -1306,7 +1323,7 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, /* ITF-USB DSD based DACs functionality need a delay * after each class compliant request */ - if (is_itf_usb_dsd_2alts_dac(chip->usb_id) + if (is_itf_usb_dsd_2alts_dac(chip) && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) mdelay(20); @@ -1394,13 +1411,13 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, } /* ITF-USB DSD based DACs (2 altsets version) */ - if (is_itf_usb_dsd_2alts_dac(chip->usb_id)) { + if (is_itf_usb_dsd_2alts_dac(chip)) { if (fp->altsetting == 2) return SNDRV_PCM_FMTBIT_DSD_U32_BE; } /* ITF-USB DSD based DACs (3 altsets version) */ - if (is_itf_usb_dsd_3alts_dac(chip->usb_id)) { + if (is_itf_usb_dsd_3alts_dac(chip)) { if (fp->altsetting == 3) return SNDRV_PCM_FMTBIT_DSD_U32_BE; }