summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-11-30 16:00:02 +0200
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-11-30 15:39:39 +0000
commit8cc14e13d15ec558c880ce6eaaddf99c08f85ab6 (patch)
tree6141ca1c3d80d82d4e2cd4129aa48b179055b0bc
parentd534bacd918fcf0909039b95db7c090702e739d5 (diff)
downloadblackbird-op-linux-8cc14e13d15ec558c880ce6eaaddf99c08f85ab6.tar.gz
blackbird-op-linux-8cc14e13d15ec558c880ce6eaaddf99c08f85ab6.zip
ASoC: tpa6130a2: Use one event handler for PGA_E
Reduce the amount of duplicated code by using single event handler for PGA_E to enable the needed channel. Use the w->shift to pass the channel information to the handler function. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--sound/soc/codecs/tpa6130a2.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 42887ae1568b..4c77a82d9780 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -317,29 +317,15 @@ static void tpa6130a2_channel_enable(u8 channel, int enable)
}
}
-static int tpa6130a2_left_event(struct snd_soc_dapm_widget *w,
+static int tpa6130a2_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- tpa6130a2_channel_enable(TPA6130A2_HP_EN_L, 1);
+ tpa6130a2_channel_enable(w->shift, 1);
break;
case SND_SOC_DAPM_POST_PMD:
- tpa6130a2_channel_enable(TPA6130A2_HP_EN_L, 0);
- break;
- }
- return 0;
-}
-
-static int tpa6130a2_right_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- tpa6130a2_channel_enable(TPA6130A2_HP_EN_R, 1);
- break;
- case SND_SOC_DAPM_POST_PMD:
- tpa6130a2_channel_enable(TPA6130A2_HP_EN_R, 0);
+ tpa6130a2_channel_enable(w->shift, 0);
break;
}
return 0;
@@ -363,10 +349,10 @@ static int tpa6130a2_supply_event(struct snd_soc_dapm_widget *w,
static const struct snd_soc_dapm_widget tpa6130a2_dapm_widgets[] = {
SND_SOC_DAPM_PGA_E("TPA6130A2 Left", SND_SOC_NOPM,
- 0, 0, NULL, 0, tpa6130a2_left_event,
+ TPA6130A2_HP_EN_L, 0, NULL, 0, tpa6130a2_pga_event,
SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_PGA_E("TPA6130A2 Right", SND_SOC_NOPM,
- 0, 0, NULL, 0, tpa6130a2_right_event,
+ TPA6130A2_HP_EN_R, 0, NULL, 0, tpa6130a2_pga_event,
SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY("TPA6130A2 Enable", SND_SOC_NOPM,
0, 0, tpa6130a2_supply_event,
OpenPOWER on IntegriCloud