aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorBrian Austin <brian.austin@cirrus.com>2012-03-30 11:43:55 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-03 06:43:23 -0400
commit1d99f2436d0d1c7741d6dfd9d27b5376cdbbca40 (patch)
treef3fc73ca59b2d3876b429de52c66e4c2e6294a78 /include/sound
parent152ad442315517e6275efe6c142c06cb8aced6dd (diff)
ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV
Some codecs namely Cirrus Logic Codecs have a way of wrapping the dB scale around 0dB without 0dB being in the middle. Rework of SOC_DOUBLE_R_SX_TLV to be more consistent with other asoc tlv macros. Add single register macro : SOC_SINGLE_SX_TLV. Use snd_soc_info_volsw for .info Use snd_soc_get_volsw_sx, snd_soc_put_volsw_sx for single and double. kcontrols for CS42L51 and CS42L73 are adjusted to these new TLV Macros. The max value is determined by: (number of steps) +1 for 0dB +max from codec datasheet. Signed-off-by: Brian Austin <brian.austin@cirrus.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h48
1 files changed, 28 insertions, 20 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9e238fa2eb17..acb57b834e58 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -55,6 +55,18 @@
55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
56 .put = snd_soc_put_volsw, \ 56 .put = snd_soc_put_volsw, \
57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
58#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
61 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
62 .tlv.p = (tlv_array),\
63 .info = snd_soc_info_volsw, \
64 .get = snd_soc_get_volsw_sx,\
65 .put = snd_soc_put_volsw_sx, \
66 .private_value = (unsigned long)&(struct soc_mixer_control) \
67 {.reg = xreg, .rreg = xreg, \
68 .shift = xshift, .rshift = xshift, \
69 .max = xmax, .min = xmin} }
58#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 70#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 71{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 72 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
@@ -85,6 +97,18 @@
85 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 97 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
86 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 98 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
87 xmax, xinvert) } 99 xmax, xinvert) }
100#define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
101{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
102 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
103 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
104 .tlv.p = (tlv_array), \
105 .info = snd_soc_info_volsw, \
106 .get = snd_soc_get_volsw_sx, \
107 .put = snd_soc_put_volsw_sx, \
108 .private_value = (unsigned long)&(struct soc_mixer_control) \
109 {.reg = xreg, .rreg = xrreg, \
110 .shift = xshift, .rshift = xshift, \
111 .max = xmax, .min = xmin} }
88#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 112#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
89{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
90 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 114 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -171,20 +195,6 @@
171 .get = xhandler_get, .put = xhandler_put, \ 195 .get = xhandler_get, .put = xhandler_put, \
172 .private_value = (unsigned long)&xenum } 196 .private_value = (unsigned long)&xenum }
173 197
174#define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
175 xmin, xmax, tlv_array) \
176{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
177 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
178 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
179 .tlv.p = (tlv_array), \
180 .info = snd_soc_info_volsw_2r_sx, \
181 .get = snd_soc_get_volsw_2r_sx, \
182 .put = snd_soc_put_volsw_2r_sx, \
183 .private_value = (unsigned long)&(struct soc_mixer_control) \
184 {.reg = xreg_left, \
185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} }
187
188#define SND_SOC_BYTES(xname, xbase, xregs) \ 198#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 199{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ 200 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
@@ -418,6 +428,10 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
418 struct snd_ctl_elem_value *ucontrol); 428 struct snd_ctl_elem_value *ucontrol);
419#define snd_soc_get_volsw_2r snd_soc_get_volsw 429#define snd_soc_get_volsw_2r snd_soc_get_volsw
420#define snd_soc_put_volsw_2r snd_soc_put_volsw 430#define snd_soc_put_volsw_2r snd_soc_put_volsw
431int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
432 struct snd_ctl_elem_value *ucontrol);
433int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol);
421int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, 435int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
422 struct snd_ctl_elem_info *uinfo); 436 struct snd_ctl_elem_info *uinfo);
423int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, 437int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
@@ -426,12 +440,6 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
426 struct snd_ctl_elem_value *ucontrol); 440 struct snd_ctl_elem_value *ucontrol);
427int snd_soc_limit_volume(struct snd_soc_codec *codec, 441int snd_soc_limit_volume(struct snd_soc_codec *codec,
428 const char *name, int max); 442 const char *name, int max);
429int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
430 struct snd_ctl_elem_info *uinfo);
431int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
432 struct snd_ctl_elem_value *ucontrol);
433int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol);
435int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, 443int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_info *uinfo); 444 struct snd_ctl_elem_info *uinfo);
437int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, 445int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,