diff options
Diffstat (limited to 'sound/usb/quirks.c')
-rw-r--r-- | sound/usb/quirks.c | 102 |
1 files changed, 59 insertions, 43 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 794224e1d6df..acbeb52f6fd6 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1149,27 +1149,17 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1149 | return false; | 1149 | return false; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | /* Marantz/Denon USB DACs need a vendor cmd to switch | 1152 | /* ITF-USB DSD based DACs need a vendor cmd to switch |
1153 | * between PCM and native DSD mode | 1153 | * between PCM and native DSD mode |
1154 | */ | 1154 | */ |
1155 | static bool is_marantz_denon_dac(unsigned int id) | 1155 | static bool is_itf_usb_dsd_dac(unsigned int id) |
1156 | { | 1156 | { |
1157 | switch (id) { | 1157 | switch (id) { |
1158 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ | 1158 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ |
1159 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | 1159 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ |
1160 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | 1160 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ |
1161 | return true; | 1161 | case USB_ID(0x1852, 0x5065): /* Luxman DA-06 */ |
1162 | } | 1162 | case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-501V2/UD-503/NT-503 */ |
1163 | return false; | ||
1164 | } | ||
1165 | |||
1166 | /* TEAC UD-501/UD-503/NT-503 USB DACs need a vendor cmd to switch | ||
1167 | * between PCM/DOP and native DSD mode | ||
1168 | */ | ||
1169 | static bool is_teac_dsd_dac(unsigned int id) | ||
1170 | { | ||
1171 | switch (id) { | ||
1172 | case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */ | ||
1173 | case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ | 1163 | case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ |
1174 | case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ | 1164 | case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ |
1175 | return true; | 1165 | return true; |
@@ -1183,7 +1173,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, | |||
1183 | struct usb_device *dev = subs->dev; | 1173 | struct usb_device *dev = subs->dev; |
1184 | int err; | 1174 | int err; |
1185 | 1175 | ||
1186 | if (is_marantz_denon_dac(subs->stream->chip->usb_id)) { | 1176 | if (is_itf_usb_dsd_dac(subs->stream->chip->usb_id)) { |
1187 | /* First switch to alt set 0, otherwise the mode switch cmd | 1177 | /* First switch to alt set 0, otherwise the mode switch cmd |
1188 | * will not be accepted by the DAC | 1178 | * will not be accepted by the DAC |
1189 | */ | 1179 | */ |
@@ -1193,37 +1183,26 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, | |||
1193 | 1183 | ||
1194 | mdelay(20); /* Delay needed after setting the interface */ | 1184 | mdelay(20); /* Delay needed after setting the interface */ |
1195 | 1185 | ||
1196 | switch (fmt->altsetting) { | ||
1197 | case 2: /* DSD mode requested */ | ||
1198 | case 1: /* PCM mode requested */ | ||
1199 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | ||
1200 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | ||
1201 | fmt->altsetting - 1, 1, NULL, 0); | ||
1202 | if (err < 0) | ||
1203 | return err; | ||
1204 | break; | ||
1205 | } | ||
1206 | mdelay(20); | ||
1207 | } else if (is_teac_dsd_dac(subs->stream->chip->usb_id)) { | ||
1208 | /* Vendor mode switch cmd is required. */ | 1186 | /* Vendor mode switch cmd is required. */ |
1209 | switch (fmt->altsetting) { | 1187 | if (fmt->formats & SNDRV_PCM_FMTBIT_DSD_U32_BE) { |
1210 | case 3: /* DSD mode (DSD_U32) requested */ | 1188 | /* DSD mode (DSD_U32) requested */ |
1211 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | 1189 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, |
1212 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 1190 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
1213 | 1, 1, NULL, 0); | 1191 | 1, 1, NULL, 0); |
1214 | if (err < 0) | 1192 | if (err < 0) |
1215 | return err; | 1193 | return err; |
1216 | break; | ||
1217 | 1194 | ||
1218 | case 2: /* PCM or DOP mode (S32) requested */ | 1195 | } else { |
1219 | case 1: /* PCM mode (S16) requested */ | 1196 | /* PCM or DOP mode (S32) requested */ |
1197 | /* PCM mode (S16) requested */ | ||
1220 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | 1198 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, |
1221 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 1199 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
1222 | 0, 1, NULL, 0); | 1200 | 0, 1, NULL, 0); |
1223 | if (err < 0) | 1201 | if (err < 0) |
1224 | return err; | 1202 | return err; |
1225 | break; | 1203 | |
1226 | } | 1204 | } |
1205 | mdelay(20); | ||
1227 | } | 1206 | } |
1228 | return 0; | 1207 | return 0; |
1229 | } | 1208 | } |
@@ -1300,10 +1279,10 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1300 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1279 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1301 | mdelay(20); | 1280 | mdelay(20); |
1302 | 1281 | ||
1303 | /* Marantz/Denon devices with USB DAC functionality need a delay | 1282 | /* ITF-USB DSD based DACs functionality need a delay |
1304 | * after each class compliant request | 1283 | * after each class compliant request |
1305 | */ | 1284 | */ |
1306 | if (is_marantz_denon_dac(chip->usb_id) | 1285 | if (is_itf_usb_dsd_dac(chip->usb_id) |
1307 | && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1286 | && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1308 | mdelay(20); | 1287 | mdelay(20); |
1309 | 1288 | ||
@@ -1329,6 +1308,8 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1329 | struct audioformat *fp, | 1308 | struct audioformat *fp, |
1330 | unsigned int sample_bytes) | 1309 | unsigned int sample_bytes) |
1331 | { | 1310 | { |
1311 | struct usb_interface *iface; | ||
1312 | |||
1332 | /* Playback Designs */ | 1313 | /* Playback Designs */ |
1333 | if (USB_ID_VENDOR(chip->usb_id) == 0x23ba) { | 1314 | if (USB_ID_VENDOR(chip->usb_id) == 0x23ba) { |
1334 | switch (fp->altsetting) { | 1315 | switch (fp->altsetting) { |
@@ -1390,17 +1371,52 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1390 | break; | 1371 | break; |
1391 | } | 1372 | } |
1392 | 1373 | ||
1393 | /* Denon/Marantz devices with USB DAC functionality */ | 1374 | /* ITF-USB DSD based DACs */ |
1394 | if (is_marantz_denon_dac(chip->usb_id)) { | 1375 | if (is_itf_usb_dsd_dac(chip->usb_id)) { |
1395 | if (fp->altsetting == 2) | 1376 | iface = usb_ifnum_to_if(chip->dev, fp->iface); |
1396 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | ||
1397 | } | ||
1398 | 1377 | ||
1399 | /* TEAC devices with USB DAC functionality */ | 1378 | /* Altsetting 2 support native DSD if the num of altsets is |
1400 | if (is_teac_dsd_dac(chip->usb_id)) { | 1379 | * three (0-2), |
1401 | if (fp->altsetting == 3) | 1380 | * Altsetting 3 support native DSD if the num of altsets is |
1381 | * four (0-3). | ||
1382 | */ | ||
1383 | if (fp->altsetting == iface->num_altsetting - 1) | ||
1402 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | 1384 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1403 | } | 1385 | } |
1404 | 1386 | ||
1405 | return 0; | 1387 | return 0; |
1406 | } | 1388 | } |
1389 | |||
1390 | void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, | ||
1391 | struct audioformat *fp, | ||
1392 | int stream) | ||
1393 | { | ||
1394 | switch (chip->usb_id) { | ||
1395 | case USB_ID(0x0a92, 0x0053): /* AudioTrak Optoplay */ | ||
1396 | /* Optoplay sets the sample rate attribute although | ||
1397 | * it seems not supporting it in fact. | ||
1398 | */ | ||
1399 | fp->attributes &= ~UAC_EP_CS_ATTR_SAMPLE_RATE; | ||
1400 | break; | ||
1401 | case USB_ID(0x041e, 0x3020): /* Creative SB Audigy 2 NX */ | ||
1402 | case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ | ||
1403 | /* doesn't set the sample rate attribute, but supports it */ | ||
1404 | fp->attributes |= UAC_EP_CS_ATTR_SAMPLE_RATE; | ||
1405 | break; | ||
1406 | case USB_ID(0x0763, 0x2001): /* M-Audio Quattro USB */ | ||
1407 | case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro USB */ | ||
1408 | case USB_ID(0x047f, 0x0ca1): /* plantronics headset */ | ||
1409 | case USB_ID(0x077d, 0x07af): /* Griffin iMic (note that there is | ||
1410 | an older model 77d:223) */ | ||
1411 | /* | ||
1412 | * plantronics headset and Griffin iMic have set adaptive-in | ||
1413 | * although it's really not... | ||
1414 | */ | ||
1415 | fp->ep_attr &= ~USB_ENDPOINT_SYNCTYPE; | ||
1416 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
1417 | fp->ep_attr |= USB_ENDPOINT_SYNC_ADAPTIVE; | ||
1418 | else | ||
1419 | fp->ep_attr |= USB_ENDPOINT_SYNC_SYNC; | ||
1420 | break; | ||
1421 | } | ||
1422 | } | ||