diff options
author | Nikesh Oswal <noswal@nvidia.com> | 2011-11-18 15:00:09 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:50:23 -0800 |
commit | ca46962353780dc81b355eb53733a9eb1975b6bf (patch) | |
tree | 624c308d608d2433aad5142cb3e63b3b0b377b6e | |
parent | ab8abd6275cfe826002956d13a72d290ae344474 (diff) |
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 <noswal@nvidia.com>
Reviewed-on: http://git-master/r/65479
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Rebase-Id: Rf83ed876bd330000b8778f832b0fddcfef954bb2
-rw-r--r-- | sound/soc/tegra/tegra_max98088.c | 39 |
1 files changed, 39 insertions, 0 deletions
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) |