ASoC: SOF: Bring WoV support to ipc4 - #5878
Conversation
IPC4 topologies can mark PCM streams as D0I3-compatible using the SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 (1200) and SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 (1201) tokens on host copier widgets. However, the IPC4 topology path did not parse these tokens, so the d0i3_compatible flag was never set and the DSP always went to D3 during S0ix. Add token definitions and parsing in sof_ipc4_widget_setup_pcm() to read the D0I3 compatibility flag from the host copier widget tuples into spcm->stream[dir].d0i3_compatible. Also set d0i3_supported_in_s0ix = true in ipc4_pcm_ops so the existing suspend_ignored logic in pcm.c applies to IPC4 streams, allowing the DSP to remain in D0i3 during S0ix when D0I3-compatible streams are active (e.g. wake-on-voice keyword detection). Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Mark the WOV host-copier stream as D0I3-compatible so the kernel keeps
the capture pipeline active during S0iX system sleep. When the WOV
trigger fires, the firmware sends SOF_IPC4_NOTIFY_PHRASE_DETECTED which
wakes the host from D0I3.
Two placement sites:
- Object.Widget.host-copier.1: parsed by IPC4 kernel (sof_ipc4_widget_setup_pcm
in ipc4-topology.c, see thesofproject/linux#5878)
- Object.PCM.pcm: parsed by IPC3 kernel (topology.c)
Also adds DefineAttribute entries for capture_compatible_d0i3 and
playback_compatible_d0i3 to host-copier.conf so IPC4 alsatplg can
encode the token into the widget TLV tuple set.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
I managed to establish that this indeed works on my PTL-upx. At least if I tag a capture PCM host-copier with 'capture_compatible_d0i3 1' property, and have a capture running when suspending to s2idle, the DSP remains running. And if the DSP sends a SOF_IPC4_NOTIFY_PHRASE_DETECTED to the host, it wakes up. The reason why my first hack test did not work was that the SOF driver pauses the capture before suspending. I assume that is Ok, and the WoV should deal with the pause command correctly. So I think this is ready for review. |
There was a problem hiding this comment.
Pull request overview
This PR extends Sound Open Firmware (SOF) IPC4 topology/PCM handling to support Wake-on-Voice (WoV)-style D0i3 compatibility signaling, aligning IPC4 behavior with the existing IPC3 capability.
Changes:
- Adds new IPC4 token groups to parse per-stream D0i3 compatibility properties from host-copier widget tuples.
- Updates IPC4 host-copier PCM widget setup to set
spcm->stream[dir].d0i3_compatiblebased on the new tokens. - Enables
ipc4_pcm_ops.d0i3_supported_in_s0ixto allow DSP D0i3 during S0iX for IPC4.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sound/soc/sof/sof-audio.h | Adds new token-group IDs for IPC4 stream D0i3 compatibility parsing. |
| sound/soc/sof/ipc4-topology.c | Defines/installs the new token groups and parses the D0i3 compatibility flag for IPC4 host-copier PCMs. |
| sound/soc/sof/ipc4-pcm.c | Enables d0i3_supported_in_s0ix for IPC4 PCM ops. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| static const struct sof_topology_token ipc4_stream_capture_d0i3_tokens[] = { | ||
| {SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u32, 0}, | ||
| }; |
There was a problem hiding this comment.
The topology.c have the stream_tokens, which sets the stream[0].d0i3_compatible / stream[1].d0i3_compatible of struct snd_sof_pcm.
I would rather use the existing mechanism if possible than invent another, ipc4 flag.
With that we can simple remove the struct sof_ipc_pcm_ops.d0i3_supported_in_s0ix as both IPC3 and now IPC4 supports this feature.
There was a problem hiding this comment.
The existing mechanism can not be used, the code paths are separate. But you would like to replicate the ipc3 mechanism to ipc4, e.g. put the property to the stream node in the topology?
There was a problem hiding this comment.
we have SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED / SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED generic tokens, which is applicable to both IPC3 and IPC4, we don't have IPC4 specific duplicates of these either afaik.
Why would the SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 / SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 needs duplication for IPC4?
I have not tested this any further than that the topology properties correctly set spcm->stream[dir].d0i3_compatible flag. That in addition to setting ipc4-pcm .d0i3_supported_in_s0ix = true , should - at least in theory - bring the same support we already have for ipc3 also to ipc4.
The correct place the enable the WoV is to put playback_compatible_d0i3 or capture_compatible_d0i3 tuple with non zero value to host-copier topology widget. For example:
I still need to come up with a setup to test this, but that will go to next week.
FYI @lgirdwood @singalsu