diff options
author | Nitin Garg <nitin.garg@freescale.com> | 2012-01-17 22:37:31 -0600 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2012-01-17 22:37:31 -0600 |
commit | 76bde7c7c6a1a8cf3a6a752f92bb0b7d58766096 (patch) | |
tree | ef6e5250415d1c3c6efd3c48357d4ca52df39546 | |
parent | 710f4a465595a85cf8243996a3569dc9d9f5bf11 (diff) |
ENGR00172279: Add amp control to support speaker output.
Add AMP control to sgtl5000 to support speaker output.
Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
-rw-r--r-- | sound/soc/imx/imx-sgtl5000.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sound/soc/imx/imx-sgtl5000.c b/sound/soc/imx/imx-sgtl5000.c index 9325dc8e346c..6666d74dee88 100644 --- a/sound/soc/imx/imx-sgtl5000.c +++ b/sound/soc/imx/imx-sgtl5000.c @@ -3,7 +3,7 @@ * sgtl5000 codec * * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> - * Copyright (C) 2011 Freescale Semiconductor, Inc. + * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -195,11 +195,29 @@ static int sgtl5000_set_line_in(struct snd_kcontrol *kcontrol, return 1; } +static int spk_amp_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct imx_sgtl5000_priv *priv = &card_priv; + struct platform_device *pdev = priv->pdev; + struct mxc_audio_platform_data *plat = pdev->dev.platform_data; + + if (plat->amp_enable == NULL) + return 0; + + if (SND_SOC_DAPM_EVENT_ON(event)) + plat->amp_enable(1); + else + plat->amp_enable(0); + + return 0; +} + /* imx_3stack card dapm widgets */ static const struct snd_soc_dapm_widget imx_3stack_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_LINE("Line In Jack", NULL), - SND_SOC_DAPM_SPK("Ext Spk", NULL), + SND_SOC_DAPM_SPK("Ext Spk", spk_amp_event), SND_SOC_DAPM_HP("Headphone Jack", NULL), }; |