Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: ipc3: Add set_core_state pm_ops implementation

IPC3 uses sof_ipc_pm_core_config message
(SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE) to enable/disable cores
managed by the DSP.
The core state is set via a single bitfield, if the bit is 1 the core
should be on, if it is 0 then it is off.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220610083549.16773-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
0a047daf b41252d8

+18
+18
sound/soc/sof/ipc3.c
··· 1037 1037 ipc3_log_header(sdev->dev, "ipc rx done", hdr.cmd); 1038 1038 } 1039 1039 1040 + static int sof_ipc3_set_core_state(struct snd_sof_dev *sdev, int core_idx, bool on) 1041 + { 1042 + struct sof_ipc_pm_core_config core_cfg = { 1043 + .hdr.size = sizeof(core_cfg), 1044 + .hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE, 1045 + }; 1046 + struct sof_ipc_reply reply; 1047 + 1048 + if (on) 1049 + core_cfg.enable_mask = sdev->enabled_cores_mask | BIT(core_idx); 1050 + else 1051 + core_cfg.enable_mask = sdev->enabled_cores_mask & ~BIT(core_idx); 1052 + 1053 + return sof_ipc3_tx_msg(sdev, &core_cfg, sizeof(core_cfg), 1054 + &reply, sizeof(reply), false); 1055 + } 1056 + 1040 1057 static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd) 1041 1058 { 1042 1059 struct sof_ipc_pm_ctx pm_ctx = { ··· 1080 1063 static const struct sof_ipc_pm_ops ipc3_pm_ops = { 1081 1064 .ctx_save = sof_ipc3_ctx_save, 1082 1065 .ctx_restore = sof_ipc3_ctx_restore, 1066 + .set_core_state = sof_ipc3_set_core_state, 1083 1067 }; 1084 1068 1085 1069 const struct sof_ipc_ops ipc3_ops = {