From 0172fb19ebf3e5fb667b37e64bf3473ccdd1bc35 Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Mon, 14 May 2012 18:43:23 +0530 Subject: asoc: tegra: MAX98088 machine: Add support for setting bias level Allow setting bias level to turn off clock extern1 when codec is idle for enterprise board. (Maxim 98088 codec) Bug 984678 Change-Id: Ib01be71362ab0c5525f570693b41db73777875e6 Signed-off-by: Ankit Gupta Reviewed-on: http://git-master/r/102240 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Manoj Gangwal Reviewed-by: Scott Peterson --- sound/soc/tegra/tegra_max98088.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra_max98088.c b/sound/soc/tegra/tegra_max98088.c index 63a067338dc4..8c0e3935ad02 100644 --- a/sound/soc/tegra/tegra_max98088.c +++ b/sound/soc/tegra/tegra_max98088.c @@ -96,6 +96,7 @@ struct tegra_max98088 { #endif enum snd_soc_bias_level bias_level; struct snd_soc_card *pcard; + volatile int clock_enabled; }; static int tegra_call_mode_info(struct snd_kcontrol *kcontrol, @@ -926,6 +927,7 @@ static int tegra_max98088_init(struct snd_soc_pcm_runtime *rtd) machine->pcard = card; machine->bias_level = SND_SOC_BIAS_STANDBY; + machine->clock_enabled = 1; if (gpio_is_valid(pdata->gpio_spkr_en)) { ret = gpio_request(pdata->gpio_spkr_en, "spkr_en"); @@ -1070,8 +1072,11 @@ static int tegra30_soc_set_bias_level(struct snd_soc_card *card, struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card); if (machine->bias_level == SND_SOC_BIAS_OFF && - level != SND_SOC_BIAS_OFF) + level != SND_SOC_BIAS_OFF && (!machine->clock_enabled)) { + machine->clock_enabled = 1; tegra_asoc_utils_clk_enable(&machine->util_data); + machine->bias_level = level; + } return 0; } @@ -1082,8 +1087,10 @@ static int tegra30_soc_set_bias_level_post(struct snd_soc_card *card, struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card); if (machine->bias_level != SND_SOC_BIAS_OFF && - level == SND_SOC_BIAS_OFF) + level == SND_SOC_BIAS_OFF && (machine->clock_enabled)) { + machine->clock_enabled = 0; tegra_asoc_utils_clk_disable(&machine->util_data); + } machine->bias_level = level; @@ -1156,6 +1163,7 @@ static __devinit int tegra_max98088_driver_probe(struct platform_device *pdev) tegra_max98088_i2s_dai_name[machine->codec_info[BT_SCO].i2s_id]; #endif + card->dapm.idle_bias_off = 1; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", -- cgit v1.2.3