[26.04_linux-nvidia-bos] N1x audio: MediaTek mt8901 SoundWire/ASoC/SOF stack - #567
[26.04_linux-nvidia-bos] N1x audio: MediaTek mt8901 SoundWire/ASoC/SOF stack#567dcemin-nv wants to merge 33 commits into
Conversation
|
@kbutala-nv @aritger review requested per the N1x patch integration call for action (Sudeep asked for Andy on anything touching shared subsystems). Bharat Dintakurti should review the SOF DSP power management patch on his return; carrying it here since he is out. |
Boro watcher review skippedThe PR watcher skips automatic boro reviews for changes with more than 50 commits. This change currently has 58 commits. To run the review anyway, ask Head: This comment is maintained by BaseOS Reviewer. It is updated when the watcher sees a newer head. |
d52b6e0 to
f8ee8e5
Compare
PR Validation ReportPatchscan ✅ No Missing FixesAll cherry-picked commits checked — no missing upstream fixes found. PR Lint ✅ All checks passedDetailsChecking 33 commits... Cherry-pick digest: ┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐ │ Local │ Referenced upstream / Patch subject │ Patch-ID │ Subject │ SoB chain │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 901eb2a5cd73 │ [UBUNTU] [Config] enable the MT8901 audio stack │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 08504e53b81a │ [SAUCE] soundwire: mediatek: mask bus-clash interrupts on a stor │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 7cadc28e117a │ [SAUCE] soundwire: mediatek: add 2x rt1320 + rt712 machine entry │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ e436af8a15fb │ [SAUCE] soundwire: mediatek: support suspend/resume │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 1f66dfa2290b │ [SAUCE] asoc: mediatek: mt8901: support suspend/resume │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ edd7c4cd32cc │ [SAUCE] asoc: mediatek: mt8901: add error handling in card probe │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 39940c1e635e │ [SAUCE] asoc: mediatek: mt8901: put the jack stream on dl1 │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 9b526572e50a │ [SAUCE] soundwire: mediatek: restart every link at probe │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 37adf723cebf │ [SAUCE] asoc: sof: add mt8901 acpi adsp platform driver │ N/A │ N/A │ zhang, bdintaku, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ dd04d13d2de8 │ [SAUCE] soundwire: mediatek: add cs42l43 + 4x cs35l56 machine en │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 387687887c4a │ [SAUCE] soundwire: mediatek: restart the bus when nothing attach │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ be08b4ef2d7f │ [SAUCE] soundwire: mediatek: add a diagnostic quarantine knob │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 181e11ec754c │ [SAUCE] soundwire: mediatek: add bus reset recovery │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ b30817acec34 │ [SAUCE] soundwire: mediatek: pace dev0 enumeration rounds │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 1639ee316882 │ [SAUCE] soundwire: mediatek: verify dev0 devid reads │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 9872762cabe0 │ [SAUCE] soundwire: mediatek: fix lost slave status interrupts │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 7335bf11b37d │ [SAUCE] asoc: mediatek: mt8901: do not advertise s32_le │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ bbe5e137a08b │ [SAUCE] soundwire: mediatek: add pin bias configuration │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 8e1d0fd03044 │ [SAUCE] soundwire: mediatek: add cs42l43 + 2x cs35l56 machine en │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 279a367c0a54 │ [SAUCE] soundwire: mediatek: add 2x rt1321 + rt713 machine entry │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 03622b99e5ed │ [SAUCE] soundwire: mediatek: add 4x cs35l56 + cs42l43 machine en │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ e82350eda8e0 │ [SAUCE] soundwire: mediatek: add system sleep pm ops │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ c738041b0794 │ [SAUCE] asoc: mediatek: mt8901: add system sleep pm ops │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 05f182463d9c │ [SAUCE] soundwire: mediatek: add mt8901 clock control support │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ a5d227738d93 │ [SAUCE] asoc: mediatek: mt8901: add clock control │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 07fcb2cf4bcd │ [UBUNTU] [Config] annotation for CONFIG_SND_SOC_MTK_SDCA (disabl │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ aa4a30d06a66 │ [SAUCE] asoc: mediatek: add sdca support for mediatek chip │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 1b126631f590 │ [SAUCE] asoc: mediatek: mt8901: add legacy machine driver │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ ff8f48981e13 │ [UBUNTU] [Config] annotation for CONFIG_SND_SOC_MT8901 (disabled │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 2129e5f8b29f │ [SAUCE] asoc: mediatek: mt8901: add audio platform driver │ N/A │ N/A │ hsieh, wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 75b62a2afb95 │ [SAUCE] soundwire: mediatek: register machine platform device │ N/A │ N/A │ wu, dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 15177f98b302 │ [UBUNTU] [Config] annotation for CONFIG_SOUNDWIRE_MTK (disabled) │ N/A │ N/A │ dcemin │ ├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤ │ 8f190119f4de │ [SAUCE] soundwire: mediatek: add mediatek soundwire manager │ N/A │ N/A │ wu, dcemin │ └──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘ Lint: all checks passed. |
691bd3c to
1fe9eb1
Compare
|
Thanks for the review. Updated the series to follow the guide:
On the upstreaming plan: the MediaTek authored base drivers (SoundWire manager, ASoC AFE and machine drivers, SOF platform) are MediaTek IP and mainline submission is expected to come from MediaTek, with coordination in progress (their rt712 codec fix from this program is already accepted upstream). The NVIDIA authored generic pieces go to mainline from our side: the sdw_utils fix is being prepared for alsa-devel and the watchdog change for linux-watchdog (a related parameter rename from this program was already accepted in the watchdog maintainer tree). The mt8901 specific machine table entries and fixes follow the MediaTek base drivers whenever those land upstream. |
|
@dcemin-nv I created the Launchpad bug for this change: Could you please add this link to the PR description? Also we need below information to track these patches: |
|
Tracking info: the series maps to the N1x audio enablement program, main internal NVbugs 6571683, 6589663, 6589652, 6566886 plus the Launchpad bug above. Upstream plan: the MediaTek authored base drivers are MediaTek IP with mainline submission expected from MediaTek (their rt712 codec fix from this program is already accepted upstream); the NVIDIA authored generic fix (sdw_utils) is prepared against broonie/for-next and being posted to the ASoC list, lore link to follow here. |
Add the MediaTek mt8901 SoundWire manager driver. The manager wraps a Cadence SoundWire master IP behind MediaTek link and interconnect glue: ACPI probe and link enumeration, PDI allocation against the fixed AFE interconnect grid, interrupt handling, and stream/port configuration for the SoundWire codecs on the platform. Folded review fixes from the bring-up: compare device 0 status against the SLAVESTAT field encoding rather than the raw register value, track the previous PDI across port contiguity checks, reset the group sync state on every hw_params instead of leaking it across streams, and return the correct error code when a core register map fails. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
1fe9eb1 to
ae3d6e0
Compare
BaseOS Kernel ReviewNote 🔄 Review in progressBoro is reviewing this pull request. Results will appear here when ready. 🔍 Review artifacts
Review metadata
This comment is maintained by BaseOS Reviewer and updated when the GitHub watcher publishes a newer review. |
|
Thanks for the thorough review; the series is rebuilt accordingly and force pushed (now 33 commits). Point by point:
The rework preserved the validated tree byte for byte (verified by diff against the board tested series), so the Yukon validation results carry over unchanged. |
Add the config annotation for the new MediaTek SoundWire manager. The option is introduced disabled; enablement follows at the end of the series once the complete audio stack is in place. Signed-off-by: David Cemin <dcemin@nvidia.com>
ALSA needs a machine driver to bind the platform DAIs and the SoundWire codecs into a sound card. Register a machine platform device from the SoundWire manager, carrying the codec topology discovered during enumeration, so a matching machine driver can complete the card registration. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the mt8901 AFE platform driver: memory interfaces, the AFE interconnect, DAI definitions and the platform component used by the machine driver. Folded review fixes from the bring-up: request the AFE interrupt only after the regmap is set up so the handler cannot run against an uninitialized map, and limit VUL_CM2 to the 16 channels that are physically wired. Signed-off-by: mtk34643 <weiyi.hsieh@mediatek.com> Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the config annotation for the mt8901 ASoC platform driver. The option is introduced disabled; enablement follows at the end of the series. Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the mt8901 machine driver for SoundWire audio devices: Kconfig and Makefile entries plus the machine driver implementation that binds the AFE platform DAIs to the enumerated SoundWire codec endpoints. Folded review fix: size the codec_conf array by the number of codec endpoints rather than the number of devices; a device contributing several endpoints previously overran the array. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Codec integration requires SDCA support on the SoundWire manager side. Introduce the SND_SOC_MTK_SDCA configuration and the glue that enables SDCA class devices behind the MediaTek manager. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the config annotation for the MediaTek SDCA support option, introduced disabled; enablement follows at the end of the series. Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the mt8901 audio clock control: the AFE clock tree (muxes, gates, APLL tuner and engen control) and the SSPM-managed functional clock requests issued through the power-wrap client API. Select SOUNDWIRE_MTK_MT8901_CLK from the machine configuration so the clock integration is always active with the machine driver. Folded review fix: roll back a partially applied idle clock parent switch instead of leaving the mux chain in a mixed state when one step fails. Depends on the MediaTek power_wrap driver providing mtk_send_power_control_req() (submitted separately). Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Integrate clock management into the mt8901 SoundWire manager: bring the functional clock tree up during link initialization and release it symmetrically on teardown, using the shared mt8901 AFE clock helpers. Folded review fixes: release the link top clock when link init fails partway, and keep the register clock bookkeeping accurate in the probe unwind path so a failed probe does not leave gates held. Depends on the MediaTek power_wrap driver (submitted separately). Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Add system sleep suspend/resume callbacks to the mt8901 ASoC platform driver so the audio block releases its clock and MTCMOS power requests across suspend and the platform can reach its deepest sleep state. The SSPM firmware reference counts power domain requests, so per-module requests are intentionally symmetric with the other operating system supported on this platform. Folded review fix: unwind partial state when one of the system sleep steps fails, instead of resuming into a half-suspended configuration. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Add system sleep suspend/resume callbacks to the mt8901 SoundWire manager, releasing clocks and the power domain on suspend and reacquiring them on resume so the platform can reach its deepest sleep state. The power domain votes are taken and released per link: each link that was active before suspend restores its own vote on resume. A master-wide vote is not sufficient because links power on independently and a single vote either leaks references or releases a domain that another link still needs. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
…entry The machine table only described one Realtek layout (RT1320 x2 on link0 plus RT712 on link1), so on boards with the dual-link Cirrus topology no machine matches and no sound card is created. Add that layout: four CS35L56 amps on link0 (unique IDs 0x30-0x33, aggregated into one speaker group) and a CS42L43 jack codec on link1 (unique ID 0x30), with the endpoint shapes used by the upstream AMD and Intel entries for the same codec combination. _ADR values taken from the platform firmware ACPI dump. The speaker-position-to-unique-ID mapping is assumed in ID order and will be confirmed on hardware. The cs42l43 endpoint list carries only the jack and mic endpoints; the sidecar speaker endpoint is omitted since these boards use separate SoundWire amps. Signed-off-by: David Cemin <dcemin@nvidia.com>
Boards with this Realtek layout enumerate 2x RT1321 (unique IDs 0x30/
0x31) on link0 and an RT713 on link1. The existing Realtek entry matches
the E4032-A00 reference parts (RT1320 at unique IDs 0x30/0x32, RT712),
so these boards enumerated but never registered a card. Add the
combination with the _ADR values from the platform firmware. RT1321 and
RT713 are already handled by the rt1320-sdw and rt712-sdca codec drivers
and are present in the sdw_utils codec_info_list.
RT713 needs its own endpoint list {0, 1} (jack DAI 0, DMIC DAI 1 per the
sdw_utils codec info for part 0x713); reusing the RT712 endpoints {0, 2}
fails because the RT712 DMIC sits at index 2 behind the amp DAI. The
name prefixes follow the driver family so existing control names are
unchanged.
Signed-off-by: David Cemin <dcemin@nvidia.com>
…entry This Cirrus variant puts all three codecs on link1 with link0 unused: a CS42L43 jack codec at unique ID 0x30 plus two aggregated CS35L56 amps at unique IDs 0x30/0x31 (_ADR values from the platform firmware dump; peripherals of different part numbers may share unique IDs on one link). Distinct from both the dual-link Cirrus arrangement (four amps on link0) and the Realtek layouts. The cs42l43 entry uses the same speakerless endpoint list as the dual-link Cirrus entry, and the amps take group positions 0/1 of the existing aggregated group. Signed-off-by: David Cemin <dcemin@nvidia.com>
The SoundWire pads need bus-keeper bias configuration; without it codec enumeration fails unless the pads are configured by hand. Program the pin bias from ACPI resources during link initialization. Depends on the MediaTek pinctrl bus-keeper support (submitted separately). Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
The AFE data path is 24-bit internally. S16 and S24 (24 valid bits in a 32-bit container) play clean on hardware, but true 32-bit memif mode produces heavily distorted output regardless of the HD mode and align settings (board verified: S16 clean, S24 clean, S32 badly distorted on the same route). The reference driver for this silicon only uses the 16 and 24-bit memif modes. This matters for the default desktop experience: with S32 advertised, PipeWire negotiates it by preference and out-of-the-box playback is audibly degraded. Dropping it makes PipeWire pick S24, full quality, with no userspace format pinning needed. Signed-off-by: David Cemin <dcemin@nvidia.com>
Two defects combined to permanently lose peripheral attach transitions after initial enumeration: 1) The interrupt handler scheduled the slave status work before masking the slave interrupt. The work re-enables that interrupt when it completes, so a work that ran to completion on another CPU before the handler's mask landed left the slave interrupt masked forever; every subsequent attach or detach transition on the link was invisible to the manager. Dense links (five peripherals) lose this race reliably during the enumeration interrupt storm. Mask first, then schedule. 2) A peripheral that soft-resets after enumeration (the cs42l43 jack codec does this during driver probe) drops to Dev0 and takes tens of ms to re-sync before it can ACK a device number write. The status work polls Dev0 in a tight loop bounded by SDW_MAX_DEVICES iterations, which completes well inside that window: the device number writes are ignored (-61) and the attach is dropped. Convert the work to a delayed work that re-schedules itself (20 ms period, bounded at 25 attempts) while Dev0 remains attached. Observed on a five-peripheral single-link topology where the cs42l43 probe reset consistently left the codec UNATTACHED and the card at -EPROBE_DEFER. The reference stack never exercises either path because it does not reset codecs after enumeration. Signed-off-by: David Cemin <dcemin@nvidia.com>
A peripheral still re-synchronizing at Dev0 (or several colliding there) ACKs DevId reads while returning corrupted bytes. The bus core trusts a single read, so a corrupted ID registers a phantom peripheral that consumes a device number while the real device stays orphaned; observed on a five-peripheral link as dozens of phantom entries with bit-mixed IDs (part 0x0043 from a 0x4243 device, class 0 from class 1 peripherals) and the jack codec enumerated under a mangled identity its driver never matches. Run the Dev0 DevId read as two complete sequential 0x50..0x55 passes and report the command ignored on mismatch so the core retries the attach later, once the peripheral answers stably. The passes must be complete and in-order: peripherals track the sequential DevId read to commit arbitration, so per-byte repeat reads leave them uncommitted and they then ignore the device number write. Signed-off-by: David Cemin <dcemin@nvidia.com>
Two peripherals answering a Dev0 DevId read while one of them is still regaining frame sync produce deterministic wire-mixed responses (the misaligned straggler corrupts the synced responder's bits the same way every round), so read-and-verify cannot filter them and the bus core enumerates phantom identities. The status work currently burns all its enumeration rounds within ~50 ms, entirely inside the straggler's re-sync window. Sleep 30 ms between rounds while Dev0 reports attached so a straggler reaches frame sync before the next DevId read, at which point both peripherals arbitrate correctly and enumerate under their real identities. Signed-off-by: David Cemin <dcemin@nvidia.com>
The command reset issued once during hw_init is the only path that brings every peripheral to Dev0 simultaneously for a clean group enumeration; a link that fails enumeration (peripherals stuck contending at Dev0, or carrying stale state from a previous OS run across a warm reboot) currently has no way back to that state and stays wedged until the next cold boot. Re-issue the command reset when the Dev0 re-poll gives up, bounded at three attempts per episode, and re-kick the status work after a settle delay. Also expose the reset manually via debugfs (echo <link> > mtk-sdw/bus_reset) for testing, and reject Dev0 DevId reads that return all-zeros or all-ones (bus-keeper-held lines read back stably but nothing real is driving). Signed-off-by: David Cemin <dcemin@nvidia.com>
An electrically faulty peripheral that asserts Alert permanently drags the bus core into an endless alert-read retry storm (every interrupt register read fails parity) and the traffic from the misbehaving responder disturbs enumeration of the healthy peripherals sharing the link. Add quarantine_uid: report the matching 0x3556 peripheral as plainly attached so its alerts are never serviced, allowing the rest of the link to enumerate and be validated. Diagnostic aid for a bad unit, default off. Signed-off-by: David Cemin <dcemin@nvidia.com>
…ches A re-initialized master (module reload, and eventually resume) comes up in normal operation mode while the peripherals still hold their device numbers from the previous enumeration. They raise no new attach transition, so the interrupt-driven status machinery (including the bus reset recovery) is never armed and the link sits dead with zero attach events. The reference stack never hits this because it runs its restart choreography (ResetAndReInitMaster) unconditionally on every re-init. Detect the state instead of restarting unconditionally: schedule a one-shot check per link at probe; if peripherals are declared for the link but every one is still UNATTACHED 2 s after init, run the restart choreography with the same interrupt quiesce/re-arm bracket as the debugfs knob (SOFT_RST clears the slave interrupt masks; without the re-arm the post-restart attach transitions never interrupt and enumeration stalls after Dev0). The restart drops the peripherals to Dev0 and re-enumerates them through the normal interrupt path. The 2 s delay is far past the normal attach window (tens of ms out of POST, where the check sees attached slaves and does nothing) but inside the 5 s the codec drivers wait for re-attach at probe, so the codecs recover without a rebind. Board-proven on the Lenovo Yoga 9 83N7 (S/N the affected unit, five peripherals on link1): a plain module remove/reload of the audio stack, previously the zero-attach dead-link signature, now recovers fully automatically: restart at +2 s, all five peripherals re-enumerate, amp DSP firmware reloads, the card re-registers with no manual step, and acoustic loopback passes identically to cold boot. Signed-off-by: David Cemin <dcemin@nvidia.com>
…entry This Cirrus variant puts all five codecs on link1 with link0 unused: a CS42L43 jack codec at unique ID 0x30 plus four aggregated CS35L56 amps at unique IDs 0x30/0x31/0x34/0x35 (_ADR values from the platform firmware dump; peripherals of different part numbers may share unique IDs on one link). Distinct from the dual-link Cirrus arrangement (four amps on link0) and from the two-amp single-link entry, of which it is a superset: the entry is placed ahead of the two-amp one because matching is first-fit and tolerates extra enumerated peripherals, so the two-amp entry would otherwise match a four-amp board and register a card with only half the speakers. The cs42l43 entry uses the same speakerless endpoint list as the other Cirrus entries, and the amps take group positions 0-3 of the existing aggregated group. Signed-off-by: David Cemin <dcemin@nvidia.com>
Add the SOF platform driver for the mt8901 audio DSP: ACPI probe, DSP power management through the power-wrap client interface, and the SOF plumbing needed to manage the ADSP power state from Linux. Folded the initial integration repair: correct the Kconfig dependencies, the Makefile include path and the power-wrap header use so the driver builds and manages the DSP power state as intended. Depends on the MediaTek power_wrap driver (submitted separately). Signed-off-by: Greta Zhang <greta.zhang@mediatek.com> Co-developed-by: Bharat Dintakurti <bdintakurti@nvidia.com> Signed-off-by: Bharat Dintakurti <bdintakurti@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
POST leaves the peripherals enumerated and the bus running, and until now Linux adopted that state. Adopting preserves whatever internal state the peripherals hold, which has been observed in the field to include defective persistent state that register-level reconfiguration cannot clear: the codec sits on an always-on rail (+1.8VSUS) that never drops while the battery is connected, so such state survives reboots indefinitely. On an ASUS ProArt P14 unit that had never run Windows, the internal microphone path was broken this way for weeks; one bus restart cleared it permanently and both microphones and speakers validated acoustically immediately after. The reference Windows stack never hits this class of problem because it runs its restart choreography (ResetAndReInitMaster) unconditionally on every init. Do the same: run the bus restart in link init, after the hardware init and before interrupts are enabled, so the slave interrupt masks that SOFT_RST clears are armed after the restart and the fresh attach transitions are processed normally. The post-init attach check remains as a backstop. A restart_on_probe module parameter (default on) allows reverting to the old adopt behavior from the kernel command line. Boot-time cost is one restart dwell (about 30 ms) per link. Signed-off-by: David Cemin <dcemin@nvidia.com>
The AFE playback interconnect is fixed in hardware: PDI2/PDI3/PDI4 are only reachable from the speaker memifs (DL0/DL_24CH) and PDI5/PDI6 only from the headphone memif (DL1), and data port DP<n> is hard-wired to PDI<n>. The machine driver hands out SoundWire cpu-DAI pins to endpoint groups in plain endpoint order, which works on two-link boards (the firmware allocates link1's DPs from DP5, so the jack group lands on DP5 by accident of ordering) but breaks on single-link boards such as the ASUS ProArt P14 and Lenovo Yoga 9 (CS42L43 plus CS35L56 amps, everything on link1, DPs allocated from DP2): the jack group got DP2, which DL1 cannot reach, so opening the jack PCM (hw:,1) failed with -EINVAL (no backend DAIs for DL1_FE). Worse, PipeWire drops an entire UCM verb when any of its PCMs fails to open, so this removed every audio device on those boards. Read the firmware DP allocation (acpi-scd-dp-allocation, same property the SoundWire controller parses; the machine device is a child of the controller) and reserve the DP5 pin for the jack playback stream; everything else allocates sequentially around it. On two-link boards this computes the same assignment as before (jack pin 5 - 5 = 0). On single-link boards the jack moves to DP5/PDI5 while the amps keep the sequential pins they had before (DP3/DP4 on the P14, where the amp backend is wired through the O152/O153 interconnect); DP2 is left unused. If the property is absent the legacy sequential behaviour is kept. The jack reservation burns the sequential slot the jack would have taken, but only while the sequence has not yet stepped over the jack pin: if a non-jack stream already skipped it, burning again would leave a pin gap and could push later streams past the firmware DP window (review finding on the first revision). Board-proven on the ASUS ProArt P14: full four-path matrix (speakers, jack, DMIC capture, headset mic) passes with the UCM profile unchanged for the non-jack paths. Signed-off-by: David Cemin <dcemin@nvidia.com>
Handle failures during card probe: unwind the partially registered card and return the error instead of continuing with an inconsistent component state. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Restore the AFE hardware state on resume: reprogram the memory interfaces, interconnect routing and interrupt state so streams can restart after system suspend without reloading the driver. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Complete the SoundWire manager resume path: reinitialize the links, restore the Cadence configuration, re-enumerate the bus and restore the data port setup so peripherals reattach and audio continues to work after system suspend. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Co-developed-by: David Cemin <dcemin@nvidia.com> Signed-off-by: David Cemin <dcemin@nvidia.com>
Boards with this Realtek layout enumerate two RT1320 amps on link0 at unique IDs 0x30 and 0x31 plus an RT712 jack codec on link1. The existing reference entry expects the second amp at unique ID 0x32, so these boards enumerated but never matched a machine and no card was created. Add the variant with the second amp at 0x31, reusing the existing RT712 endpoint list and the rt1320-1/rt1320-2/rt712 name prefixes so existing mixer recipes and profiles apply unchanged. _ADR values from the platform firmware ACPI dump. The firmware also declares PinFunction pad entries (same 0x90/0xF0 policy as other production boards) and full SDCA functions on the RT712. Signed-off-by: David Cemin <dcemin@nvidia.com>
The clash interrupts are enabled unconditionally and the handler only logs and clears them. Isolated clashes at bus power transitions are harmless (1-2 per suspend/resume cycle in the reference board soak data), but a persistent clash condition refires the interrupt as fast as it is cleared: on an HP OmniBook (all peripherals on link1) an idle link0 storms continuously, pinning CPU0 with softirqs and flooding the log (reported on production units). Detect a storm (32 clash interrupts inside a 100 ms window) and mask the clash interrupts on that link; ratelimit the per-event log lines. All MCP_INTMASK updates are read-modify-write from the ISR, the status work, and the attach-check work with no shared guard, so the new ISR-side masking write is funneled, together with the existing enable helpers, through one spinlock-serialized updater. Audio is unaffected before and after masking: the storming link carries no devices and stream traffic on the other link is serviced normally. Signed-off-by: David Cemin <dcemin@nvidia.com>
Enable the complete MT8901 audio stack now that every component is in place: the SoundWire manager, the ASoC platform and machine drivers with SDCA support, and the SOF ADSP platform driver. Signed-off-by: David Cemin <dcemin@nvidia.com>
ae3d6e0 to
901eb2a
Compare
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2166301
MediaTek mt8901 audio stack for the N1x laptops, as shipping and validated in the N1x FastOS kernel: the MediaTek SoundWire manager, the ASoC AFE platform and machine drivers with SDCA support, the SOF/ADSP platform driver, the reliability and enumeration fixes, and the machine table entries for the six validated OEM topologies.
Series shape (reworked per review):
Dependencies (patches intentionally NOT carried here):
This PR does not build standalone until those land; the affected commits carry the dependency note.
Upstream status: the NVIDIA authored generic fixes from this program are going to the lists (sdw_utils fix prepared against broonie/for-next for the ASoC list; the related sbsa_gwdt fix for linux-watchdog); lore links will be added to the corresponding downstream commits/PRs once archived. The MediaTek base drivers are MediaTek IP; mainline submission is being coordinated with MediaTek and their postings will be linked when available.
Validation (this exact content, as an NV-Kernels build on an N1x board): full kernel deb boots with the board's own config; audio stack enumerates with the correct machine identity; acoustic loopback QA 4/4 PASS at 61 to 67 dB SNR; 3/3 mode verified deep S3 cycles; loopback passes after resume. The rework preserved the validated tree byte for byte (verified by diff), so the results carry over.
Please use a rebase merge, not a squash.