aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/twl6040.c39
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);