diff options
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/soc-dapm.h | 15 | ||||
-rw-r--r-- | include/sound/soc.h | 30 |
2 files changed, 45 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 7ee2f70ca42e..4af1083e3287 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -85,6 +85,10 @@ | |||
85 | #define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 85 | #define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
86 | { .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ | 86 | { .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ |
87 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} | 87 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} |
88 | #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ | ||
89 | { .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \ | ||
90 | .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | ||
91 | .num_kcontrols = 1} | ||
88 | 92 | ||
89 | /* path domain with event - event handler must return 0 for success */ | 93 | /* path domain with event - event handler must return 0 for success */ |
90 | #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ | 94 | #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ |
@@ -172,6 +176,12 @@ | |||
172 | .get = snd_soc_dapm_get_enum_double, \ | 176 | .get = snd_soc_dapm_get_enum_double, \ |
173 | .put = snd_soc_dapm_put_enum_double, \ | 177 | .put = snd_soc_dapm_put_enum_double, \ |
174 | .private_value = (unsigned long)&xenum } | 178 | .private_value = (unsigned long)&xenum } |
179 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ | ||
180 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
181 | .info = snd_soc_info_value_enum_double, \ | ||
182 | .get = snd_soc_dapm_get_value_enum_double, \ | ||
183 | .put = snd_soc_dapm_put_value_enum_double, \ | ||
184 | .private_value = (unsigned long)&xenum } | ||
175 | 185 | ||
176 | /* dapm stream operations */ | 186 | /* dapm stream operations */ |
177 | #define SND_SOC_DAPM_STREAM_NOP 0x0 | 187 | #define SND_SOC_DAPM_STREAM_NOP 0x0 |
@@ -214,6 +224,10 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
214 | struct snd_ctl_elem_value *ucontrol); | 224 | struct snd_ctl_elem_value *ucontrol); |
215 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | 225 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, |
216 | struct snd_ctl_elem_value *ucontrol); | 226 | struct snd_ctl_elem_value *ucontrol); |
227 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
228 | struct snd_ctl_elem_value *ucontrol); | ||
229 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
230 | struct snd_ctl_elem_value *ucontrol); | ||
217 | int snd_soc_dapm_new_control(struct snd_soc_codec *codec, | 231 | int snd_soc_dapm_new_control(struct snd_soc_codec *codec, |
218 | const struct snd_soc_dapm_widget *widget); | 232 | const struct snd_soc_dapm_widget *widget); |
219 | int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, | 233 | int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, |
@@ -247,6 +261,7 @@ enum snd_soc_dapm_type { | |||
247 | snd_soc_dapm_input = 0, /* input pin */ | 261 | snd_soc_dapm_input = 0, /* input pin */ |
248 | snd_soc_dapm_output, /* output pin */ | 262 | snd_soc_dapm_output, /* output pin */ |
249 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 263 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
264 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ | ||
250 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 265 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
251 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 266 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
252 | snd_soc_dapm_adc, /* analog to digital converter */ | 267 | snd_soc_dapm_adc, /* analog to digital converter */ |
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); |
201 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | 212 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, |
202 | struct snd_ctl_elem_value *ucontrol); | 213 | struct snd_ctl_elem_value *ucontrol); |
214 | int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol, | ||
215 | struct snd_ctl_elem_info *uinfo); | ||
216 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
217 | struct snd_ctl_elem_value *ucontrol); | ||
218 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
219 | struct snd_ctl_elem_value *ucontrol); | ||
203 | int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, | 220 | int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, |
204 | struct snd_ctl_elem_info *uinfo); | 221 | struct snd_ctl_elem_info *uinfo); |
205 | int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, | 222 | int 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 */ | ||
427 | struct 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 |