From 8197f585be3bf75420c30cecec25316bdacf1fd4 Mon Sep 17 00:00:00 2001 From: Vijay Mali Date: Thu, 21 Mar 2013 20:39:05 +0530 Subject: asoc: tegra: aic326x: Use avdd_audio regulator - Enable avdd_audio regulator during playback on Headphone and Speaker. - This prevent leakage current in codec. - Improve codec power numbers. Bug 1238662 Change-Id: Ie9fa31b6291c06ad4f83138c4e595fb4da29a7f9 Signed-off-by: Vijay Mali Reviewed-on: http://git-master/r/211670 Reviewed-by: Ravindra Lokhande GVS: Gerrit_Virtual_Submit Reviewed-by: Niranjan Wartikar Reviewed-by: Bharat Nihalani --- sound/soc/tegra/tegra_aic326x.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_aic326x.c b/sound/soc/tegra/tegra_aic326x.c index 9f3119fa9d2b..dbcab64de140 100644 --- a/sound/soc/tegra/tegra_aic326x.c +++ b/sound/soc/tegra/tegra_aic326x.c @@ -1108,6 +1108,8 @@ static int tegra_aic326x_event_int_spk(struct snd_soc_dapm_widget *w, /* set speaker amplifier voulme to 18 dB, E-1 state */ snd_soc_write(codec, AIC3262_SPK_AMP_CNTL_R4, 0x33); } + if (machine->audio_reg) + regulator_enable(machine->audio_reg); } else { ret = edp_update_client_request( machine->spk_edp_client, @@ -1116,6 +1118,8 @@ static int tegra_aic326x_event_int_spk(struct snd_soc_dapm_widget *w, dev_err(card->dev, "E+1 state transition failed\n"); } + if (machine->audio_reg) + regulator_disable(machine->audio_reg); } err_null_spk_edp_client: if (!(machine->gpio_requested & GPIO_SPKR_EN)) @@ -1135,6 +1139,13 @@ static int tegra_aic326x_event_hp(struct snd_soc_dapm_widget *w, struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card); struct tegra_asoc_platform_data *pdata = machine->pdata; + if (machine->audio_reg) { + if (SND_SOC_DAPM_EVENT_ON(event)) + regulator_enable(machine->audio_reg); + else + regulator_disable(machine->audio_reg); + } + if (!(machine->gpio_requested & GPIO_HP_MUTE)) return 0; @@ -1547,6 +1558,12 @@ static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev) machine->hmic_reg = 0; } + machine->audio_reg = regulator_get(NULL, "avdd_audio"); + if (IS_ERR(machine->audio_reg)) { + dev_info(&pdev->dev, "No avdd_audio regulator found\n"); + machine->audio_reg = 0; + } + card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); -- cgit v1.2.3