aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2009-01-05 02:54:57 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-05 12:47:17 -0500
commit2e72f8e3716bc3bbf4c9b5b987fb5ab3223f60bf (patch)
treef568500ae1737e5c11376ad9b65d706c9da18874 /include/sound/soc.h
parent796123368871e4a838dc0dfd5dbc3cd8981ef429 (diff)
ASoC: New enum type: value_enum
This patch introduces a new enum type. In this enum type each enumerated items referred with a value. This new enum type can handle enums encoded in bitfield, or any other weird ways. twl4030 codec has several mux selection register, where the input/output mux is coded in a bitfield. With the normal enum type this type of mux can not be handled in a clean way. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f86e455d3828..9b930d342116 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -94,11 +94,22 @@
94 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 94 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
95#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 95#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
96{ .max = xmax, .texts = xtexts } 96{ .max = xmax, .texts = xtexts }
97#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
98{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
99 .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
100#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
101 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
97#define SOC_ENUM(xname, xenum) \ 102#define SOC_ENUM(xname, xenum) \
98{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 103{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
99 .info = snd_soc_info_enum_double, \ 104 .info = snd_soc_info_enum_double, \
100 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 105 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
101 .private_value = (unsigned long)&xenum } 106 .private_value = (unsigned long)&xenum }
107#define SOC_VALUE_ENUM(xname, xenum) \
108{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
109 .info = snd_soc_info_value_enum_double, \
110 .get = snd_soc_get_value_enum_double, \
111 .put = snd_soc_put_value_enum_double, \
112 .private_value = (unsigned long)&xenum }
102#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ 113#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
103 xhandler_get, xhandler_put) \ 114 xhandler_get, xhandler_put) \
104{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 115{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -200,6 +211,12 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
200 struct snd_ctl_elem_value *ucontrol); 211 struct snd_ctl_elem_value *ucontrol);
201int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, 212int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
202 struct snd_ctl_elem_value *ucontrol); 213 struct snd_ctl_elem_value *ucontrol);
214int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol,
215 struct snd_ctl_elem_info *uinfo);
216int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
217 struct snd_ctl_elem_value *ucontrol);
218int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
219 struct snd_ctl_elem_value *ucontrol);
203int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, 220int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
204 struct snd_ctl_elem_info *uinfo); 221 struct snd_ctl_elem_info *uinfo);
205int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, 222int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
@@ -406,6 +423,19 @@ struct soc_enum {
406 void *dapm; 423 void *dapm;
407}; 424};
408 425
426/* semi enumerated kcontrol */
427struct soc_value_enum {
428 unsigned short reg;
429 unsigned short reg2;
430 unsigned char shift_l;
431 unsigned char shift_r;
432 unsigned int max;
433 unsigned int mask;
434 const char **texts;
435 const unsigned int *values;
436 void *dapm;
437};
438
409#include <sound/soc-dai.h> 439#include <sound/soc-dai.h>
410 440
411#endif 441#endif