In S0ix (aka S0 Idle), the audio DSP can enter the D0i3 substate and keep some of the pipelines and processing active for e.g. Hotwording and other acoustic event detection while optimizing power consumption. This patchset mainly adds flags and state machines to track which streams may remain active (tagged as such in the topology file), and keep them active when the ALSA core tries to suspend everything.
The Intel specific parts are limited to the changes in the IPC, where instead of using an SRAM window, the IPC commands needed to enter and exit D0i3 are sent in a compressed form using IPC registers themselves.
This patchset is made of 26 patches, which is rather large, but each change is rather small and contained. The code was initially reviewed on GitHub, with 165+ comments provided and no regressions found [1]. The S0ix mode was tested on a CometLake platform.
Future improvements will consist in an additional idle detection so that the D0i3 mode can be entered even on devices where S0ix is not enabled.
[1] https://github.com/thesofproject/linux/pull/1337
Keyon Jie (26): ASoC: SOF: add a field to store the current D0 substate of DSP ASoC: SOF: reset default d0_substate at probe() and resume() ASoC: SOF: add set_power_state() to dsp_ops for power state update ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate ASoC: SOF: Intel: CNL: add set_power_state() ops ASoC: SOF: Intel: APL: add set_power_state() ops ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate ASoC: SOF: topology: parse and store d0i3_compatible flag ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update ASoC: SOF: Intel: HDA: use macro for register polling retry count ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc ASoC: SOF: ipc: introduce message for DSP power gating ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file ASoC: SOF: configure D0ix IPC flags in set_power_state ASoC: SOF: PM: add helpers for setting D0 substate for ADSP ASoC: SOF: Intel: CNL: add support for sending compact IPC ASoC: SOF: add a flag to indicate the system suspend target ASoC: SOF: add a flag suspend_ignored for sof stream ASoC: SOF: PM: implement prepare/complete callbacks ASoC: SOF: ignore suspend/resume for D0ix compatible streams ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition ASoC: SOF: return -ENOTSUPP if D0I3 is not supported ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix ASoC: SOF: pci: Add prepare/complete PM callbacks
include/sound/sof/header.h | 1 + include/sound/sof/pm.h | 8 +++ include/uapi/sound/sof/tokens.h | 4 ++ sound/soc/sof/core.c | 3 ++ sound/soc/sof/intel/apl.c | 1 + sound/soc/sof/intel/cnl.c | 43 +++++++++++++-- sound/soc/sof/intel/hda-dsp.c | 91 +++++++++++++++++++++++++++++++ sound/soc/sof/intel/hda-ipc.c | 6 ++- sound/soc/sof/intel/hda-ipc.h | 51 ++++++++++++++++++ sound/soc/sof/intel/hda.h | 12 +++++ sound/soc/sof/ops.h | 10 ++++ sound/soc/sof/pcm.c | 31 +++++++++++ sound/soc/sof/pm.c | 95 +++++++++++++++++++++++++++++++-- sound/soc/sof/sof-pci-dev.c | 2 + sound/soc/sof/sof-priv.h | 23 ++++++++ sound/soc/sof/topology.c | 43 ++++++++++++++- 16 files changed, 413 insertions(+), 11 deletions(-) create mode 100644 sound/soc/sof/intel/hda-ipc.h