From patchwork Tue Jun 12 22:43:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jussi Laako X-Patchwork-Id: 10461295 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 282B36020F for ; Tue, 12 Jun 2018 22:43:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C32426490 for ; Tue, 12 Jun 2018 22:43:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10AA92807B; Tue, 12 Jun 2018 22:43:44 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham 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 5E81A26490 for ; Tue, 12 Jun 2018 22:43:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 342642673E5; Wed, 13 Jun 2018 00:43:42 +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 40ADB2673E5; Wed, 13 Jun 2018 00:43:40 +0200 (CEST) Received: from mail.sonarnerd.net (rankki.sonarnerd.net [194.142.149.154]) by alsa0.perex.cz (Postfix) with ESMTP id 9CCEF267253 for ; Wed, 13 Jun 2018 00:43:38 +0200 (CEST) Received: from porkkala.uworld (porkkala.uworld [IPv6:fc00::2]) by mail.sonarnerd.net (Postfix) with ESMTP id F3F352311F3; Wed, 13 Jun 2018 01:43:37 +0300 (EEST) From: Jussi Laako To: tiwai@suse.de, alsa-devel@alsa-project.org Date: Wed, 13 Jun 2018 01:43:01 +0300 Message-Id: <1528843382-15206-2-git-send-email-jussi@sonarnerd.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528843382-15206-1-git-send-email-jussi@sonarnerd.net> References: <1528843382-15206-1-git-send-email-jussi@sonarnerd.net> Cc: Jussi Laako Subject: [alsa-devel] [PATCH 1/2] ALSA: usb-audio: Add native DSD support for Mytek DACs 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 Add new mostly generic code with Mytek VID to support native DSD mode. This implementation should be easier to maintain when manufacturers release new products. Signed-off-by: Jussi Laako --- sound/usb/card.h | 1 + sound/usb/format.c | 5 ++++- sound/usb/quirks.c | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sound/usb/card.h b/sound/usb/card.h index 1406292..9b41b7d 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -32,6 +32,7 @@ struct audioformat { struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */ bool dsd_dop; /* add DOP headers in case of DSD samples */ bool dsd_bitrev; /* reverse the bits of each DSD sample */ + bool dsd_raw; /* altsetting is raw DSD */ }; struct snd_usb_substream; diff --git a/sound/usb/format.c b/sound/usb/format.c index 49e7ec6..0a2a27f 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -64,8 +64,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubslotSize; - if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) + if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) { pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; + /* flag potentially raw DSD capable altsettings */ + fp->dsd_raw = true; + } format <<= 1; break; diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index f4b6917..cc7a623 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1443,6 +1443,18 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, return SNDRV_PCM_FMTBIT_DSD_U32_BE; } + /* Mostly generic method to detect many DSD-capable implementations - + * from XMOS/Thesycon */ + switch (USB_ID_VENDOR(chip->usb_id)) { + case 0x25ce: /* Mytek devices */ + if (fp->dsd_raw) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + default: + break; + + } + return 0; }