From patchwork Mon Dec 12 16:24:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobutaka Okabe X-Patchwork-Id: 9470931 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 958D6607D6 for ; Mon, 12 Dec 2016 16:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90CB3284D6 for ; Mon, 12 Dec 2016 16:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85A00284DB; Mon, 12 Dec 2016 16:26:57 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, 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 8E2C6284DA for ; Mon, 12 Dec 2016 16:26:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C5EC2266BAA; Mon, 12 Dec 2016 17:26:53 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B0B4F266B8F; Mon, 12 Dec 2016 17:24:34 +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 47097266B9B; Mon, 12 Dec 2016 17:24:25 +0100 (CET) Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by alsa0.perex.cz (Postfix) with ESMTP id 0C552266B71 for ; Mon, 12 Dec 2016 17:24:22 +0100 (CET) Received: by mail-pg0-f65.google.com with SMTP id e9so1411527pgc.1 for ; Mon, 12 Dec 2016 08:24:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=nBoAClcayh/pffkpIzhGYo/4onjV2cjF6ZKpYnYPgP8=; b=ag1NTWG+ZxTWBeCuhnF3EfFYVarEA+0I5rpnHKGJhEhCi8E3zZ0mX0gYOT5brn65uv Iot5XKaqD+8+ZFbrzpiCCoP7tXbjaRkFm7dr9pp/qEq6j79JhBmXGGWA/8iURmZeoeHX RPxF2vo2A/e9E0rhmWINO4IRrwYa3gXB6xHi9CKVHWoJSiRwKTb2op198GTdXQQx0y2g i9ceTKJo6SzoOmrgsXCILJUg83KQT2Ps0gYLIV+feWzmsHnmskMypO9E/IUd8d8YOKoe 7iDaYifvph4D9c9UoRnDuMAM8lchzUNGE/dF1Kw89CpNU55nkp42oR0z5W5dpJfca18f /nIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nBoAClcayh/pffkpIzhGYo/4onjV2cjF6ZKpYnYPgP8=; b=lKqesGoEIvpVfEhxZQFCvlyW+yG7m9fBZg78r9LnVFLn1EkyX9Ua/AFCsNPaPOOfIs G4EKH0bY9APcYY5ZRA7XgbhKrkQRezOwY8r5iNXWeyffSldOGHm+W3pOs+bsIhPjhAgA o86j+lexohRWVE0yMHgF661Dn6K6jWJOf1htiqi7zMz7ANAw8rvTraWvlnb3pVlxjnnO e5W+cQl+3UHwlBBaBWcoUA/iUAmPYv0VjKKHWzZgJqu4WwfBjog/VtRzmCYG42VP+d3S T43xwHkhdRzqYH8e+p3L6+xATYmjcQgAYhHuBOWFc0RwTpZFdfHZtK/2kjM3zgPAKMI0 hnEA== X-Gm-Message-State: AKaTC02soW2+P2cgfu11u4fJ48ftd7JH/MzzQ8MP2PI19xo5CkgUxsIs7lbJlKvnEMjuMQ== X-Received: by 10.99.136.194 with SMTP id l185mr169579888pgd.106.1481559861368; Mon, 12 Dec 2016 08:24:21 -0800 (PST) Received: from localhost.localdomain ([2400:402d:a3cb:600:82ee:73ff:feb7:c2f1]) by smtp.gmail.com with ESMTPSA id y134sm76802146pfg.81.2016.12.12.08.24.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 08:24:20 -0800 (PST) From: Nobutaka Okabe To: alsa-devel@alsa-project.org Date: Tue, 13 Dec 2016 01:24:08 +0900 Message-Id: <1481559848-27750-1-git-send-email-nob77413@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: Nobutaka Okabe Subject: [alsa-devel] [PATCH] ALSA: usb-audio: Add native DSD support for TEAC 501/503 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 This patch adds native DSD support for the following devices. - TEAC NT-503 - TEAC UD-503 - TEAC UD-501 (1)Add quirks for native DSD support for TEAC devices. (2)A specific vendor command is needed to switch between PCM/DOP and DSD mode, same as Denon/Marantz devices. Signed-off-by: Nobutaka Okabe --- sound/usb/quirks.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 2782155..b3fd238 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1165,6 +1165,18 @@ static bool is_marantz_denon_dac(unsigned int id) return false; } +/* TEAC UD-501/UD-503/NT-503 USB DACs need a vendor cmd to switch + * between PCM/DOP and native DSD mode + */ +static bool is_teac_50X_dac(unsigned int id) +{ + switch (id) { + case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */ + return true; + } + return false; +} + int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, struct audioformat *fmt) { @@ -1192,6 +1204,26 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, break; } mdelay(20); + } else if (is_teac_50X_dac(subs->stream->chip->usb_id)) { + /* Vendor mode switch cmd is required. */ + switch (fmt->altsetting) { + case 3: /* DSD mode (DSD_U32) requested */ + err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, + 1, 1, NULL, 0); + if (err < 0) + return err; + break; + + case 2: /* PCM or DOP mode (S32) requested */ + case 1: /* PCM mode (S16) requested */ + err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, + 0, 1, NULL, 0); + if (err < 0) + return err; + break; + } } return 0; } @@ -1337,5 +1369,11 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, return SNDRV_PCM_FMTBIT_DSD_U32_BE; } + /* TEAC devices with USB DAC functionality */ + if (is_teac_50X_dac(chip->usb_id)) { + if (fp->altsetting == 3) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + } + return 0; }