Repository navigation
Conversation
Enable front-end PCM streams that are driven autonomously inside the DSP without allocating or triggering a Host HDA DMA channel or instantiating a DSP host-copier module (e.g. always-on ultrasonic TX tone generation and terminal RX Doppler gesture detection). When an aif_in/aif_out topology widget carries zero private token payload (tw->priv.size == 0), mark swidget->hostless and propagate it to spcm->stream[dir].hostless: - Skip DSP copier creation and IPC4 MOD_BIND on the virtual AIF widget while still traversing connected DSP processing and BE pipelines. - Skip Host DMA open, hw_params, trigger, hw_free, close, page-table setup, and host/DAI time_info registration; advertise SNDRV_PCM_INFO_RESUME for seamless S0ix retention. - Allow hostless D0i3-compatible playback and capture streams (including those with ignore_suspend=1 on their FE DAI link) to keep both DSP pipelines and their connected BE DAI links running in D0i3 across S0ix suspend/resume. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Wire sof_client_ipc_rx_dispatcher() into sof_ipc4_rx_msg() so auxiliary SOF client drivers can subscribe to IPC4 firmware notifications (such as SOF_IPC4_NOTIFY_MODULE_NOTIFICATION). Also fix the IPC4 notification type bounds check in sof_client_register_ipc_rx_handler() (ipc_msg_type is a shifted enum value, not a pre-shifted header mask, so validate against SOF_IPC4_NOTIFY_TYPE_LAST), define the gesture module notification magic prefix SOF_IPC4_NOTIFY_MODULE_EVENTID_GESTURE_MAGIC_VAL, and export sof_client_get_component() so client drivers can access the ASoC card. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the snd-sof-ultrasound auxiliary client driver
(CONFIG_SND_SOC_SOF_ULTRASOUND) and UAPI header
(include/uapi/sound/sof/ultrasound.h) for DSP-autonomous ultrasonic
Doppler gesture and presence sensing on IPC4 platforms:
- Kernel-managed hostless stream lifecycle: opens, configures (48 kHz
S32_LE, NO_PERIOD_WAKEUP, zero host DMA), and starts the hostless
"Ultrasound TX" and "Ultrasound RX" DPCM streams either automatically
when a userspace reader opens /dev/sof-ultrasound<N> (auto_enable=1) or
explicitly via /sys/class/misc/sof-ultrasound<N>/enable.
- S0ix low-power support: dynamically sets and restores ignore_suspend on
the hostless FE and sensing BE DAI links while active so the DSP stays
in D0i3 across s2idle suspend/resume without tearing down sensing.
- Userspace event interfaces:
1. /dev/sof-ultrasound<N> multi-reader kfifo supporting read(), poll(),
SOF_ULTRASOUND_IOC_GET_STATS, and SOF_ULTRASOUND_IOC_FLUSH.
2. Linux input device ("SOF Ultrasound Gesture") emitting EV_MSC /
MSC_GESTURE and EV_SW / SW_FRONT_PROXIMITY events.
3. Sysfs controls and telemetry (enable, active, auto_enable, stats,
last_event).
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical error-path and PCM lifetime bugs can crash the kernel, while missing suspend/resume handling can leave sensing streams unable to recover after S3 or hibernation.
5 open issues
Initialize widget_ops before bypassing hostless widgets · New Protect kernel-owned PCM streams through card disconnect · New Handle kernel-owned PCM streams across system suspend · New Recheck reader count under lock before stopping sensing · New Register the misc device only after IPC handler setup · New
What changed in this PR
Adds Linux SOF support for DSP-autonomous ultrasonic gesture and presence sensing, complementing the linked firmware/topology PR.
Changes:
- Supports hostless frontend PCM streams without host DMA, including S0ix pipeline retention.
- Routes IPC4 notifications to SOF clients.
- Adds an ultrasound client with stream control, event delivery, input reporting, and sysfs telemetry.
| File | Description |
|---|---|
sound/soc/sof/topology.c |
Identifies hostless AIF widgets and skips their DSP setup. |
sound/soc/sof/sof-client.h |
Declares the component-access helper. |
sound/soc/sof/sof-client.c |
Registers the ultrasound client and corrects notification validation. |
sound/soc/sof/sof-client-ultrasound.c |
Implements sensing lifecycle and userspace interfaces. |
sound/soc/sof/sof-audio.h |
Adds hostless stream and widget flags. |
sound/soc/sof/sof-audio.c |
Handles hostless widget traversal and suspend retention. |
sound/soc/sof/pcm.c |
Bypasses host DMA operations for hostless streams. |
sound/soc/sof/Makefile |
Adds the ultrasound module build target. |
sound/soc/sof/Kconfig |
Adds the ultrasound configuration option. |
sound/soc/sof/ipc4.c |
Dispatches received notifications to clients. |
sound/soc/sof/ipc4-pcm.c |
Skips host timestamp setup for hostless streams. |
sound/soc/sof/intel/hda-dai.c |
Extends backend retention to compatible hostless streams. |
include/uapi/sound/sof/ultrasound.h |
Defines event records and ioctl interfaces. |
include/sound/sof/ipc4/header.h |
Defines the gesture notification identifier. |
Review effort: Balanced
Comment on lines
+495
to
496
| if (!swidget || swidget->hostless) | ||
| goto sink_prepare; |
Comment on lines
+186
to
+188
| mutex_lock(&pcm->open_mutex); | ||
| err = snd_pcm_open_substream(pcm, dir, &priv->dummy_file, &substream); | ||
| mutex_unlock(&pcm->open_mutex); |
Comment on lines
+355
to
+357
| /* Approach B: mark FE and BE links ignore_suspend while hostless sensing is active */ | ||
| sof_ultrasound_save_ignore_suspend(priv, tx_rtd->dai_link); | ||
| sof_ultrasound_save_ignore_suspend(priv, rx_rtd->dai_link); |
Comment on lines
+691
to
+693
| mutex_lock(&priv->ctrl_mutex); | ||
| if (!priv->sysfs_enabled && priv->sensing_active) | ||
| sof_ultrasound_stop_sensing_locked(priv); |
| priv->miscdev.groups = sof_ultrasound_groups; | ||
| priv->miscdev.parent = &auxdev->dev; | ||
|
|
||
| ret = misc_register(&priv->miscdev); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Companion Linux kernel PR for SOF DSP-autonomous ultrasonic Doppler gesture and presence sensing:
Commits
ASoC: SOF: core: support hostless DSP-autonomous FE PCM streamsaif_in/aif_outtopology widgets withpriv.size == 0asswidget->hostless/spcm->stream[dir].hostless.MOD_BIND, and all Host HDA DMA operations (open/hw_params/trigger/hw_free/close/page-table/time_info) while keeping connected DSP and BE pipelines active.suspend_ignoredandhda_dai_has_wov_fe()so hostless D0i3-compatible playback and capture streams (includingignore_suspend=1links) retain DSP pipelines and BE links inD0I3acrosss2idle.ASoC: SOF: ipc4: dispatch IPC4 RX notifications to SOF client driverssof_client_ipc_rx_dispatcher()fromsof_ipc4_rx_msg().sof_client_register_ipc_rx_handler()(ipc_msg_type >= SOF_IPC4_NOTIFY_TYPE_LAST), definesSOF_IPC4_NOTIFY_MODULE_EVENTID_GESTURE_MAGIC_VAL, and exportssof_client_get_component().ASoC: SOF: client: add ultrasonic gesture and presence sensing driverCONFIG_SND_SOC_SOF_ULTRASOUND(snd-sof-ultrasound, depends onSND_SOC_SOF && SND_SOC_SOF_IPC4 && INPUT) and UAPI headerinclude/uapi/sound/sof/ultrasound.h.Ultrasound TX/Ultrasound RXPCMs directly in kernel space (auto-enabled on/dev/sof-ultrasound<N>open or via sysfsenable) with dynamicignore_suspendsave/restore./dev/sof-ultrasound<N>(multi-reader kfifo,read/poll/ioctl), Linux input device ("SOF Ultrasound Gesture",EV_MSC/MSC_GESTURE&EV_SW/SW_FRONT_PROXIMITY), and sysfs telemetry.Verification (Wildcat Lake / ACE 3.0 + RT722 + 4-ch Intel PDM DMIC)
scripts/checkpatch.pl: 0 errors, 0 warnings across all 3 patches.make M=sound/soc/sof W=1: 0 warnings with bothCONFIG_SND_SOC_SOF_ULTRASOUND=mand=n./dev/sof-ultrasound0open, clean D3 teardown on close, zero host DMA period IRQs, simultaneous speaker playback & DMIC capture coexistence, 7/7 gesture & presence events withdropped=0, automaticD0I3entry, and cleanrtcwake -m freeze -s 4(s2idle) retention without FW reload.