diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-03-04 09:37:01 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-04 10:37:46 -0500 |
commit | 8b28c93fe5a55873ce22b7126e84eb59290f8603 (patch) | |
tree | a8dabb9bfa705a25abed6fcae093334a49972b1a /sound/usb | |
parent | 1a6ab46fa9c2bc9399694b4856ab7ea19c036485 (diff) |
ALSA: usb-audio: Check Marantz/Denon USB DACs in a single place
There are three places doing the same check. Let's make them
together.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/quirks.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 753a47de8459..353532b8aee4 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1120,17 +1120,24 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1120 | /* Marantz/Denon USB DACs need a vendor cmd to switch | 1120 | /* Marantz/Denon USB DACs need a vendor cmd to switch |
1121 | * between PCM and native DSD mode | 1121 | * between PCM and native DSD mode |
1122 | */ | 1122 | */ |
1123 | static bool is_marantz_denon_dac(unsigned int id) | ||
1124 | { | ||
1125 | switch (id) { | ||
1126 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ | ||
1127 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | ||
1128 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | ||
1129 | return true; | ||
1130 | } | ||
1131 | return false; | ||
1132 | } | ||
1133 | |||
1123 | int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, | 1134 | int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, |
1124 | struct audioformat *fmt) | 1135 | struct audioformat *fmt) |
1125 | { | 1136 | { |
1126 | struct usb_device *dev = subs->dev; | 1137 | struct usb_device *dev = subs->dev; |
1127 | int err; | 1138 | int err; |
1128 | 1139 | ||
1129 | switch (subs->stream->chip->usb_id) { | 1140 | if (is_marantz_denon_dac(subs->stream->chip->usb_id)) { |
1130 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ | ||
1131 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | ||
1132 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | ||
1133 | |||
1134 | /* First switch to alt set 0, otherwise the mode switch cmd | 1141 | /* First switch to alt set 0, otherwise the mode switch cmd |
1135 | * will not be accepted by the DAC | 1142 | * will not be accepted by the DAC |
1136 | */ | 1143 | */ |
@@ -1203,17 +1210,10 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1203 | /* Marantz/Denon devices with USB DAC functionality need a delay | 1210 | /* Marantz/Denon devices with USB DAC functionality need a delay |
1204 | * after each class compliant request | 1211 | * after each class compliant request |
1205 | */ | 1212 | */ |
1206 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && | 1213 | if (is_marantz_denon_dac(USB_ID(le16_to_cpu(dev->descriptor.idVendor), |
1207 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { | 1214 | le16_to_cpu(dev->descriptor.idProduct))) |
1208 | 1215 | && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | |
1209 | switch (le16_to_cpu(dev->descriptor.idProduct)) { | 1216 | mdelay(20); |
1210 | case 0x1003: /* Denon DA300-USB */ | ||
1211 | case 0x3005: /* Marantz HD-DAC1 */ | ||
1212 | case 0x3006: /* Marantz SA-14S1 */ | ||
1213 | mdelay(20); | ||
1214 | break; | ||
1215 | } | ||
1216 | } | ||
1217 | 1217 | ||
1218 | /* Zoom R16/24 needs a tiny delay here, otherwise requests like | 1218 | /* Zoom R16/24 needs a tiny delay here, otherwise requests like |
1219 | * get/set frequency return as failed despite actually succeeding. | 1219 | * get/set frequency return as failed despite actually succeeding. |
@@ -1268,15 +1268,9 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | /* Denon/Marantz devices with USB DAC functionality */ | 1270 | /* Denon/Marantz devices with USB DAC functionality */ |
1271 | switch (chip->usb_id) { | 1271 | if (is_marantz_denon_dac(chip->usb_id)) { |
1272 | case USB_ID(0x154e, 0x1003): /* Denon DA300-USB */ | ||
1273 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | ||
1274 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | ||
1275 | if (fp->altsetting == 2) | 1272 | if (fp->altsetting == 2) |
1276 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | 1273 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1277 | break; | ||
1278 | default: | ||
1279 | break; | ||
1280 | } | 1274 | } |
1281 | 1275 | ||
1282 | return 0; | 1276 | return 0; |