Handle WoV phrase detection notification and kcontrols - #5903
Handle WoV phrase detection notification and kcontrols#5903naveen-manohar wants to merge 2 commits into
Conversation
54c39e0 to
412f4a9
Compare
|
@jsarha pls review - it may be that your IPC4 wov wakeup PR overlaps here. |
jsarha
left a comment
There was a problem hiding this comment.
I think it would be best to use snd_sof_pcm_period_elapsed(), but other than that I do not see anything alarming here. Of course the final judge is, does it work?
412f4a9 to
85f6bee
Compare
Done !! |
There was a problem hiding this comment.
Pull request overview
Adds IPC4 Wake-on-Voice (WoV) phrase detection handling to the SOF driver so firmware keyword events can wake the system, notify user-space via kcontrol events, and unblock the WoV capture stream.
Changes:
- Add a new IPC4 notification handler for
SOF_IPC4_NOTIFY_PHRASE_DETECTED. - Introduce IPC4 WoV helper implementation to notify topology-defined kcontrols and trigger capture progress.
- Hook the new code into the SOF IPC4 build and notification dispatch path.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sound/soc/sof/Makefile | Adds ipc4-wov.o to the IPC4 build. |
| sound/soc/sof/ipc4.c | Dispatches PHRASE_DETECTED notifications to the WoV handler. |
| sound/soc/sof/ipc4-wov.h | Declares the WoV phrase-detected handler API. |
| sound/soc/sof/ipc4-wov.c | Implements kcontrol notifications and capture unblocking on phrase detection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /* IPC4 PHRASE_DETECTED primary/extension field layout */ | ||
| #define SOF_IPC4_PHRASE_WORD_ID_MASK GENMASK(31, 24) | ||
| #define SOF_IPC4_PHRASE_WORD_ID_SHIFT 24 | ||
| #define SOF_IPC4_PHRASE_SV_SCORE_MASK GENMASK(15, 0) | ||
|
|
| list_for_each_entry(spcm, &sdev->pcm_list, list) { | ||
| if (spcm->pcm.pcm_id != SOF_WOV_PCM_ID) | ||
| continue; | ||
|
|
Add SOF_IPC4_NOTIFY_PHRASE_DETECTED notification handler, sent by DSP FW when a keyword is detected by WoV pipeline. Handler parses PCM list to find WoV capture PCM pcm_id 11, calls snd_sof_pcm_period_elapsed() to unblock waiting capture stream. Signed-off-by: Naveen Manohar <naveen.m@intel.com>
When DSP reports keyword detection, notify topology-defined WoV kcontrols so that user space can poll for value changes. Checked for 2 kcontrols in loaded topology: - 'wov_trigger_id': RO enum reporting winner slot(0/1/2) - 'wov_event': control that user space polls via POLLPRI Signed-off-by: Naveen Manohar <naveen.m@intel.com>
85f6bee to
a9f3678
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
sound/soc/sof/ipc4-wov.c:105
- The "PCM not found" warning can become noisy if firmware reports phrase detections while the WoV topology/PCM isn't present. Consider making this warning ratelimited to avoid log spam.
dev_warn(sdev->dev, "WoV: PHRASE_DETECTED but PCM %d not found\n",
SOF_WOV_PCM_ID);
| /* PCM ID for WoV keyword detection capture stream */ | ||
| #define SOF_WOV_PCM_ID 11 | ||
|
|
| if (!substream || !substream->runtime) { | ||
| dev_warn(sdev->dev, "WoV: PCM %d not open\n", | ||
| SOF_WOV_PCM_ID); | ||
| return; | ||
| } |
Add SOF_IPC4_NOTIFY_PHRASE_DETECTED notification handler for WoV.
When DSP FW reports keyword detection, unblock the WoV capture stream
via snd_pcm_period_elapsed()
Notify topology-defined kcontrols ('wov_trigger_id', 'wov_event') for userspace polling.
V2: snd_pcm_period_elapsed -> snd_sof_pcm_period_elapsed, word_id bit correction