diff options
-rw-r--r-- | sound/soc/codecs/tlv320aic23.c | 14 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.c | 48 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.c | 37 | ||||
-rw-r--r-- | sound/soc/codecs/wm8350.c | 39 | ||||
-rw-r--r-- | sound/soc/codecs/wm8580.c | 36 | ||||
-rw-r--r-- | sound/soc/codecs/wm_hubs.c | 18 |
6 files changed, 53 insertions, 139 deletions
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 33bb52f3f683..c3a4bb207d7b 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -159,15 +159,6 @@ static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol, | |||
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | #define SOC_TLV320AIC23_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ | ||
163 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
164 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
165 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
166 | .tlv.p = (tlv_array), \ | ||
167 | .info = snd_soc_info_volsw, .get = snd_soc_tlv320aic23_get_volsw,\ | ||
168 | .put = snd_soc_tlv320aic23_put_volsw, \ | ||
169 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
170 | |||
171 | static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { | 162 | static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { |
172 | SOC_DOUBLE_R_TLV("Digital Playback Volume", TLV320AIC23_LCHNVOL, | 163 | SOC_DOUBLE_R_TLV("Digital Playback Volume", TLV320AIC23_LCHNVOL, |
173 | TLV320AIC23_RCHNVOL, 0, 127, 0, out_gain_tlv), | 164 | TLV320AIC23_RCHNVOL, 0, 127, 0, out_gain_tlv), |
@@ -178,8 +169,9 @@ static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { | |||
178 | TLV320AIC23_RINVOL, 0, 31, 0, input_gain_tlv), | 169 | TLV320AIC23_RINVOL, 0, 31, 0, input_gain_tlv), |
179 | SOC_SINGLE("Mic Input Switch", TLV320AIC23_ANLG, 1, 1, 1), | 170 | SOC_SINGLE("Mic Input Switch", TLV320AIC23_ANLG, 1, 1, 1), |
180 | SOC_SINGLE("Mic Booster Switch", TLV320AIC23_ANLG, 0, 1, 0), | 171 | SOC_SINGLE("Mic Booster Switch", TLV320AIC23_ANLG, 0, 1, 0), |
181 | SOC_TLV320AIC23_SINGLE_TLV("Sidetone Volume", TLV320AIC23_ANLG, | 172 | SOC_SINGLE_EXT_TLV("Sidetone Volume", TLV320AIC23_ANLG, 6, 4, 0, |
182 | 6, 4, 0, sidetone_vol_tlv), | 173 | snd_soc_tlv320aic23_get_volsw, |
174 | snd_soc_tlv320aic23_put_volsw, sidetone_vol_tlv), | ||
183 | SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph), | 175 | SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph), |
184 | }; | 176 | }; |
185 | 177 | ||
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 71674bec9604..7c244cd0d53f 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -863,34 +863,6 @@ static int digimic_event(struct snd_soc_dapm_widget *w, | |||
863 | * Inverting not going to help with these. | 863 | * Inverting not going to help with these. |
864 | * Custom volsw and volsw_2r get/put functions to handle these gain bits. | 864 | * Custom volsw and volsw_2r get/put functions to handle these gain bits. |
865 | */ | 865 | */ |
866 | #define SOC_DOUBLE_TLV_TWL4030(xname, xreg, shift_left, shift_right, xmax,\ | ||
867 | xinvert, tlv_array) \ | ||
868 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
869 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
870 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
871 | .tlv.p = (tlv_array), \ | ||
872 | .info = snd_soc_info_volsw, \ | ||
873 | .get = snd_soc_get_volsw_twl4030, \ | ||
874 | .put = snd_soc_put_volsw_twl4030, \ | ||
875 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
876 | {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ | ||
877 | .max = xmax, .invert = xinvert} } | ||
878 | #define SOC_DOUBLE_R_TLV_TWL4030(xname, reg_left, reg_right, xshift, xmax,\ | ||
879 | xinvert, tlv_array) \ | ||
880 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
881 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
882 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
883 | .tlv.p = (tlv_array), \ | ||
884 | .info = snd_soc_info_volsw_2r, \ | ||
885 | .get = snd_soc_get_volsw_r2_twl4030,\ | ||
886 | .put = snd_soc_put_volsw_r2_twl4030, \ | ||
887 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
888 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | ||
889 | .rshift = xshift, .max = xmax, .invert = xinvert} } | ||
890 | #define SOC_SINGLE_TLV_TWL4030(xname, xreg, xshift, xmax, xinvert, tlv_array) \ | ||
891 | SOC_DOUBLE_TLV_TWL4030(xname, xreg, xshift, xshift, xmax, \ | ||
892 | xinvert, tlv_array) | ||
893 | |||
894 | static int snd_soc_get_volsw_twl4030(struct snd_kcontrol *kcontrol, | 866 | static int snd_soc_get_volsw_twl4030(struct snd_kcontrol *kcontrol, |
895 | struct snd_ctl_elem_value *ucontrol) | 867 | struct snd_ctl_elem_value *ucontrol) |
896 | { | 868 | { |
@@ -1197,19 +1169,23 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = { | |||
1197 | TWL4030_REG_VDL_APGA_CTL, 1, 1, 0), | 1169 | TWL4030_REG_VDL_APGA_CTL, 1, 1, 0), |
1198 | 1170 | ||
1199 | /* Separate output gain controls */ | 1171 | /* Separate output gain controls */ |
1200 | SOC_DOUBLE_R_TLV_TWL4030("PreDriv Playback Volume", | 1172 | SOC_DOUBLE_R_EXT_TLV("PreDriv Playback Volume", |
1201 | TWL4030_REG_PREDL_CTL, TWL4030_REG_PREDR_CTL, | 1173 | TWL4030_REG_PREDL_CTL, TWL4030_REG_PREDR_CTL, |
1202 | 4, 3, 0, output_tvl), | 1174 | 4, 3, 0, snd_soc_get_volsw_r2_twl4030, |
1175 | snd_soc_put_volsw_r2_twl4030, output_tvl), | ||
1203 | 1176 | ||
1204 | SOC_DOUBLE_TLV_TWL4030("Headset Playback Volume", | 1177 | SOC_DOUBLE_EXT_TLV("Headset Playback Volume", |
1205 | TWL4030_REG_HS_GAIN_SET, 0, 2, 3, 0, output_tvl), | 1178 | TWL4030_REG_HS_GAIN_SET, 0, 2, 3, 0, snd_soc_get_volsw_twl4030, |
1179 | snd_soc_put_volsw_twl4030, output_tvl), | ||
1206 | 1180 | ||
1207 | SOC_DOUBLE_R_TLV_TWL4030("Carkit Playback Volume", | 1181 | SOC_DOUBLE_R_EXT_TLV("Carkit Playback Volume", |
1208 | TWL4030_REG_PRECKL_CTL, TWL4030_REG_PRECKR_CTL, | 1182 | TWL4030_REG_PRECKL_CTL, TWL4030_REG_PRECKR_CTL, |
1209 | 4, 3, 0, output_tvl), | 1183 | 4, 3, 0, snd_soc_get_volsw_r2_twl4030, |
1184 | snd_soc_put_volsw_r2_twl4030, output_tvl), | ||
1210 | 1185 | ||
1211 | SOC_SINGLE_TLV_TWL4030("Earpiece Playback Volume", | 1186 | SOC_SINGLE_EXT_TLV("Earpiece Playback Volume", |
1212 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_ear_tvl), | 1187 | TWL4030_REG_EAR_CTL, 4, 3, 0, snd_soc_get_volsw_twl4030, |
1188 | snd_soc_put_volsw_twl4030, output_ear_tvl), | ||
1213 | 1189 | ||
1214 | /* Common capture gain controls */ | 1190 | /* Common capture gain controls */ |
1215 | SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", | 1191 | SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 8c740c1aa32f..11f681b15dec 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -812,33 +812,6 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol, | |||
812 | return snd_soc_get_volsw(kcontrol, ucontrol); | 812 | return snd_soc_get_volsw(kcontrol, ucontrol); |
813 | } | 813 | } |
814 | 814 | ||
815 | /* double control with volume update */ | ||
816 | #define SOC_TWL6040_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax,\ | ||
817 | xinvert, tlv_array)\ | ||
818 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
819 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
820 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
821 | .tlv.p = (tlv_array), \ | ||
822 | .info = snd_soc_info_volsw, .get = twl6040_get_volsw, \ | ||
823 | .put = twl6040_put_volsw, \ | ||
824 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
825 | {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ | ||
826 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
827 | |||
828 | /* double control with volume update */ | ||
829 | #define SOC_TWL6040_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax,\ | ||
830 | xinvert, tlv_array)\ | ||
831 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
832 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
833 | SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
834 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | ||
835 | .tlv.p = (tlv_array), \ | ||
836 | .info = snd_soc_info_volsw_2r, \ | ||
837 | .get = twl6040_get_volsw, .put = twl6040_put_volsw, \ | ||
838 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
839 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | ||
840 | .rshift = xshift, .max = xmax, .invert = xinvert}, } | ||
841 | |||
842 | /* | 815 | /* |
843 | * MICATT volume control: | 816 | * MICATT volume control: |
844 | * from -6 to 0 dB in 6 dB steps | 817 | * from -6 to 0 dB in 6 dB steps |
@@ -1027,10 +1000,12 @@ static const struct snd_kcontrol_new twl6040_snd_controls[] = { | |||
1027 | TWL6040_REG_LINEGAIN, 0, 3, 7, 0, afm_amp_tlv), | 1000 | TWL6040_REG_LINEGAIN, 0, 3, 7, 0, afm_amp_tlv), |
1028 | 1001 | ||
1029 | /* Playback gains */ | 1002 | /* Playback gains */ |
1030 | SOC_TWL6040_DOUBLE_TLV("Headset Playback Volume", | 1003 | SOC_DOUBLE_EXT_TLV("Headset Playback Volume", |
1031 | TWL6040_REG_HSGAIN, 0, 4, 0xF, 1, hs_tlv), | 1004 | TWL6040_REG_HSGAIN, 0, 4, 0xF, 1, twl6040_get_volsw, |
1032 | SOC_TWL6040_DOUBLE_R_TLV("Handsfree Playback Volume", | 1005 | twl6040_put_volsw, hs_tlv), |
1033 | TWL6040_REG_HFLGAIN, TWL6040_REG_HFRGAIN, 0, 0x1D, 1, hf_tlv), | 1006 | SOC_DOUBLE_R_EXT_TLV("Handsfree Playback Volume", |
1007 | TWL6040_REG_HFLGAIN, TWL6040_REG_HFRGAIN, 0, 0x1D, 1, | ||
1008 | twl6040_get_volsw, twl6040_put_volsw, hf_tlv), | ||
1034 | SOC_SINGLE_TLV("Earphone Playback Volume", | 1009 | SOC_SINGLE_TLV("Earphone Playback Volume", |
1035 | TWL6040_REG_EARCTL, 1, 0xF, 1, ep_tlv), | 1010 | TWL6040_REG_EARCTL, 1, 0xF, 1, ep_tlv), |
1036 | 1011 | ||
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 6d6dc9efe914..50ea9d7d12d0 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -395,20 +395,6 @@ static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol, | |||
395 | return snd_soc_get_volsw_2r(kcontrol, ucontrol); | 395 | return snd_soc_get_volsw_2r(kcontrol, ucontrol); |
396 | } | 396 | } |
397 | 397 | ||
398 | /* double control with volume update */ | ||
399 | #define SOC_WM8350_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \ | ||
400 | xinvert, tlv_array) \ | ||
401 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
402 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
403 | SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
404 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | ||
405 | .tlv.p = (tlv_array), \ | ||
406 | .info = snd_soc_info_volsw_2r, \ | ||
407 | .get = wm8350_get_volsw_2r, .put = wm8350_put_volsw_2r_vu, \ | ||
408 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
409 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | ||
410 | .rshift = xshift, .max = xmax, .invert = xinvert}, } | ||
411 | |||
412 | static const char *wm8350_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" }; | 398 | static const char *wm8350_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" }; |
413 | static const char *wm8350_pol[] = { "Normal", "Inv R", "Inv L", "Inv L & R" }; | 399 | static const char *wm8350_pol[] = { "Normal", "Inv R", "Inv L", "Inv L & R" }; |
414 | static const char *wm8350_dacmutem[] = { "Normal", "Soft" }; | 400 | static const char *wm8350_dacmutem[] = { "Normal", "Soft" }; |
@@ -443,26 +429,29 @@ static const unsigned int capture_sd_tlv[] = { | |||
443 | static const struct snd_kcontrol_new wm8350_snd_controls[] = { | 429 | static const struct snd_kcontrol_new wm8350_snd_controls[] = { |
444 | SOC_ENUM("Playback Deemphasis", wm8350_enum[0]), | 430 | SOC_ENUM("Playback Deemphasis", wm8350_enum[0]), |
445 | SOC_ENUM("Playback DAC Inversion", wm8350_enum[1]), | 431 | SOC_ENUM("Playback DAC Inversion", wm8350_enum[1]), |
446 | SOC_WM8350_DOUBLE_R_TLV("Playback PCM Volume", | 432 | SOC_DOUBLE_R_EXT_TLV("Playback PCM Volume", |
447 | WM8350_DAC_DIGITAL_VOLUME_L, | 433 | WM8350_DAC_DIGITAL_VOLUME_L, |
448 | WM8350_DAC_DIGITAL_VOLUME_R, | 434 | WM8350_DAC_DIGITAL_VOLUME_R, |
449 | 0, 255, 0, dac_pcm_tlv), | 435 | 0, 255, 0, wm8350_get_volsw_2r, |
436 | wm8350_put_volsw_2r_vu, dac_pcm_tlv), | ||
450 | SOC_ENUM("Playback PCM Mute Function", wm8350_enum[2]), | 437 | SOC_ENUM("Playback PCM Mute Function", wm8350_enum[2]), |
451 | SOC_ENUM("Playback PCM Mute Speed", wm8350_enum[3]), | 438 | SOC_ENUM("Playback PCM Mute Speed", wm8350_enum[3]), |
452 | SOC_ENUM("Capture PCM Filter", wm8350_enum[4]), | 439 | SOC_ENUM("Capture PCM Filter", wm8350_enum[4]), |
453 | SOC_ENUM("Capture PCM HP Filter", wm8350_enum[5]), | 440 | SOC_ENUM("Capture PCM HP Filter", wm8350_enum[5]), |
454 | SOC_ENUM("Capture ADC Inversion", wm8350_enum[6]), | 441 | SOC_ENUM("Capture ADC Inversion", wm8350_enum[6]), |
455 | SOC_WM8350_DOUBLE_R_TLV("Capture PCM Volume", | 442 | SOC_DOUBLE_R_EXT_TLV("Capture PCM Volume", |
456 | WM8350_ADC_DIGITAL_VOLUME_L, | 443 | WM8350_ADC_DIGITAL_VOLUME_L, |
457 | WM8350_ADC_DIGITAL_VOLUME_R, | 444 | WM8350_ADC_DIGITAL_VOLUME_R, |
458 | 0, 255, 0, adc_pcm_tlv), | 445 | 0, 255, 0, wm8350_get_volsw_2r, |
446 | wm8350_put_volsw_2r_vu, adc_pcm_tlv), | ||
459 | SOC_DOUBLE_TLV("Capture Sidetone Volume", | 447 | SOC_DOUBLE_TLV("Capture Sidetone Volume", |
460 | WM8350_ADC_DIVIDER, | 448 | WM8350_ADC_DIVIDER, |
461 | 8, 4, 15, 1, capture_sd_tlv), | 449 | 8, 4, 15, 1, capture_sd_tlv), |
462 | SOC_WM8350_DOUBLE_R_TLV("Capture Volume", | 450 | SOC_DOUBLE_R_EXT_TLV("Capture Volume", |
463 | WM8350_LEFT_INPUT_VOLUME, | 451 | WM8350_LEFT_INPUT_VOLUME, |
464 | WM8350_RIGHT_INPUT_VOLUME, | 452 | WM8350_RIGHT_INPUT_VOLUME, |
465 | 2, 63, 0, pre_amp_tlv), | 453 | 2, 63, 0, wm8350_get_volsw_2r, |
454 | wm8350_put_volsw_2r_vu, pre_amp_tlv), | ||
466 | SOC_DOUBLE_R("Capture ZC Switch", | 455 | SOC_DOUBLE_R("Capture ZC Switch", |
467 | WM8350_LEFT_INPUT_VOLUME, | 456 | WM8350_LEFT_INPUT_VOLUME, |
468 | WM8350_RIGHT_INPUT_VOLUME, 13, 1, 0), | 457 | WM8350_RIGHT_INPUT_VOLUME, 13, 1, 0), |
@@ -490,17 +479,19 @@ static const struct snd_kcontrol_new wm8350_snd_controls[] = { | |||
490 | SOC_SINGLE_TLV("Out4 Capture Volume", | 479 | SOC_SINGLE_TLV("Out4 Capture Volume", |
491 | WM8350_INPUT_MIXER_VOLUME, | 480 | WM8350_INPUT_MIXER_VOLUME, |
492 | 1, 7, 0, out_mix_tlv), | 481 | 1, 7, 0, out_mix_tlv), |
493 | SOC_WM8350_DOUBLE_R_TLV("Out1 Playback Volume", | 482 | SOC_DOUBLE_R_EXT_TLV("Out1 Playback Volume", |
494 | WM8350_LOUT1_VOLUME, | 483 | WM8350_LOUT1_VOLUME, |
495 | WM8350_ROUT1_VOLUME, | 484 | WM8350_ROUT1_VOLUME, |
496 | 2, 63, 0, out_pga_tlv), | 485 | 2, 63, 0, wm8350_get_volsw_2r, |
486 | wm8350_put_volsw_2r_vu, out_pga_tlv), | ||
497 | SOC_DOUBLE_R("Out1 Playback ZC Switch", | 487 | SOC_DOUBLE_R("Out1 Playback ZC Switch", |
498 | WM8350_LOUT1_VOLUME, | 488 | WM8350_LOUT1_VOLUME, |
499 | WM8350_ROUT1_VOLUME, 13, 1, 0), | 489 | WM8350_ROUT1_VOLUME, 13, 1, 0), |
500 | SOC_WM8350_DOUBLE_R_TLV("Out2 Playback Volume", | 490 | SOC_DOUBLE_R_EXT_TLV("Out2 Playback Volume", |
501 | WM8350_LOUT2_VOLUME, | 491 | WM8350_LOUT2_VOLUME, |
502 | WM8350_ROUT2_VOLUME, | 492 | WM8350_ROUT2_VOLUME, |
503 | 2, 63, 0, out_pga_tlv), | 493 | 2, 63, 0, wm8350_get_volsw_2r, |
494 | wm8350_put_volsw_2r_vu, out_pga_tlv), | ||
504 | SOC_DOUBLE_R("Out2 Playback ZC Switch", WM8350_LOUT2_VOLUME, | 495 | SOC_DOUBLE_R("Out2 Playback ZC Switch", WM8350_LOUT2_VOLUME, |
505 | WM8350_ROUT2_VOLUME, 13, 1, 0), | 496 | WM8350_ROUT2_VOLUME, 13, 1, 0), |
506 | SOC_SINGLE("Out2 Right Invert Switch", WM8350_ROUT2_VOLUME, 10, 1, 0), | 497 | SOC_SINGLE("Out2 Right Invert Switch", WM8350_ROUT2_VOLUME, 10, 1, 0), |
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 4664c3a76c78..02cbf13b6c81 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -224,31 +224,19 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol, | |||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | #define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \ | ||
228 | xinvert, tlv_array) \ | ||
229 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
230 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
231 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
232 | .tlv.p = (tlv_array), \ | ||
233 | .info = snd_soc_info_volsw_2r, \ | ||
234 | .get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \ | ||
235 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
236 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | ||
237 | .max = xmax, .invert = xinvert} } | ||
238 | |||
239 | static const struct snd_kcontrol_new wm8580_snd_controls[] = { | 227 | static const struct snd_kcontrol_new wm8580_snd_controls[] = { |
240 | SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume", | 228 | SOC_DOUBLE_R_EXT_TLV("DAC1 Playback Volume", |
241 | WM8580_DIGITAL_ATTENUATION_DACL1, | 229 | WM8580_DIGITAL_ATTENUATION_DACL1, |
242 | WM8580_DIGITAL_ATTENUATION_DACR1, | 230 | WM8580_DIGITAL_ATTENUATION_DACR1, |
243 | 0, 0xff, 0, dac_tlv), | 231 | 0, 0xff, 0, snd_soc_get_volsw_2r, wm8580_out_vu, dac_tlv), |
244 | SOC_WM8580_OUT_DOUBLE_R_TLV("DAC2 Playback Volume", | 232 | SOC_DOUBLE_R_EXT_TLV("DAC2 Playback Volume", |
245 | WM8580_DIGITAL_ATTENUATION_DACL2, | 233 | WM8580_DIGITAL_ATTENUATION_DACL2, |
246 | WM8580_DIGITAL_ATTENUATION_DACR2, | 234 | WM8580_DIGITAL_ATTENUATION_DACR2, |
247 | 0, 0xff, 0, dac_tlv), | 235 | 0, 0xff, 0, snd_soc_get_volsw_2r, wm8580_out_vu, dac_tlv), |
248 | SOC_WM8580_OUT_DOUBLE_R_TLV("DAC3 Playback Volume", | 236 | SOC_DOUBLE_R_EXT_TLV("DAC3 Playback Volume", |
249 | WM8580_DIGITAL_ATTENUATION_DACL3, | 237 | WM8580_DIGITAL_ATTENUATION_DACL3, |
250 | WM8580_DIGITAL_ATTENUATION_DACR3, | 238 | WM8580_DIGITAL_ATTENUATION_DACR3, |
251 | 0, 0xff, 0, dac_tlv), | 239 | 0, 0xff, 0, snd_soc_get_volsw_2r, wm8580_out_vu, dac_tlv), |
252 | 240 | ||
253 | SOC_SINGLE("DAC1 Deemphasis Switch", WM8580_DAC_CONTROL3, 0, 1, 0), | 241 | SOC_SINGLE("DAC1 Deemphasis Switch", WM8580_DAC_CONTROL3, 0, 1, 0), |
254 | SOC_SINGLE("DAC2 Deemphasis Switch", WM8580_DAC_CONTROL3, 1, 1, 0), | 242 | SOC_SINGLE("DAC2 Deemphasis Switch", WM8580_DAC_CONTROL3, 1, 1, 0), |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index ca8ce03510f4..f3583a5b8095 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -362,19 +362,11 @@ SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 3, 0, 7, 0, | |||
362 | SOC_ENUM("Speaker Reference", speaker_ref), | 362 | SOC_ENUM("Speaker Reference", speaker_ref), |
363 | SOC_ENUM("Speaker Mode", speaker_mode), | 363 | SOC_ENUM("Speaker Mode", speaker_mode), |
364 | 364 | ||
365 | { | 365 | SOC_DOUBLE_R_EXT_TLV("Headphone Volume", |
366 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Headphone Volume", | 366 | WM8993_LEFT_OUTPUT_VOLUME, WM8993_RIGHT_OUTPUT_VOLUME, |
367 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | | 367 | 0, 63, 0, snd_soc_get_volsw_2r, wm8993_put_dc_servo, |
368 | SNDRV_CTL_ELEM_ACCESS_READWRITE, | 368 | outpga_tlv), |
369 | .tlv.p = outpga_tlv, | 369 | |
370 | .info = snd_soc_info_volsw_2r, | ||
371 | .get = snd_soc_get_volsw_2r, .put = wm8993_put_dc_servo, | ||
372 | .private_value = (unsigned long)&(struct soc_mixer_control) { | ||
373 | .reg = WM8993_LEFT_OUTPUT_VOLUME, | ||
374 | .rreg = WM8993_RIGHT_OUTPUT_VOLUME, | ||
375 | .shift = 0, .max = 63 | ||
376 | }, | ||
377 | }, | ||
378 | SOC_DOUBLE_R("Headphone Switch", WM8993_LEFT_OUTPUT_VOLUME, | 370 | SOC_DOUBLE_R("Headphone Switch", WM8993_LEFT_OUTPUT_VOLUME, |
379 | WM8993_RIGHT_OUTPUT_VOLUME, 6, 1, 0), | 371 | WM8993_RIGHT_OUTPUT_VOLUME, 6, 1, 0), |
380 | SOC_DOUBLE_R("Headphone ZC Switch", WM8993_LEFT_OUTPUT_VOLUME, | 372 | SOC_DOUBLE_R("Headphone ZC Switch", WM8993_LEFT_OUTPUT_VOLUME, |