diff options
author | Mark Brown <broonie@kernel.org> | 2022-06-10 18:28:20 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-06-10 18:28:20 +0100 |
commit | 55e1c007e1bd3b30efac683f6d7eba6d4a13928d (patch) | |
tree | c88329ded80fb262cbb7678b43e0d0bb08638619 /sound/soc/sof/ipc3.c | |
parent | 25ebeeebcb5493b42b6d43e4f4c49823782b83af (diff) | |
parent | 63b9069653a710b08d5fd174ac05d43711356541 (diff) |
ASoC: SOF: Add support ctx_save with IPC4
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
The context save functionality with IPC4 is triggered by sending a message to
the firmware about the pending power down of the primary core by the host.
In order to have this functionality implemented in a clean way we need to
introduce a new IPC level PM ops for core state management and use that instead
of open coding IPC messages here and there.
The first patch updates the ctx store/ctx_restore documentation to clarify that
they are optional.
Diffstat (limited to 'sound/soc/sof/ipc3.c')
-rw-r--r-- | sound/soc/sof/ipc3.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c index ef8019e009b7..0df57e7e83ac 100644 --- a/sound/soc/sof/ipc3.c +++ b/sound/soc/sof/ipc3.c @@ -1037,6 +1037,23 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev) ipc3_log_header(sdev->dev, "ipc rx done", hdr.cmd); } +static int sof_ipc3_set_core_state(struct snd_sof_dev *sdev, int core_idx, bool on) +{ + struct sof_ipc_pm_core_config core_cfg = { + .hdr.size = sizeof(core_cfg), + .hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE, + }; + struct sof_ipc_reply reply; + + if (on) + core_cfg.enable_mask = sdev->enabled_cores_mask | BIT(core_idx); + else + core_cfg.enable_mask = sdev->enabled_cores_mask & ~BIT(core_idx); + + return sof_ipc3_tx_msg(sdev, &core_cfg, sizeof(core_cfg), + &reply, sizeof(reply), false); +} + static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd) { struct sof_ipc_pm_ctx pm_ctx = { @@ -1063,6 +1080,7 @@ static int sof_ipc3_ctx_restore(struct snd_sof_dev *sdev) static const struct sof_ipc_pm_ops ipc3_pm_ops = { .ctx_save = sof_ipc3_ctx_save, .ctx_restore = sof_ipc3_ctx_restore, + .set_core_state = sof_ipc3_set_core_state, }; const struct sof_ipc_ops ipc3_ops = { |