From ca46962353780dc81b355eb53733a9eb1975b6bf Mon Sep 17 00:00:00 2001 From: Nikesh Oswal Date: Fri, 18 Nov 2011 15:00:09 +0530 Subject: asoc: tegra: max98088 machine: add power management functionality add code for handling register save/restore and clocks disable/enable during suspend/resume Bug: 862023 Change-Id: I7502fb4cd0db8be250e3fd9047d98e6ad5cafec1 Signed-off-by: Nikesh Oswal Reviewed-on: http://git-master/r/65479 Reviewed-by: Sumit Bhattacharya Reviewed-by: Scott Peterson Rebase-Id: Rf83ed876bd330000b8778f832b0fddcfef954bb2 --- sound/soc/tegra/tegra_max98088.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_max98088.c b/sound/soc/tegra/tegra_max98088.c index 5787d3b1d833..e4cc69d1a86a 100644 --- a/sound/soc/tegra/tegra_max98088.c +++ b/sound/soc/tegra/tegra_max98088.c @@ -91,6 +91,7 @@ struct tegra_max98088 { #ifndef CONFIG_ARCH_TEGRA_2x_SOC struct codec_config codec_info[NUM_I2S_DEVICES]; #endif + enum snd_soc_bias_level bias_level; }; static int tegra_call_mode_info(struct snd_kcontrol *kcontrol, @@ -936,10 +937,48 @@ static struct snd_soc_dai_link tegra_max98088_dai[NUM_DAI_LINKS] = { }, }; +#ifdef CONFIG_PM +int tegra30_soc_resume_pre(struct snd_soc_card *card) +{ + return tegra30_ahub_apbif_resume(); +} +#endif + + +static int tegra30_soc_set_bias_level(struct snd_soc_card *card, + enum snd_soc_bias_level level) +{ + struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card); + + if (machine->bias_level == SND_SOC_BIAS_OFF && + level != SND_SOC_BIAS_OFF) + tegra_asoc_utils_clk_enable(&machine->util_data); + + machine->bias_level = level; + + return 0; +} + +static int tegra30_soc_set_bias_level_post(struct snd_soc_card *card, + enum snd_soc_bias_level level) +{ + struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card); + + if (level == SND_SOC_BIAS_OFF) + tegra_asoc_utils_clk_disable(&machine->util_data); + + return 0 ; +} + static struct snd_soc_card snd_soc_tegra_max98088 = { .name = "tegra-max98088", .dai_link = tegra_max98088_dai, .num_links = ARRAY_SIZE(tegra_max98088_dai), +#ifdef CONFIG_PM + .resume_pre = tegra30_soc_resume_pre, +#endif + .set_bias_level = tegra30_soc_set_bias_level, + .set_bias_level_post = tegra30_soc_set_bias_level_post, }; static __devinit int tegra_max98088_driver_probe(struct platform_device *pdev) -- cgit v1.2.3