Commit 70d79bf9 authored by Nobutaka Okabe's avatar Nobutaka Okabe Committed by Greg Kroah-Hartman

ALSA: usb-audio: Add native DSD support for Luxman DA-06

[ Upstream commit 71426535 ]

Add native DSD support quirk for Luxman DA-06 DAC, by adding the
PID/VID 1852:5065.

Rename "is_marantz_denon_dac()" function to "is_itf_usb_dsd_2alts_dac()"
to cover broader device family sharing the same USB audio
implementation(*).
For the same reason, rename "is_teac_dsd_dac()" function to
"is_itf_usb_dsd_3alts_dac()".

(*)
These devices have the same USB controller "ITF-USB DSD", supplied by
INTERFACE Co., Ltd.
"ITF-USB DSD" USB controller has two patterns,

Pattern 1. (2 altsets version)
- Altset 0: for control
- Altset 1: for stream (S32)
- Altset 2: for stream (S32, DSD_U32)

Pattern 2. (3 altsets version)
- Altset 0: for control
- Altset 1: for stream (S16)
- Altset 2: for stream (S32)
- Altset 3: for stream (S32, DSD_U32)

"is_itf_usb_dsd_2alts_dac()" returns true, if the DAC has "Pattern 1"
USB controller, and "is_itf_usb_dsd_3alts_dac()" returns true, if
"Pattern2".
Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6e57a85
...@@ -1153,24 +1153,27 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) ...@@ -1153,24 +1153,27 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
return false; return false;
} }
/* Marantz/Denon USB DACs need a vendor cmd to switch /* ITF-USB DSD based DACs need a vendor cmd to switch
* between PCM and native DSD mode * between PCM and native DSD mode
* (2 altsets version)
*/ */
static bool is_marantz_denon_dac(unsigned int id) static bool is_itf_usb_dsd_2alts_dac(unsigned int id)
{ {
switch (id) { switch (id) {
case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */
case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */
case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */
case USB_ID(0x1852, 0x5065): /* Luxman DA-06 */
return true; return true;
} }
return false; return false;
} }
/* TEAC UD-501/UD-503/NT-503 USB DACs need a vendor cmd to switch /* ITF-USB DSD based DACs need a vendor cmd to switch
* between PCM/DOP and native DSD mode * between PCM and native DSD mode
* (3 altsets version)
*/ */
static bool is_teac_dsd_dac(unsigned int id) static bool is_itf_usb_dsd_3alts_dac(unsigned int id)
{ {
switch (id) { switch (id) {
case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */ case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */
...@@ -1187,7 +1190,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, ...@@ -1187,7 +1190,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
struct usb_device *dev = subs->dev; struct usb_device *dev = subs->dev;
int err; int err;
if (is_marantz_denon_dac(subs->stream->chip->usb_id)) { if (is_itf_usb_dsd_2alts_dac(subs->stream->chip->usb_id)) {
/* First switch to alt set 0, otherwise the mode switch cmd /* First switch to alt set 0, otherwise the mode switch cmd
* will not be accepted by the DAC * will not be accepted by the DAC
*/ */
...@@ -1208,7 +1211,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, ...@@ -1208,7 +1211,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
break; break;
} }
mdelay(20); mdelay(20);
} else if (is_teac_dsd_dac(subs->stream->chip->usb_id)) { } else if (is_itf_usb_dsd_3alts_dac(subs->stream->chip->usb_id)) {
/* Vendor mode switch cmd is required. */ /* Vendor mode switch cmd is required. */
switch (fmt->altsetting) { switch (fmt->altsetting) {
case 3: /* DSD mode (DSD_U32) requested */ case 3: /* DSD mode (DSD_U32) requested */
...@@ -1304,10 +1307,10 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, ...@@ -1304,10 +1307,10 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
(requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
mdelay(20); mdelay(20);
/* Marantz/Denon devices with USB DAC functionality need a delay /* ITF-USB DSD based DACs functionality need a delay
* after each class compliant request * after each class compliant request
*/ */
if (is_marantz_denon_dac(chip->usb_id) if (is_itf_usb_dsd_2alts_dac(chip->usb_id)
&& (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
mdelay(20); mdelay(20);
...@@ -1371,14 +1374,14 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, ...@@ -1371,14 +1374,14 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
break; break;
} }
/* Denon/Marantz devices with USB DAC functionality */ /* ITF-USB DSD based DACs (2 altsets version) */
if (is_marantz_denon_dac(chip->usb_id)) { if (is_itf_usb_dsd_2alts_dac(chip->usb_id)) {
if (fp->altsetting == 2) if (fp->altsetting == 2)
return SNDRV_PCM_FMTBIT_DSD_U32_BE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
} }
/* TEAC devices with USB DAC functionality */ /* ITF-USB DSD based DACs (3 altsets version) */
if (is_teac_dsd_dac(chip->usb_id)) { if (is_itf_usb_dsd_3alts_dac(chip->usb_id)) {
if (fp->altsetting == 3) if (fp->altsetting == 3)
return SNDRV_PCM_FMTBIT_DSD_U32_BE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment