From ddcccd543f5dbd841fe305452651b0f8c1d74f0f Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Tue, 26 May 2020 15:36:33 -0500 Subject: [PATCH] ASoC: SOF: Intel: byt: Add PM callbacks Add the PM callbacks for BYT/CHT platforms. Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart Tested-by: Enric Balletbo i Serra Link: https://lore.kernel.org/r/20200526203640.25980-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/intel/byt.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 3747f2c2c28b..457da8fcc6a0 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -428,6 +428,34 @@ static void byt_set_mach_params(const struct snd_soc_acpi_mach *mach, mach_params->platform = dev_name(dev); } +static void byt_reset_dsp_disable_int(struct snd_sof_dev *sdev) +{ + /* Disable Interrupt from both sides */ + snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x3); + snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x3); + + /* Put DSP into reset, set reset vector */ + snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_CSR, + SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL, + SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL); +} + +static int byt_suspend(struct snd_sof_dev *sdev, u32 target_state) +{ + byt_reset_dsp_disable_int(sdev); + + return 0; +} + +static int byt_resume(struct snd_sof_dev *sdev) +{ + /* Enable Interrupt from both sides */ + snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x0); + snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x0); + + return 0; +} + /* Baytrail DAIs */ static struct snd_soc_dai_driver byt_dai[] = { { @@ -832,6 +860,10 @@ const struct snd_sof_dsp_ops sof_byt_ops = { /*Firmware loading */ .load_firmware = snd_sof_load_firmware_memcpy, + /* PM */ + .suspend = byt_suspend, + .resume = byt_resume, + /* DAI drivers */ .drv = byt_dai, .num_drv = 3, /* we have only 3 SSPs on byt*/ @@ -906,6 +938,10 @@ const struct snd_sof_dsp_ops sof_cht_ops = { /*Firmware loading */ .load_firmware = snd_sof_load_firmware_memcpy, + /* PM */ + .suspend = byt_suspend, + .resume = byt_resume, + /* DAI drivers */ .drv = byt_dai, /* all 6 SSPs may be available for cherrytrail */ -- 2.11.0