summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorChandrakanth Gorantla <cgorantla@nvidia.com>2011-07-26 15:35:58 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-07-29 17:23:50 -0700
commit37b499d25e09c6b3e3b56b4a2115a929d884b804 (patch)
treebc158876005cbc0c610c5fc157567d61e71c4e06 /sound
parent060b9ad49846795fede382b6e55a3a80f28d670d (diff)
ASOC: tegra: Power off max98088 codec in idle
When device doesnt play audio power off codec and disable extern1 clock to save power. Bug 853161 Change-Id: I4392dc56e5f597566075f99a034e697bf56176ab Reviewed-on: http://git-master/r/43980 Reviewed-by: Scott Peterson <speterson@nvidia.com> Tested-by: Chandrakanth Gorantla <cgorantla@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_soc.h1
-rw-r--r--sound/soc/tegra/tegra_soc_max98088.c36
2 files changed, 30 insertions, 7 deletions
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h
index d48ea1e69d01..566a82d7274b 100644
--- a/sound/soc/tegra/tegra_soc.h
+++ b/sound/soc/tegra/tegra_soc.h
@@ -114,6 +114,7 @@ struct tegra_audio_data {
struct snd_soc_codec *codec;
struct clk *dap_mclk;
bool init_done;
+ enum snd_soc_bias_level bias_level;
int play_device;
int capture_device;
diff --git a/sound/soc/tegra/tegra_soc_max98088.c b/sound/soc/tegra/tegra_soc_max98088.c
index c6d3a758cee3..82e0c88cd239 100644
--- a/sound/soc/tegra/tegra_soc_max98088.c
+++ b/sound/soc/tegra/tegra_soc_max98088.c
@@ -209,6 +209,7 @@ static int tegra_spdif_hw_params(struct snd_pcm_substream *substream,
int tegra_codec_startup(struct snd_pcm_substream *substream)
{
+ tegra_das_enable_mclk();
tegra_das_power_mode(true);
return 0;
@@ -217,10 +218,12 @@ int tegra_codec_startup(struct snd_pcm_substream *substream)
void tegra_codec_shutdown(struct snd_pcm_substream *substream)
{
tegra_das_power_mode(false);
+ tegra_das_disable_mclk();
}
int tegra_soc_suspend_pre(struct platform_device *pdev, pm_message_t state)
{
+ tegra_das_enable_mclk();
return 0;
}
@@ -240,9 +243,31 @@ int tegra_soc_resume_pre(struct platform_device *pdev)
int tegra_soc_resume_post(struct platform_device *pdev)
{
+ tegra_das_disable_mclk();
+ return 0;
+}
+
+static int tegra_soc_set_bias_level(struct snd_soc_card *card,
+ enum snd_soc_bias_level level)
+{
+ struct tegra_audio_data* audio_data = card->socdev->codec_data;
+
+ if (audio_data->bias_level == SND_SOC_BIAS_OFF) {
+ tegra_das_enable_mclk();
+ }
+ audio_data->bias_level = level;
return 0;
}
+static int tegra_soc_set_bias_level_post(struct snd_soc_card *card,
+ enum snd_soc_bias_level level)
+{
+ if (level == SND_SOC_BIAS_OFF) {
+ tegra_das_disable_mclk();
+ }
+ return 0 ;
+}
+
static struct snd_soc_ops tegra_hifi_ops = {
.hw_params = tegra_hifi_hw_params,
.startup = tegra_codec_startup,
@@ -405,13 +430,7 @@ static int tegra_codec_init(struct snd_soc_codec *codec)
goto max98088_init_fail;
}
- err = tegra_das_enable_mclk();
- if (err) {
- pr_err(" Failed to enable dap mclk\n");
- err = -ENODEV;
- goto max98088_init_fail;
- }
-
+ codec->idle_bias_off = 1;
/* Add tegra specific widgets */
snd_soc_dapm_new_controls(codec, tegra_dapm_widgets,
ARRAY_SIZE(tegra_dapm_widgets));
@@ -517,6 +536,7 @@ static struct snd_soc_dai_link tegra_soc_dai[] = {
static struct tegra_audio_data audio_data = {
.init_done = 0,
+ .bias_level = SND_SOC_BIAS_OFF,
.play_device = TEGRA_AUDIO_DEVICE_NONE,
.capture_device = TEGRA_AUDIO_DEVICE_NONE,
.is_call_mode = false,
@@ -532,6 +552,8 @@ static struct snd_soc_card tegra_snd_soc = {
.suspend_post = tegra_soc_suspend_post,
.resume_pre = tegra_soc_resume_pre,
.resume_post = tegra_soc_resume_post,
+ .set_bias_level = tegra_soc_set_bias_level,
+ .set_bias_level_post = tegra_soc_set_bias_level_post,
};
static struct snd_soc_device tegra_snd_devdata = {