aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTinghan Shen <[email protected]>2022-04-22 13:56:59 +0800
committerMark Brown <[email protected]>2022-04-25 14:04:46 +0100
commit0e0b83cc7ec7fc5e6695aa6ebbb0961e26096105 (patch)
tree329612adc67854b3e301b5eea03ad340be42f6b3
parent210b3ab932f7a08d8b912c497ca0ca86f712814f (diff)
ASoC: SOF: mediatek: Add DSP system PM callback for mt8186
Add DSP system PM callback for suspend and resume Signed-off-by: Allen-KH Cheng <[email protected]> Signed-off-by: Tinghan Shen <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Yaochun Hung <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--sound/soc/sof/mediatek/mt8186/mt8186.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c
index a04cea77bd4d..c8faa63497c6 100644
--- a/sound/soc/sof/mediatek/mt8186/mt8186.c
+++ b/sound/soc/sof/mediatek/mt8186/mt8186.c
@@ -304,6 +304,30 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev)
return 0;
}
+static int mt8186_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
+{
+ sof_hifixdsp_shutdown(sdev);
+ adsp_sram_power_off(sdev);
+ adsp_clock_off(sdev);
+
+ return 0;
+}
+
+static int mt8186_dsp_resume(struct snd_sof_dev *sdev)
+{
+ int ret;
+
+ ret = adsp_clock_on(sdev);
+ if (ret) {
+ dev_err(sdev->dev, "adsp_clock_on fail!\n");
+ return ret;
+ }
+
+ adsp_sram_power_on(sdev);
+
+ return ret;
+}
+
/* on mt8186 there is 1 to 1 match between type and BAR idx */
static int mt8186_get_bar_index(struct snd_sof_dev *sdev, u32 type)
{
@@ -338,6 +362,10 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
/* Firmware ops */
.dsp_arch_ops = &sof_xtensa_arch_ops,
+ /* PM */
+ .suspend = mt8186_dsp_suspend,
+ .resume = mt8186_dsp_resume,
+
/* ALSA HW info flags */
.hw_info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |