aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 51848880504a..2c279cd8deb5 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -298,25 +298,23 @@ static const struct soc_enum twl4030_handsfreer_enum =
298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =
299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); 299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
300 300
301static int outmixer_event(struct snd_soc_dapm_widget *w, 301/*
302 * This function filters out the non valid mux settings, named as "Invalid"
303 * in the enum texts.
304 * Just refuse to set an invalid mux mode.
305 */
306static int twl4030_enum_event(struct snd_soc_dapm_widget *w,
302 struct snd_kcontrol *kcontrol, int event) 307 struct snd_kcontrol *kcontrol, int event)
303{ 308{
304 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 309 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
305 int ret = 0; 310 int ret = 0;
306 int val; 311 int val;
307 312
308 switch (e->reg) { 313 val = w->value >> e->shift_l;
309 case TWL4030_REG_PREDL_CTL: 314 if (!strcmp("Invalid", e->texts[val])) {
310 case TWL4030_REG_PREDR_CTL: 315 printk(KERN_WARNING "Invalid MUX setting on 0x%02x (%d)\n",
311 case TWL4030_REG_EAR_CTL: 316 e->reg, val);
312 val = w->value >> e->shift_l; 317 ret = -1;
313 if (val == 3) {
314 printk(KERN_WARNING
315 "Invalid MUX setting for register 0x%02x (%d)\n",
316 e->reg, val);
317 ret = -1;
318 }
319 break;
320 } 318 }
321 319
322 return ret; 320 return ret;
@@ -810,14 +808,14 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
810 /* Output MUX controls */ 808 /* Output MUX controls */
811 /* Earpiece */ 809 /* Earpiece */
812 SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, 810 SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0,
813 &twl4030_dapm_earpiece_control, outmixer_event, 811 &twl4030_dapm_earpiece_control, twl4030_enum_event,
814 SND_SOC_DAPM_PRE_REG), 812 SND_SOC_DAPM_PRE_REG),
815 /* PreDrivL/R */ 813 /* PreDrivL/R */
816 SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, 814 SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0,
817 &twl4030_dapm_predrivel_control, outmixer_event, 815 &twl4030_dapm_predrivel_control, twl4030_enum_event,
818 SND_SOC_DAPM_PRE_REG), 816 SND_SOC_DAPM_PRE_REG),
819 SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, 817 SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0,
820 &twl4030_dapm_predriver_control, outmixer_event, 818 &twl4030_dapm_predriver_control, twl4030_enum_event,
821 SND_SOC_DAPM_PRE_REG), 819 SND_SOC_DAPM_PRE_REG),
822 /* HeadsetL/R */ 820 /* HeadsetL/R */
823 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, 821 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0,