summaryrefslogtreecommitdiff
path: root/sound/soc/tegra/tegra30_i2s.c
diff options
context:
space:
mode:
authorNikesh Oswal <noswal@nvidia.com>2011-11-18 14:59:12 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:50:23 -0800
commitab8abd6275cfe826002956d13a72d290ae344474 (patch)
treedee88307d894907f8894e97d2db1786003230f18 /sound/soc/tegra/tegra30_i2s.c
parent9f655d719048c0eda67e041f365325f07ac0eef5 (diff)
asoc: tegra: add power management functionality in t30 drivers
add code for handling register save/restore and clocks disable/enable during suspend/resume Bug: 862023 Change-Id: I1b709b6bf674c9a2d93c2a21c1f44bbadff64aab Signed-off-by: Nikesh Oswal <noswal@nvidia.com> Reviewed-on: http://git-master/r/65478 Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com> Rebase-Id: R2383486dac0892e317dbd25044df59284031b6c4
Diffstat (limited to 'sound/soc/tegra/tegra30_i2s.c')
-rw-r--r--sound/soc/tegra/tegra30_i2s.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 78e3ee042b5c..9b2a6be24d1d 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -52,6 +52,9 @@ static struct tegra30_i2s i2scont[TEGRA30_NR_I2S_IFC];
static inline void tegra30_i2s_write(struct tegra30_i2s *i2s, u32 reg, u32 val)
{
+#ifdef CONFIG_PM
+ i2s->reg_cache[reg >> 2] = val;
+#endif
__raw_writel(val, i2s->regs + reg);
}
@@ -451,6 +454,29 @@ static int tegra30_i2s_probe(struct snd_soc_dai *dai)
return 0;
}
+#ifdef CONFIG_PM
+int tegra30_i2s_resume(struct snd_soc_dai *cpu_dai)
+{
+ struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
+ int i, ret = 0;
+
+ tegra30_i2s_enable_clocks(i2s);
+
+ /*restore the i2s regs*/
+ for (i = 0; i < ((TEGRA30_I2S_CIF_TX_CTRL>>2) + 1); i++)
+ tegra30_i2s_write(i2s, i<<2, i2s->reg_cache[i]);
+
+ tegra30_i2s_disable_clocks(i2s);
+
+ if (i2s->dam_ch_refcount)
+ ret = tegra30_dam_resume(i2s->dam_ifc);
+
+ return ret;
+}
+#else
+#define tegra30_i2s_resume NULL
+#endif
+
static struct snd_soc_dai_ops tegra30_i2s_dai_ops = {
.startup = tegra30_i2s_startup,
.shutdown = tegra30_i2s_shutdown,
@@ -463,6 +489,7 @@ static struct snd_soc_dai_ops tegra30_i2s_dai_ops = {
{ \
.name = DRV_NAME "." #id, \
.probe = tegra30_i2s_probe, \
+ .resume = tegra30_i2s_resume, \
.playback = { \
.channels_min = 1, \
.channels_max = 2, \