diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2012-04-02 03:04:45 -0500 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-12-05 22:36:03 +0100 |
commit | f28a2c944fd5a5999322a126e35e750d1eb0efa1 (patch) | |
tree | 237c7d4c3598677f9a69b4dbb5b3baa697e20e5c /sound | |
parent | 5142401251ad070e56bd217c4ad1a1bef62440d9 (diff) | |
download | kernel_samsung_tuna-f28a2c944fd5a5999322a126e35e750d1eb0efa1.zip kernel_samsung_tuna-f28a2c944fd5a5999322a126e35e750d1eb0efa1.tar.gz kernel_samsung_tuna-f28a2c944fd5a5999322a126e35e750d1eb0efa1.tar.bz2 |
ASoC: twl6040: VDDHF as SUPPLY widget
VDDHF external boost supply was being enabled after and disabled before
handsfree driver as a strategy for pop noise reduction. This strategy
makes handsfree driver very susceptible to overcurrent events, so the
boost supply is converted to a SUPPLY widget to enable it before and
disable it after handsfree path.
Change-Id: I608b4b0f5cb3301053869ccd2732434efe276b81
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/twl6040.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 8e355f2..fbccca5 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -903,6 +903,35 @@ static int twl6040_ep_mode_event(struct snd_soc_dapm_widget *w, return ret; } +static int twl6040_hf_boost_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_codec *codec = w->codec; + struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + int ret; + + if (!priv->vddhf_reg) + return 0; + + if (SND_SOC_DAPM_EVENT_ON(event)) { + ret = regulator_enable(priv->vddhf_reg); + if (ret) { + dev_err(codec->dev, "failed to enable " + "VDDHF regulator %d\n", ret); + return ret; + } + } else { + ret = regulator_disable(priv->vddhf_reg); + if (ret) { + dev_err(codec->dev, "failed to disable " + "VDDHF regulator %d\n", ret); + return ret; + } + } + + return ret; +} + static void twl6040_hs_jack_report(struct snd_soc_codec *codec, struct snd_soc_jack *jack, int report) { @@ -1377,6 +1406,12 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { TWL6040_REG_HSRCTL, 2, 0, NULL, 0, pga_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), + SND_SOC_DAPM_SUPPLY("Handsfree Left Boost Supply", SND_SOC_NOPM, 0, 0, + twl6040_hf_boost_event, + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_SUPPLY("Handsfree Right Boost Supply", SND_SOC_NOPM, 0, 0, + twl6040_hf_boost_event, + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SWITCH("Earphone Playback", SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls), SND_SOC_DAPM_SUPPLY("Earphone Power Mode", SND_SOC_NOPM, 0, 0, @@ -1447,6 +1482,9 @@ static const struct snd_soc_dapm_route intercon[] = { {"Handsfree Left Driver", "Switch", "HFDAC Left PGA"}, {"Handsfree Right Driver", "Switch", "HFDAC Right PGA"}, + {"Handsfree Left Driver", NULL, "Handsfree Left Boost Supply"}, + {"Handsfree Right Driver", NULL, "Handsfree Right Boost Supply"}, + {"HFL", NULL, "Handsfree Left Driver"}, {"HFR", NULL, "Handsfree Right Driver"}, @@ -1874,6 +1912,7 @@ irq_err: wake_lock_destroy(&priv->wake_lock); destroy_workqueue(priv->ep_workqueue); epwork_err: +reg_err: if (priv->vddhf_reg) regulator_put(priv->vddhf_reg); destroy_workqueue(priv->hs_workqueue); |