aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl6040.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-10-05 03:29:19 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-05 12:10:08 -0400
commit0f9887d11e7c59ebae5e464f30a6dde788ed9011 (patch)
treea207635ae6f45a576f1ace0489b2c69043baa5ea /sound/soc/codecs/twl6040.c
parent7508b12a8eb713436feb65893ae7ada57bf165ce (diff)
ASoC: Consolidate use of controls with custom get/put function
Use the macros for controls require custom get/put function. This is to make sure that the soc_mixer_control is used consistently among the drivers. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Arun KS <arunks@mistralsolutions.com> Cc: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/twl6040.c')
-rw-r--r--sound/soc/codecs/twl6040.c37
1 files changed, 6 insertions, 31 deletions
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