diff options
-rw-r--r-- | sound/usb/quirks.c | 84 |
1 files changed, 23 insertions, 61 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index da73405c3115..acbeb52f6fd6 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1151,48 +1151,18 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1151 | 1151 | ||
1152 | /* ITF-USB DSD based 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 | * (2 altsets version) | ||
1155 | */ | 1154 | */ |
1156 | static bool is_itf_usb_dsd_2alts_dac(struct snd_usb_audio *chip) | 1155 | static bool is_itf_usb_dsd_dac(unsigned int id) |
1157 | { | 1156 | { |
1158 | char *product = chip->dev->product; /* DAC product name */ | 1157 | switch (id) { |
1159 | |||
1160 | switch (chip->usb_id) { | ||
1161 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ | 1158 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ |
1162 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | 1159 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ |
1163 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | 1160 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ |
1164 | case USB_ID(0x1852, 0x5065): /* Luxman DA-06 */ | 1161 | case USB_ID(0x1852, 0x5065): /* Luxman DA-06 */ |
1165 | return true; | 1162 | case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-501V2/UD-503/NT-503 */ |
1166 | case USB_ID(0x0644, 0x8043): | ||
1167 | /* TEAC UD-501 */ | ||
1168 | if (product && strcmp("UD-501", product)) { | ||
1169 | return true; | ||
1170 | } else { | ||
1171 | return false; | ||
1172 | } | ||
1173 | } | ||
1174 | return false; | ||
1175 | } | ||
1176 | |||
1177 | /* ITF-USB DSD based DACs need a vendor cmd to switch | ||
1178 | * between PCM and native DSD mode | ||
1179 | * (3 altsets version) | ||
1180 | */ | ||
1181 | static bool is_itf_usb_dsd_3alts_dac(struct snd_usb_audio *chip) | ||
1182 | { | ||
1183 | char *product = chip->dev->product; /* DAC product name */ | ||
1184 | |||
1185 | switch (chip->usb_id) { | ||
1186 | case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ | 1163 | case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ |
1187 | case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ | 1164 | case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ |
1188 | return true; | 1165 | return true; |
1189 | case USB_ID(0x0644, 0x8043): | ||
1190 | /* TEAC UD-501V2/UD-503/NT-503 */ | ||
1191 | if (product && !strcmp("UD-501", product)) { | ||
1192 | return true; | ||
1193 | } else { | ||
1194 | return false; | ||
1195 | } | ||
1196 | } | 1166 | } |
1197 | return false; | 1167 | return false; |
1198 | } | 1168 | } |
@@ -1203,7 +1173,7 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, | |||
1203 | struct usb_device *dev = subs->dev; | 1173 | struct usb_device *dev = subs->dev; |
1204 | int err; | 1174 | int err; |
1205 | 1175 | ||
1206 | if (is_itf_usb_dsd_2alts_dac(subs->stream->chip)) { | 1176 | if (is_itf_usb_dsd_dac(subs->stream->chip->usb_id)) { |
1207 | /* First switch to alt set 0, otherwise the mode switch cmd | 1177 | /* First switch to alt set 0, otherwise the mode switch cmd |
1208 | * will not be accepted by the DAC | 1178 | * will not be accepted by the DAC |
1209 | */ | 1179 | */ |
@@ -1213,37 +1183,26 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, | |||
1213 | 1183 | ||
1214 | mdelay(20); /* Delay needed after setting the interface */ | 1184 | mdelay(20); /* Delay needed after setting the interface */ |
1215 | 1185 | ||
1216 | switch (fmt->altsetting) { | ||
1217 | case 2: /* DSD mode requested */ | ||
1218 | case 1: /* PCM mode requested */ | ||
1219 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | ||
1220 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | ||
1221 | fmt->altsetting - 1, 1, NULL, 0); | ||
1222 | if (err < 0) | ||
1223 | return err; | ||
1224 | break; | ||
1225 | } | ||
1226 | mdelay(20); | ||
1227 | } else if (is_itf_usb_dsd_3alts_dac(subs->stream->chip)) { | ||
1228 | /* Vendor mode switch cmd is required. */ | 1186 | /* Vendor mode switch cmd is required. */ |
1229 | switch (fmt->altsetting) { | 1187 | if (fmt->formats & SNDRV_PCM_FMTBIT_DSD_U32_BE) { |
1230 | case 3: /* DSD mode (DSD_U32) requested */ | 1188 | /* DSD mode (DSD_U32) requested */ |
1231 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | 1189 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, |
1232 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 1190 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
1233 | 1, 1, NULL, 0); | 1191 | 1, 1, NULL, 0); |
1234 | if (err < 0) | 1192 | if (err < 0) |
1235 | return err; | 1193 | return err; |
1236 | break; | ||
1237 | 1194 | ||
1238 | case 2: /* PCM or DOP mode (S32) requested */ | 1195 | } else { |
1239 | case 1: /* PCM mode (S16) requested */ | 1196 | /* PCM or DOP mode (S32) requested */ |
1197 | /* PCM mode (S16) requested */ | ||
1240 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, | 1198 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, |
1241 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 1199 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
1242 | 0, 1, NULL, 0); | 1200 | 0, 1, NULL, 0); |
1243 | if (err < 0) | 1201 | if (err < 0) |
1244 | return err; | 1202 | return err; |
1245 | break; | 1203 | |
1246 | } | 1204 | } |
1205 | mdelay(20); | ||
1247 | } | 1206 | } |
1248 | return 0; | 1207 | return 0; |
1249 | } | 1208 | } |
@@ -1323,7 +1282,7 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1323 | /* ITF-USB DSD based DACs functionality need a delay | 1282 | /* ITF-USB DSD based DACs functionality need a delay |
1324 | * after each class compliant request | 1283 | * after each class compliant request |
1325 | */ | 1284 | */ |
1326 | if (is_itf_usb_dsd_2alts_dac(chip) | 1285 | if (is_itf_usb_dsd_dac(chip->usb_id) |
1327 | && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1286 | && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1328 | mdelay(20); | 1287 | mdelay(20); |
1329 | 1288 | ||
@@ -1349,6 +1308,8 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1349 | struct audioformat *fp, | 1308 | struct audioformat *fp, |
1350 | unsigned int sample_bytes) | 1309 | unsigned int sample_bytes) |
1351 | { | 1310 | { |
1311 | struct usb_interface *iface; | ||
1312 | |||
1352 | /* Playback Designs */ | 1313 | /* Playback Designs */ |
1353 | if (USB_ID_VENDOR(chip->usb_id) == 0x23ba) { | 1314 | if (USB_ID_VENDOR(chip->usb_id) == 0x23ba) { |
1354 | switch (fp->altsetting) { | 1315 | switch (fp->altsetting) { |
@@ -1410,15 +1371,16 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1410 | break; | 1371 | break; |
1411 | } | 1372 | } |
1412 | 1373 | ||
1413 | /* ITF-USB DSD based DACs (2 altsets version) */ | 1374 | /* ITF-USB DSD based DACs */ |
1414 | if (is_itf_usb_dsd_2alts_dac(chip)) { | 1375 | if (is_itf_usb_dsd_dac(chip->usb_id)) { |
1415 | if (fp->altsetting == 2) | 1376 | iface = usb_ifnum_to_if(chip->dev, fp->iface); |
1416 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | ||
1417 | } | ||
1418 | 1377 | ||
1419 | /* ITF-USB DSD based DACs (3 altsets version) */ | 1378 | /* Altsetting 2 support native DSD if the num of altsets is |
1420 | if (is_itf_usb_dsd_3alts_dac(chip)) { | 1379 | * three (0-2), |
1421 | 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) | ||
1422 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | 1384 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1423 | } | 1385 | } |
1424 | 1386 | ||