diff mbox series

[3/5] ASoC: SOF: ipc4: Wake up dsp core before sending ipc msg

Message ID 20230214103345.30669-4-peter.ujfalusi@linux.intel.com
State New
Headers show
Series ASoC: SOF: Intel/ipc4: Support for low power playback (d0i3) | expand

Commit Message

Peter Ujfalusi Feb. 14, 2023, 10:33 a.m. UTC
From: Rander Wang <rander.wang@intel.com>

The driver shall update the power state to D0i0 before sending
a generic IPC. Power-related IPCs are the exception to the rule,
they may be sent even when the power-state is D0i3

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/ipc4.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c
index b27ec16ebdfa..8ede4b952997 100644
--- a/sound/soc/sof/ipc4.c
+++ b/sound/soc/sof/ipc4.c
@@ -370,6 +370,17 @@  static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_
 	if (!msg_data)
 		return -EINVAL;
 
+	if (!no_pm) {
+		const struct sof_dsp_power_state target_state = {
+			.state = SOF_DSP_PM_D0,
+		};
+
+		/* ensure the DSP is in D0i0 before sending a new IPC */
+		ret = snd_sof_dsp_set_power_state(sdev, &target_state);
+		if (ret < 0)
+			return ret;
+	}
+
 	/* Serialise IPC TX */
 	mutex_lock(&ipc->tx_mutex);