summaryrefslogtreecommitdiffstats
path: root/sound/usb/quirks.c
diff options
context:
space:
mode:
authorNobutaka Okabe <nob77413@gmail.com>2016-12-12 11:24:08 -0500
committerTakashi Iwai <tiwai@suse.de>2016-12-12 16:42:33 -0500
commit7f38ca047b0cb54df7f6d9e4110e292e45dba6ad (patch)
treeecdfc47b5701a3076058589e06dac291fa3614e6 /sound/usb/quirks.c
parent152fce5a2371f64c57abf99dbb0600cc18d399d4 (diff)
ALSA: usb-audio: Add native DSD support for TEAC 501/503 DAC
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 <nob77413@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/quirks.c')
-rw-r--r--sound/usb/quirks.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 2782155ae3ce..b3fd2382fdd9 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1165,6 +1165,18 @@ static bool is_marantz_denon_dac(unsigned int id)
1165 return false; 1165 return false;
1166} 1166}
1167 1167
1168/* TEAC UD-501/UD-503/NT-503 USB DACs need a vendor cmd to switch
1169 * between PCM/DOP and native DSD mode
1170 */
1171static bool is_teac_50X_dac(unsigned int id)
1172{
1173 switch (id) {
1174 case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */
1175 return true;
1176 }
1177 return false;
1178}
1179
1168int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, 1180int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
1169 struct audioformat *fmt) 1181 struct audioformat *fmt)
1170{ 1182{
@@ -1192,6 +1204,26 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
1192 break; 1204 break;
1193 } 1205 }
1194 mdelay(20); 1206 mdelay(20);
1207 } else if (is_teac_50X_dac(subs->stream->chip->usb_id)) {
1208 /* Vendor mode switch cmd is required. */
1209 switch (fmt->altsetting) {
1210 case 3: /* DSD mode (DSD_U32) requested */
1211 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0,
1212 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
1213 1, 1, NULL, 0);
1214 if (err < 0)
1215 return err;
1216 break;
1217
1218 case 2: /* PCM or DOP mode (S32) requested */
1219 case 1: /* PCM mode (S16) requested */
1220 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0,
1221 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
1222 0, 1, NULL, 0);
1223 if (err < 0)
1224 return err;
1225 break;
1226 }
1195 } 1227 }
1196 return 0; 1228 return 0;
1197} 1229}
@@ -1337,5 +1369,11 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
1337 return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1369 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1338 } 1370 }
1339 1371
1372 /* TEAC devices with USB DAC functionality */
1373 if (is_teac_50X_dac(chip->usb_id)) {
1374 if (fp->altsetting == 3)
1375 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1376 }
1377
1340 return 0; 1378 return 0;
1341} 1379}