diff options
author | Manjula Gupta <magupta@nvidia.com> | 2010-12-28 14:20:39 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2011-01-03 05:57:56 -0800 |
commit | 3d4d46642395ff620b87cf16cb1cffc8dc6e7d8e (patch) | |
tree | 66919debd83647345982e2fafbdffc2e93945518 /sound | |
parent | f5a068ae381c56699fa8fa3002d10d907a5f510c (diff) |
[tegra ALSA] Save/Restore I2S Registers on suspend/resume.
Added support to save and restore I2S registers on
suspend/resume.
For Bug: 774397
Change-Id: I2a0caf93f422811573ec2acd193de3804f8860a0
Reviewed-on: http://git-master/r/14454
Tested-by: Manjula Gupta <magupta@nvidia.com>
Reviewed-by: Vijay Mali <vmali@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_i2s.c | 59 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_soc.h | 2 |
2 files changed, 43 insertions, 18 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 69e07b0c5181..1596c4f7be5e 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -20,6 +20,7 @@ #include "tegra_soc.h" static void *das_base = IO_ADDRESS(TEGRA_APB_MISC_BASE); +struct snd_soc_dai tegra_i2s_dai; static inline unsigned long das_readl(unsigned long offset) { @@ -72,7 +73,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, } i2s_set_channel_bit_count(I2S_IFC, val, clk_get_rate(prtd->i2s_clk)); - + tegra_i2s_dai.private_data = (void *)prtd; return 0; err: @@ -199,6 +200,26 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return ret; } +#ifdef CONFIG_PM +int tegra_i2s_suspend(struct snd_soc_dai *i2s_dai) +{ + struct tegra_runtime_data *prtd = (struct snd_pcm_runtime *)(tegra_i2s_dai.private_data); + i2s_get_all_regs(I2S_IFC, &prtd->i2s_regs); + return 0; +} + +int tegra_i2s_resume(struct snd_soc_dai *i2s_dai) +{ + struct tegra_runtime_data *prtd = (struct snd_pcm_runtime *)(tegra_i2s_dai.private_data); + i2s_set_all_regs(I2S_IFC, &prtd->i2s_regs); + return 0; +} + +#else +#define tegra_i2s_suspend NULL +#define tegra_i2s_resume NULL +#endif + static int tegra_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -227,6 +248,23 @@ static int tegra_i2s_probe(struct platform_device *pdev, return 0; } +static int tegra_i2s_driver_probe(struct platform_device *dev) +{ + int ret; + + tegra_i2s_dai.dev = &dev->dev; + tegra_i2s_dai.private_data = NULL; + ret = snd_soc_register_dai(&tegra_i2s_dai); + return ret; +} + + +static int __devexit tegra_i2s_driver_remove(struct platform_device *dev) +{ + snd_soc_unregister_dai(&tegra_i2s_dai); + return 0; +} + static struct snd_soc_dai_ops tegra_i2s_dai_ops = { .startup = tegra_i2s_startup, .shutdown = tegra_i2s_shutdown, @@ -240,6 +278,8 @@ struct snd_soc_dai tegra_i2s_dai = { .name = "tegra-i2s", .id = 0, .probe = tegra_i2s_probe, + .suspend = tegra_i2s_suspend, + .resume = tegra_i2s_resume, .playback = { .channels_min = 2, .channels_max = 2, @@ -256,23 +296,6 @@ struct snd_soc_dai tegra_i2s_dai = { }; EXPORT_SYMBOL_GPL(tegra_i2s_dai); -static int tegra_i2s_driver_probe(struct platform_device *dev) -{ - int ret; - - tegra_i2s_dai.dev = &dev->dev; - tegra_i2s_dai.private_data = NULL; - ret = snd_soc_register_dai(&tegra_i2s_dai); - return ret; -} - - -static int __devexit tegra_i2s_driver_remove(struct platform_device *dev) -{ - snd_soc_unregister_dai(&tegra_i2s_dai); - return 0; -} - static struct platform_driver tegra_i2s_driver = { .probe = tegra_i2s_driver_probe, .remove = __devexit_p(tegra_i2s_driver_remove), diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h index 5cb2a2ccf851..e570bcb39172 100644 --- a/sound/soc/tegra/tegra_soc.h +++ b/sound/soc/tegra/tegra_soc.h @@ -91,10 +91,12 @@ struct tegra_runtime_data { struct tegra_dma_req dma_req1, dma_req2; volatile int state; int period_index; + int i2s_shutdown; struct tegra_dma_channel *dma_chan; struct clk *i2s_clk; struct clk *dap_mclk; struct clk *audio_sync_clk; + struct i2s_runtime_data i2s_regs; }; #endif |