diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-02-28 02:31:04 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-28 22:03:34 -0500 |
commit | 3727b4968453dbab8fe18f979d67285eb6b66801 (patch) | |
tree | 65ea329261a29bd380b29fd24167a80375779a05 /include/sound/soc-dapm.h | |
parent | 29ae2fa5533e607a7d97b7564dc015252f1e73f4 (diff) |
ASoC: dapm: Consolidate MUXs and value MUXs
MUXs and value MUXs are almost identical, the only difference is that a value
MUX uses a look-up table to map from the selected control item to a register
value, while MUXs use a direct mapping. This patch uses
snd_soc_enum_item_to_val() and snd_soc_enum_val_to_item(), which where earlier
introduced during the consolidation of enum and value enum controls, to hide
this difference. This allows us to use the same code path for both MUXs and
value MUXs and a lot of nearly duplicated code can be removed.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound/soc-dapm.h')
-rw-r--r-- | include/sound/soc-dapm.h | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 3b991766a8f2..2ec14cb3ff1e 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -112,9 +112,7 @@ struct device; | |||
112 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 112 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
113 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 113 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
114 | #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 114 | #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
115 | { .id = snd_soc_dapm_value_mux, .name = wname, \ | 115 | 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 | 116 | ||
119 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | 117 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ |
120 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | 118 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ |
@@ -324,11 +322,7 @@ struct device; | |||
324 | .put = xput, \ | 322 | .put = xput, \ |
325 | .private_value = (unsigned long)&xenum } | 323 | .private_value = (unsigned long)&xenum } |
326 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ | 324 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ |
327 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 325 | 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) \ | 326 | #define SOC_DAPM_PIN_SWITCH(xname) \ |
333 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ | 327 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ |
334 | .info = snd_soc_dapm_info_pin_switch, \ | 328 | .info = snd_soc_dapm_info_pin_switch, \ |
@@ -396,10 +390,6 @@ int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol, | |||
396 | struct snd_ctl_elem_value *ucontrol); | 390 | struct snd_ctl_elem_value *ucontrol); |
397 | int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | 391 | int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, |
398 | struct snd_ctl_elem_value *ucontrol); | 392 | 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, | 393 | int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, |
404 | struct snd_ctl_elem_info *uinfo); | 394 | struct snd_ctl_elem_info *uinfo); |
405 | int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, | 395 | int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, |
@@ -486,7 +476,6 @@ enum snd_soc_dapm_type { | |||
486 | snd_soc_dapm_output, /* output pin */ | 476 | snd_soc_dapm_output, /* output pin */ |
487 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 477 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
488 | snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */ | 478 | snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */ |
489 | snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ | ||
490 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 479 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
491 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | 480 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ |
492 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 481 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |