[RFC PATCH 5/5] ASoC: SOF: Intel: add support for SoundWire suspend/resume

From: Pierre-Louis Bossart
Date: Wed Aug 21 2019 - 16:18:24 EST


Somehow the core0 needs to be on to set-up the interrupts and power-up
the SoundWire IP.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
---
sound/soc/sof/intel/hda-dsp.c | 11 +++++++++++
sound/soc/sof/intel/hda.c | 2 +-
sound/soc/sof/intel/hda.h | 5 +++++
3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index fb55a3c5afd0..e1ade59ac6e1 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -374,6 +374,17 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)
hda_dsp_ctrl_ppcap_enable(sdev, true);
hda_dsp_ctrl_ppcap_int_enable(sdev, true);

+#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL)
+ /* need to power-up core before setting-up capabilities */
+ ret = hda_dsp_core_power_up(sdev, HDA_DSP_CORE_MASK(0));
+ if (ret < 0) {
+ dev_err(sdev->dev, "error: could not power-up DSP subsystem\n");
+ return ret;
+ }
+
+ hda_sdw_int_enable(sdev, true);
+#endif
+
return 0;
}

diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 1e84ea9e6fce..09aa0cfa6099 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -39,7 +39,7 @@

#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL)

-static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable)
+void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable)
{
if (enable)
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 48e09b7daf0a..de71c92b2f39 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -591,6 +591,11 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *stream_tag);
int hda_dsp_trace_release(struct snd_sof_dev *sdev);
int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);

+/*
+ * SoundWire support
+ */
+void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable);
+
/* common dai driver */
extern struct snd_soc_dai_driver skl_dai[];

--
2.20.1