Skip to content

Commit 8adf19e

Browse files
tinghan-shenplbossart
authored andcommitted
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 <allen-kh.cheng@mediatek.com> Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
1 parent b5ff606 commit 8adf19e

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

sound/soc/sof/mediatek/mt8186/mt8186.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,30 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev)
304304
return 0;
305305
}
306306

307+
static int mt8186_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
308+
{
309+
sof_hifixdsp_shutdown(sdev);
310+
adsp_sram_power_off(sdev);
311+
adsp_clock_off(sdev);
312+
313+
return 0;
314+
}
315+
316+
static int mt8186_dsp_resume(struct snd_sof_dev *sdev)
317+
{
318+
int ret;
319+
320+
ret = adsp_clock_on(sdev);
321+
if (ret) {
322+
dev_err(sdev->dev, "adsp_clock_on fail!\n");
323+
return ret;
324+
}
325+
326+
adsp_sram_power_on(sdev);
327+
328+
return ret;
329+
}
330+
307331
/* on mt8186 there is 1 to 1 match between type and BAR idx */
308332
static int mt8186_get_bar_index(struct snd_sof_dev *sdev, u32 type)
309333
{
@@ -338,6 +362,10 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
338362
/* Firmware ops */
339363
.dsp_arch_ops = &sof_xtensa_arch_ops,
340364

365+
/* PM */
366+
.suspend = mt8186_dsp_suspend,
367+
.resume = mt8186_dsp_resume,
368+
341369
/* ALSA HW info flags */
342370
.hw_info = SNDRV_PCM_INFO_MMAP |
343371
SNDRV_PCM_INFO_MMAP_VALID |

0 commit comments

Comments
 (0)