diff options
author | Mark Brown <broonie@linaro.org> | 2014-03-12 19:03:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-12 19:03:59 -0400 |
commit | b8f861586c9c2433b22f81e933845cb8aaa18d9e (patch) | |
tree | b075dd0c9156ce45da4ab3099b222cae1163d3bc /include/sound | |
parent | 53a2c4db8cf229047de88b3f1bd41d5a5d2756eb (diff) | |
parent | 6af5263ceaffc9d4403592dc81cd3b197702dc69 (diff) |
Merge remote-tracking branch 'asoc/topic/enum' into asoc-next
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/soc-dapm.h | 38 | ||||
-rw-r--r-- | include/sound/soc.h | 86 |
2 files changed, 67 insertions, 57 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 05aaaf689ac0..ef78f562f4a8 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -108,13 +108,9 @@ struct device; | |||
108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
110 | #define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 110 | #define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
111 | { .id = snd_soc_dapm_virt_mux, .name = wname, \ | 111 | SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) |
112 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | ||
113 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | ||
114 | #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 112 | #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
115 | { .id = snd_soc_dapm_value_mux, .name = wname, \ | 113 | SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) |
116 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | ||
117 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | ||
118 | 114 | ||
119 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | 115 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ |
120 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | 116 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ |
@@ -172,10 +168,8 @@ struct device; | |||
172 | .event = wevent, .event_flags = wflags} | 168 | .event = wevent, .event_flags = wflags} |
173 | #define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ | 169 | #define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ |
174 | wevent, wflags) \ | 170 | wevent, wflags) \ |
175 | { .id = snd_soc_dapm_virt_mux, .name = wname, \ | 171 | SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \ |
176 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 172 | wflags) |
177 | .kcontrol_news = wcontrols, .num_kcontrols = 1, \ | ||
178 | .event = wevent, .event_flags = wflags} | ||
179 | 173 | ||
180 | /* additional sequencing control within an event type */ | 174 | /* additional sequencing control within an event type */ |
181 | #define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ | 175 | #define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ |
@@ -311,12 +305,8 @@ struct device; | |||
311 | .get = snd_soc_dapm_get_enum_double, \ | 305 | .get = snd_soc_dapm_get_enum_double, \ |
312 | .put = snd_soc_dapm_put_enum_double, \ | 306 | .put = snd_soc_dapm_put_enum_double, \ |
313 | .private_value = (unsigned long)&xenum } | 307 | .private_value = (unsigned long)&xenum } |
314 | #define SOC_DAPM_ENUM_VIRT(xname, xenum) \ | 308 | #define SOC_DAPM_ENUM_VIRT(xname, xenum) \ |
315 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 309 | SOC_DAPM_ENUM(xname, xenum) |
316 | .info = snd_soc_info_enum_double, \ | ||
317 | .get = snd_soc_dapm_get_enum_virt, \ | ||
318 | .put = snd_soc_dapm_put_enum_virt, \ | ||
319 | .private_value = (unsigned long)&xenum } | ||
320 | #define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ | 310 | #define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ |
321 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 311 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
322 | .info = snd_soc_info_enum_double, \ | 312 | .info = snd_soc_info_enum_double, \ |
@@ -324,11 +314,7 @@ struct device; | |||
324 | .put = xput, \ | 314 | .put = xput, \ |
325 | .private_value = (unsigned long)&xenum } | 315 | .private_value = (unsigned long)&xenum } |
326 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ | 316 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ |
327 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 317 | SOC_DAPM_ENUM(xname, xenum) |
328 | .info = snd_soc_info_enum_double, \ | ||
329 | .get = snd_soc_dapm_get_value_enum_double, \ | ||
330 | .put = snd_soc_dapm_put_value_enum_double, \ | ||
331 | .private_value = (unsigned long)&xenum } | ||
332 | #define SOC_DAPM_PIN_SWITCH(xname) \ | 318 | #define SOC_DAPM_PIN_SWITCH(xname) \ |
333 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ | 319 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ |
334 | .info = snd_soc_dapm_info_pin_switch, \ | 320 | .info = snd_soc_dapm_info_pin_switch, \ |
@@ -392,14 +378,6 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
392 | struct snd_ctl_elem_value *ucontrol); | 378 | struct snd_ctl_elem_value *ucontrol); |
393 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | 379 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, |
394 | struct snd_ctl_elem_value *ucontrol); | 380 | struct snd_ctl_elem_value *ucontrol); |
395 | int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol, | ||
396 | struct snd_ctl_elem_value *ucontrol); | ||
397 | int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | ||
398 | struct snd_ctl_elem_value *ucontrol); | ||
399 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
400 | struct snd_ctl_elem_value *ucontrol); | ||
401 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
402 | struct snd_ctl_elem_value *ucontrol); | ||
403 | int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, | 381 | int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, |
404 | struct snd_ctl_elem_info *uinfo); | 382 | struct snd_ctl_elem_info *uinfo); |
405 | int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, | 383 | int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, |
@@ -484,8 +462,6 @@ enum snd_soc_dapm_type { | |||
484 | snd_soc_dapm_input = 0, /* input pin */ | 462 | snd_soc_dapm_input = 0, /* input pin */ |
485 | snd_soc_dapm_output, /* output pin */ | 463 | snd_soc_dapm_output, /* output pin */ |
486 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 464 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
487 | snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */ | ||
488 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ | ||
489 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 465 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
490 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | 466 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ |
491 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 467 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 075d7e8ba802..81b55e498f67 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -45,6 +45,11 @@ | |||
45 | ((unsigned long)&(struct soc_mixer_control) \ | 45 | ((unsigned long)&(struct soc_mixer_control) \ |
46 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ | 46 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ |
47 | .max = xmax, .platform_max = xmax, .invert = xinvert}) | 47 | .max = xmax, .platform_max = xmax, .invert = xinvert}) |
48 | #define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \ | ||
49 | ((unsigned long)&(struct soc_mixer_control) \ | ||
50 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ | ||
51 | .max = xmax, .min = xmin, .platform_max = xmax, .sign_bit = xsign_bit, \ | ||
52 | .invert = xinvert}) | ||
48 | #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ | 53 | #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ |
49 | ((unsigned long)&(struct soc_mixer_control) \ | 54 | ((unsigned long)&(struct soc_mixer_control) \ |
50 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ | 55 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ |
@@ -152,6 +157,15 @@ | |||
152 | {.reg = xreg, .rreg = xrreg, \ | 157 | {.reg = xreg, .rreg = xrreg, \ |
153 | .shift = xshift, .rshift = xshift, \ | 158 | .shift = xshift, .rshift = xshift, \ |
154 | .max = xmax, .min = xmin} } | 159 | .max = xmax, .min = xmin} } |
160 | #define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \ | ||
161 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
162 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
163 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
164 | .tlv.p = (tlv_array), \ | ||
165 | .info = snd_soc_info_volsw, \ | ||
166 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ | ||
167 | .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \ | ||
168 | xmin, xmax, xsign_bit, xinvert) } | ||
155 | #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ | 169 | #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ |
156 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 170 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
157 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 171 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
@@ -162,30 +176,28 @@ | |||
162 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 176 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
163 | {.reg = xreg, .min = xmin, .max = xmax, \ | 177 | {.reg = xreg, .min = xmin, .max = xmax, \ |
164 | .platform_max = xmax} } | 178 | .platform_max = xmax} } |
165 | #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ | 179 | #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \ |
166 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ | 180 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ |
167 | .max = xmax, .texts = xtexts, \ | 181 | .items = xitems, .texts = xtexts, \ |
168 | .mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0} | 182 | .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0} |
169 | #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ | 183 | #define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \ |
170 | SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) | 184 | SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts) |
171 | #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ | 185 | #define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \ |
172 | { .max = xmax, .texts = xtexts } | 186 | { .items = xitems, .texts = xtexts } |
173 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \ | 187 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ |
174 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ | 188 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ |
175 | .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues} | 189 | .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} |
176 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \ | 190 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ |
177 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues) | 191 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) |
192 | #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ | ||
193 | SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) | ||
178 | #define SOC_ENUM(xname, xenum) \ | 194 | #define SOC_ENUM(xname, xenum) \ |
179 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ | 195 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ |
180 | .info = snd_soc_info_enum_double, \ | 196 | .info = snd_soc_info_enum_double, \ |
181 | .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ | 197 | .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ |
182 | .private_value = (unsigned long)&xenum } | 198 | .private_value = (unsigned long)&xenum } |
183 | #define SOC_VALUE_ENUM(xname, xenum) \ | 199 | #define SOC_VALUE_ENUM(xname, xenum) \ |
184 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ | 200 | SOC_ENUM(xname, xenum) |
185 | .info = snd_soc_info_enum_double, \ | ||
186 | .get = snd_soc_get_value_enum_double, \ | ||
187 | .put = snd_soc_put_value_enum_double, \ | ||
188 | .private_value = (unsigned long)&xenum } | ||
189 | #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ | 201 | #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ |
190 | xhandler_get, xhandler_put) \ | 202 | xhandler_get, xhandler_put) \ |
191 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 203 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
@@ -272,17 +284,19 @@ | |||
272 | * ARRAY_SIZE internally | 284 | * ARRAY_SIZE internally |
273 | */ | 285 | */ |
274 | #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ | 286 | #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ |
275 | struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ | 287 | const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ |
276 | ARRAY_SIZE(xtexts), xtexts) | 288 | ARRAY_SIZE(xtexts), xtexts) |
277 | #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ | 289 | #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ |
278 | SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) | 290 | SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) |
279 | #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ | 291 | #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ |
280 | struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) | 292 | const struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) |
281 | #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ | 293 | #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ |
282 | struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ | 294 | const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ |
283 | ARRAY_SIZE(xtexts), xtexts, xvalues) | 295 | ARRAY_SIZE(xtexts), xtexts, xvalues) |
284 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | 296 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ |
285 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) | 297 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) |
298 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ | ||
299 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) | ||
286 | 300 | ||
287 | /* | 301 | /* |
288 | * Component probe and remove ordering levels for components with runtime | 302 | * Component probe and remove ordering levels for components with runtime |
@@ -500,10 +514,6 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, | |||
500 | struct snd_ctl_elem_value *ucontrol); | 514 | struct snd_ctl_elem_value *ucontrol); |
501 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | 515 | int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, |
502 | struct snd_ctl_elem_value *ucontrol); | 516 | struct snd_ctl_elem_value *ucontrol); |
503 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
504 | struct snd_ctl_elem_value *ucontrol); | ||
505 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
506 | struct snd_ctl_elem_value *ucontrol); | ||
507 | int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, | 517 | int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, |
508 | struct snd_ctl_elem_info *uinfo); | 518 | struct snd_ctl_elem_info *uinfo); |
509 | #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info | 519 | #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info |
@@ -1076,6 +1086,7 @@ struct soc_mixer_control { | |||
1076 | int min, max, platform_max; | 1086 | int min, max, platform_max; |
1077 | int reg, rreg; | 1087 | int reg, rreg; |
1078 | unsigned int shift, rshift; | 1088 | unsigned int shift, rshift; |
1089 | unsigned int sign_bit; | ||
1079 | unsigned int invert:1; | 1090 | unsigned int invert:1; |
1080 | unsigned int autodisable:1; | 1091 | unsigned int autodisable:1; |
1081 | }; | 1092 | }; |
@@ -1094,11 +1105,10 @@ struct soc_mreg_control { | |||
1094 | 1105 | ||
1095 | /* enumerated kcontrol */ | 1106 | /* enumerated kcontrol */ |
1096 | struct soc_enum { | 1107 | struct soc_enum { |
1097 | unsigned short reg; | 1108 | int reg; |
1098 | unsigned short reg2; | ||
1099 | unsigned char shift_l; | 1109 | unsigned char shift_l; |
1100 | unsigned char shift_r; | 1110 | unsigned char shift_r; |
1101 | unsigned int max; | 1111 | unsigned int items; |
1102 | unsigned int mask; | 1112 | unsigned int mask; |
1103 | const char * const *texts; | 1113 | const char * const *texts; |
1104 | const unsigned int *values; | 1114 | const unsigned int *values; |
@@ -1177,6 +1187,30 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) | |||
1177 | return 1; | 1187 | return 1; |
1178 | } | 1188 | } |
1179 | 1189 | ||
1190 | static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e, | ||
1191 | unsigned int val) | ||
1192 | { | ||
1193 | unsigned int i; | ||
1194 | |||
1195 | if (!e->values) | ||
1196 | return val; | ||
1197 | |||
1198 | for (i = 0; i < e->items; i++) | ||
1199 | if (val == e->values[i]) | ||
1200 | return i; | ||
1201 | |||
1202 | return 0; | ||
1203 | } | ||
1204 | |||
1205 | static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e, | ||
1206 | unsigned int item) | ||
1207 | { | ||
1208 | if (!e->values) | ||
1209 | return item; | ||
1210 | |||
1211 | return e->values[item]; | ||
1212 | } | ||
1213 | |||
1180 | static inline bool snd_soc_component_is_active( | 1214 | static inline bool snd_soc_component_is_active( |
1181 | struct snd_soc_component *component) | 1215 | struct snd_soc_component *component) |
1182 | { | 1216 | { |