Skip to content

Commit

Permalink
ASoC: TWL4030: Add DAPM event handler for output MUX selection
Browse files Browse the repository at this point in the history
DAPM event handler is set to filter out invalid MUX settings
for certain outputs.
Earpiece:
 - 0 = Off
 - 1 = DACL1
 - 2 = DACL2
 - 3 = *** Invalid ***
 - 4 = DACR1

PreDriveL/R:
 - 0 = Off/Off
 - 1 = DACL1/DACR1
 - 2 = DACL2/DACR2
 - 3 = *** Invalid/Invalid ***
 - 4 = DACR2/DACL2

Signed-off-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Peter Ujfalusi authored and broonie committed Dec 9, 2008
1 parent 44c5587 commit e8ff9c4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,30 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)

}

static int outmixer_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
int ret = 0;
int val;

switch (e->reg) {
case TWL4030_REG_PREDL_CTL:
case TWL4030_REG_PREDR_CTL:
case TWL4030_REG_EAR_CTL:
val = w->value >> e->shift_l;
if (val == 3) {
printk(KERN_WARNING
"Invalid MUX setting for register 0x%02x (%d)\n",
e->reg, val);
ret = -1;
}
break;
}

return ret;
}

/*
* Some of the gain controls in TWL (mostly those which are associated with
* the outputs) are implemented in an interesting way:
Expand Down

0 comments on commit e8ff9c4

Please sign in to comment.