summaryrefslogtreecommitdiffstats
path: root/sound/soc/amd
diff options
context:
space:
mode:
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>2018-11-12 00:35:01 -0500
committerMark Brown <broonie@kernel.org>2018-11-13 14:44:11 -0500
commit8de1b5ed03370e46bf9f5b425e3f260dac3bc336 (patch)
tree0fce3441bd666637bef26d5522ef9c084ce5f656 /sound/soc/amd
parent56e4dd8f68019f50a885be9122981f1899cd89ed (diff)
ASoC: amd: add acp3x system resume pm op
When system wide suspend happens, ACP will be powered off. When system resumes, all the runtime configuration data for ACP needs to be programmed again. Added 'resume'pm call back to ACP pm ops. Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com> Tested-by: Ravulapati Vishnu vardhan Rao <Vishnuvardhanrao.Ravulapati@amd.com> Signed-off-by: Vijendar Mukunda <vijendar.mukunda@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/amd')
-rw-r--r--sound/soc/amd/raven/acp3x-pcm-dma.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 710c5c5ae625..2e61cef00f41 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -690,6 +690,51 @@ static int acp3x_audio_remove(struct platform_device *pdev)
690 return 0; 690 return 0;
691} 691}
692 692
693static int acp3x_resume(struct device *dev)
694{
695 int status;
696 u32 val;
697 struct i2s_dev_data *adata = dev_get_drvdata(dev);
698
699 status = acp3x_init(adata->acp3x_base);
700 if (status)
701 return -ENODEV;
702
703 if (adata->play_stream && adata->play_stream->runtime) {
704 struct i2s_stream_instance *rtd =
705 adata->play_stream->runtime->private_data;
706 config_acp3x_dma(rtd, SNDRV_PCM_STREAM_PLAYBACK);
707 rv_writel((rtd->xfer_resolution << 3),
708 rtd->acp3x_base + mmACP_BTTDM_ITER);
709 if (adata->tdm_mode == true) {
710 rv_writel(adata->tdm_fmt, adata->acp3x_base +
711 mmACP_BTTDM_TXFRMT);
712 val = rv_readl(adata->acp3x_base + mmACP_BTTDM_ITER);
713 rv_writel((val | 0x2), adata->acp3x_base +
714 mmACP_BTTDM_ITER);
715 }
716 }
717
718 if (adata->capture_stream && adata->capture_stream->runtime) {
719 struct i2s_stream_instance *rtd =
720 adata->capture_stream->runtime->private_data;
721 config_acp3x_dma(rtd, SNDRV_PCM_STREAM_CAPTURE);
722 rv_writel((rtd->xfer_resolution << 3),
723 rtd->acp3x_base + mmACP_BTTDM_IRER);
724 if (adata->tdm_mode == true) {
725 rv_writel(adata->tdm_fmt, adata->acp3x_base +
726 mmACP_BTTDM_RXFRMT);
727 val = rv_readl(adata->acp3x_base + mmACP_BTTDM_IRER);
728 rv_writel((val | 0x2), adata->acp3x_base +
729 mmACP_BTTDM_IRER);
730 }
731 }
732
733 rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
734 return 0;
735}
736
737
693static int acp3x_pcm_runtime_suspend(struct device *dev) 738static int acp3x_pcm_runtime_suspend(struct device *dev)
694{ 739{
695 int status; 740 int status;
@@ -721,6 +766,7 @@ static int acp3x_pcm_runtime_resume(struct device *dev)
721static const struct dev_pm_ops acp3x_pm_ops = { 766static const struct dev_pm_ops acp3x_pm_ops = {
722 .runtime_suspend = acp3x_pcm_runtime_suspend, 767 .runtime_suspend = acp3x_pcm_runtime_suspend,
723 .runtime_resume = acp3x_pcm_runtime_resume, 768 .runtime_resume = acp3x_pcm_runtime_resume,
769 .resume = acp3x_resume,
724}; 770};
725 771
726static struct platform_driver acp3x_dma_driver = { 772static struct platform_driver acp3x_dma_driver = {