diff options
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r-- | sound/usb/mixer.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index ab23869c01bb..4f40ba823163 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -486,7 +486,7 @@ static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, | |||
486 | /* | 486 | /* |
487 | * TLV callback for mixer volume controls | 487 | * TLV callback for mixer volume controls |
488 | */ | 488 | */ |
489 | static int mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | 489 | int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
490 | unsigned int size, unsigned int __user *_tlv) | 490 | unsigned int size, unsigned int __user *_tlv) |
491 | { | 491 | { |
492 | struct usb_mixer_elem_info *cval = kcontrol->private_data; | 492 | struct usb_mixer_elem_info *cval = kcontrol->private_data; |
@@ -770,6 +770,26 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
770 | struct snd_kcontrol *kctl) | 770 | struct snd_kcontrol *kctl) |
771 | { | 771 | { |
772 | switch (cval->mixer->chip->usb_id) { | 772 | switch (cval->mixer->chip->usb_id) { |
773 | case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ | ||
774 | case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ | ||
775 | if (strcmp(kctl->id.name, "Effect Duration") == 0) { | ||
776 | snd_printk(KERN_INFO | ||
777 | "usb-audio: set quirk for FTU Effect Duration\n"); | ||
778 | cval->min = 0x0000; | ||
779 | cval->max = 0x7f00; | ||
780 | cval->res = 0x0100; | ||
781 | break; | ||
782 | } | ||
783 | if (strcmp(kctl->id.name, "Effect Volume") == 0 || | ||
784 | strcmp(kctl->id.name, "Effect Feedback Volume") == 0) { | ||
785 | snd_printk(KERN_INFO | ||
786 | "usb-audio: set quirks for FTU Effect Feedback/Volume\n"); | ||
787 | cval->min = 0x00; | ||
788 | cval->max = 0x7f; | ||
789 | break; | ||
790 | } | ||
791 | break; | ||
792 | |||
773 | case USB_ID(0x0471, 0x0101): | 793 | case USB_ID(0x0471, 0x0101): |
774 | case USB_ID(0x0471, 0x0104): | 794 | case USB_ID(0x0471, 0x0104): |
775 | case USB_ID(0x0471, 0x0105): | 795 | case USB_ID(0x0471, 0x0105): |
@@ -1121,9 +1141,6 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1121 | len = snd_usb_copy_string_desc(state, nameid, | 1141 | len = snd_usb_copy_string_desc(state, nameid, |
1122 | kctl->id.name, sizeof(kctl->id.name)); | 1142 | kctl->id.name, sizeof(kctl->id.name)); |
1123 | 1143 | ||
1124 | /* get min/max values */ | ||
1125 | get_min_max_with_quirks(cval, 0, kctl); | ||
1126 | |||
1127 | switch (control) { | 1144 | switch (control) { |
1128 | case UAC_FU_MUTE: | 1145 | case UAC_FU_MUTE: |
1129 | case UAC_FU_VOLUME: | 1146 | case UAC_FU_VOLUME: |
@@ -1155,17 +1172,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1155 | } | 1172 | } |
1156 | append_ctl_name(kctl, control == UAC_FU_MUTE ? | 1173 | append_ctl_name(kctl, control == UAC_FU_MUTE ? |
1157 | " Switch" : " Volume"); | 1174 | " Switch" : " Volume"); |
1158 | if (control == UAC_FU_VOLUME) { | ||
1159 | check_mapped_dB(map, cval); | ||
1160 | if (cval->dBmin < cval->dBmax || !cval->initialized) { | ||
1161 | kctl->tlv.c = mixer_vol_tlv; | ||
1162 | kctl->vd[0].access |= | ||
1163 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | | ||
1164 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; | ||
1165 | } | ||
1166 | } | ||
1167 | break; | 1175 | break; |
1168 | |||
1169 | default: | 1176 | default: |
1170 | if (! len) | 1177 | if (! len) |
1171 | strlcpy(kctl->id.name, audio_feature_info[control-1].name, | 1178 | strlcpy(kctl->id.name, audio_feature_info[control-1].name, |
@@ -1173,6 +1180,19 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1173 | break; | 1180 | break; |
1174 | } | 1181 | } |
1175 | 1182 | ||
1183 | /* get min/max values */ | ||
1184 | get_min_max_with_quirks(cval, 0, kctl); | ||
1185 | |||
1186 | if (control == UAC_FU_VOLUME) { | ||
1187 | check_mapped_dB(map, cval); | ||
1188 | if (cval->dBmin < cval->dBmax || !cval->initialized) { | ||
1189 | kctl->tlv.c = snd_usb_mixer_vol_tlv; | ||
1190 | kctl->vd[0].access |= | ||
1191 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | | ||
1192 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; | ||
1193 | } | ||
1194 | } | ||
1195 | |||
1176 | range = (cval->max - cval->min) / cval->res; | 1196 | range = (cval->max - cval->min) / cval->res; |
1177 | /* Are there devices with volume range more than 255? I use a bit more | 1197 | /* Are there devices with volume range more than 255? I use a bit more |
1178 | * to be sure. 384 is a resolution magic number found on Logitech | 1198 | * to be sure. 384 is a resolution magic number found on Logitech |
@@ -1388,7 +1408,7 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, void *r | |||
1388 | for (pin = 0; pin < input_pins; pin++) { | 1408 | for (pin = 0; pin < input_pins; pin++) { |
1389 | err = parse_audio_unit(state, desc->baSourceID[pin]); | 1409 | err = parse_audio_unit(state, desc->baSourceID[pin]); |
1390 | if (err < 0) | 1410 | if (err < 0) |
1391 | return err; | 1411 | continue; |
1392 | err = check_input_term(state, desc->baSourceID[pin], &iterm); | 1412 | err = check_input_term(state, desc->baSourceID[pin], &iterm); |
1393 | if (err < 0) | 1413 | if (err < 0) |
1394 | return err; | 1414 | return err; |