diff options
author | ScottPeterson <speterson@nvidia.com> | 2011-04-04 15:57:11 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-04-07 16:58:09 -0700 |
commit | e9b228e7aa05a98624510213a5a89e642ed272f4 (patch) | |
tree | fb00aae8b2d72ec5db5bf5489893955cba4e1184 /sound | |
parent | 6fa92df36af66330bb1939b1ec8016df6e9b51b3 (diff) |
ARM: tegra: audio: Enable external speaker amp
Enable the external speaker amp on Ventana.
Requires that the avdd_amp regulator be enabled.
Bug 809015
Change-Id: I0ec741655ed9629f8ad45adc43f5dfcba7369c60
Reviewed-on: http://git-master/r/26653
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Ching Kuang (Roger) Hsieh <rhsieh@nvidia.com>
Tested-by: Ching Kuang (Roger) Hsieh <rhsieh@nvidia.com>
Reviewed-by: Boris Suvorov <bsuvorov@nvidia.com>
Tested-by: Boris Suvorov <bsuvorov@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_soc.h | 4 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_soc_controls.c | 18 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_wired_jack.c | 16 |
3 files changed, 33 insertions, 5 deletions
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h index 3b88271d976f..817aed035d89 100644 --- a/sound/soc/tegra/tegra_soc.h +++ b/sound/soc/tegra/tegra_soc.h @@ -34,6 +34,7 @@ #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/tegra_audio.h> +#include <linux/regulator/consumer.h> #include <mach/iomap.h> #include <mach/tegra2_i2s.h> #include <mach/spdif.h> @@ -107,6 +108,9 @@ struct wired_jack_conf { int en_mic_ext; int cdc_irq; int en_spkr; + const char *spkr_amp_reg; + struct regulator *amp_reg; + int amp_reg_enabled; }; int tegra_controls_init(struct snd_soc_codec *codec); diff --git a/sound/soc/tegra/tegra_soc_controls.c b/sound/soc/tegra/tegra_soc_controls.c index 0370a9c261f6..04ffd880ed0e 100644 --- a/sound/soc/tegra/tegra_soc_controls.c +++ b/sound/soc/tegra/tegra_soc_controls.c @@ -20,6 +20,7 @@ #include <linux/gpio.h> #include <sound/soc-dapm.h> +#include <linux/regulator/consumer.h> #include <mach/audio.h> #include "tegra_soc.h" @@ -85,8 +86,18 @@ static void tegra_ext_control(struct snd_soc_codec *codec) if (tegra_spk_func == TEGRA_INT_SPK_ON) { snd_soc_dapm_enable_pin(codec, "Int Spk"); + if (tegra_wired_jack_conf.amp_reg && + !tegra_wired_jack_conf.amp_reg_enabled) { + regulator_enable(tegra_wired_jack_conf.amp_reg); + tegra_wired_jack_conf.amp_reg_enabled = 1; + } } else { - snd_soc_dapm_disable_pin(codec, "Int Spk"); + snd_soc_dapm_disable_pin(codec, "Int Spk"); + if (tegra_wired_jack_conf.amp_reg && + tegra_wired_jack_conf.amp_reg_enabled) { + regulator_disable(tegra_wired_jack_conf.amp_reg); + tegra_wired_jack_conf.amp_reg_enabled = 0; + } } /* signal a DAPM event */ @@ -270,12 +281,15 @@ static void tegra_audio_route(int device_new, int is_call_mode_new) if (play_device_new != audio_data->play_device) { if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_HEADPHONE) { tegra_jack_func = TEGRA_HP; + tegra_spk_func = TEGRA_INT_SPK_OFF; } else if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_HEADSET) { tegra_jack_func = TEGRA_HEADSET; + tegra_spk_func = TEGRA_INT_SPK_OFF; } else if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_LINE) { tegra_jack_func = TEGRA_LINE; + tegra_spk_func = TEGRA_INT_SPK_OFF; } if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_SPEAKER) { @@ -537,7 +551,7 @@ int tegra_controls_init(struct snd_soc_codec *codec) /* Default to HP output */ tegra_jack_func = TEGRA_HP; tegra_lineout_func = TEGRA_LINEOUT_ON; - tegra_spk_func = TEGRA_INT_SPK_ON; + tegra_spk_func = TEGRA_INT_SPK_OFF; tegra_ext_control(codec); snd_soc_dapm_sync(codec); diff --git a/sound/soc/tegra/tegra_wired_jack.c b/sound/soc/tegra/tegra_wired_jack.c index bc5396eaba39..a3c5fa7afc08 100644 --- a/sound/soc/tegra/tegra_wired_jack.c +++ b/sound/soc/tegra/tegra_wired_jack.c @@ -32,9 +32,10 @@ #define HEAD_DET_GPIO 0 #define MIC_DET_GPIO 1 +#define SPK_EN_GPIO 3 struct wired_jack_conf tegra_wired_jack_conf = { - -1, -1, -1, -1 + -1, -1, -1, -1, 0, NULL, NULL }; /* jack */ @@ -79,7 +80,6 @@ static struct switch_dev wired_switch_dev = { void tegra_switch_set_state(int state) { - switch_set_state(&wired_switch_dev, state); } @@ -204,6 +204,11 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) gpio_direction_output(en_spkr, 0); gpio_export(en_spkr, false); + if (pdata->spkr_amp_reg) + tegra_wired_jack_conf.amp_reg = + regulator_get(NULL, pdata->spkr_amp_reg); + tegra_wired_jack_conf.amp_reg_enabled = 0; + /* restore configuration of these pins */ tegra_wired_jack_conf.hp_det_n = hp_det_n; tegra_wired_jack_conf.en_mic_int = en_mic_int; @@ -215,7 +220,6 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) snd_soc_jack_notifier_register(tegra_wired_jack, &wired_switch_nb); #endif - return ret; } @@ -229,6 +233,12 @@ static int tegra_wired_jack_remove(struct platform_device *pdev) gpio_free(tegra_wired_jack_conf.en_mic_ext); gpio_free(tegra_wired_jack_conf.en_spkr); + if (tegra_wired_jack_conf.amp_reg) { + if (tegra_wired_jack_conf.amp_reg_enabled) + regulator_disable(tegra_wired_jack_conf.amp_reg); + regulator_put(tegra_wired_jack_conf.amp_reg); + } + return 0; } |