Skip to content

audio: mic privacy: do not read the DMIC registers at boot - #11594

Open
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/mic-privacy-boot-fix
Open

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/mic-privacy-boot-fix

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Fix for the firmware not booting on PTL devices that use the HW_MANAGED mic privacy policy, after #11503 (bfa5201, "audio: mic privacy: start a copier muted when the mic is muted").

The bug

bfa5201 posts the mic privacy state from mic_privacy_manager_init(). That function runs at boot from platform_init(), and again on D3 exit from resume_dais().

  • HW_MANAGED: reading the state means reading DMICXPVCCS (0x16010) in the DMIC VSS block. The DSP can't access that block until a DMIC DAI is probed, which powers the link through hub_ulp_domain (DMICLCTL SPA/CPA) and claims it (OSEL). Before that, the read takes a load/store error exception (EXCCAUSE 13) during boot, and the driver reports failed to boot DSP firmware -110.
  • FW_MANAGED: the boot-time post only reads the always-on mic privacy registers (0x71a40/0x71a46), so it doesn't crash. But it still adds accesses to boot and D3 exit.
  • No policy: unaffected. That's why boards without a mic privacy policy boot fine.

Before #11503, the DMIC VSS registers were only accessed from copier configure, in mic_privacy_enable_dmic_irq(), after the DMIC copier created and probed its DAI.

The default Linux build for PTL and WCL is not affected: it enables SOF_USERSPACE_LL, and INTEL_ADSP_MIC_PRIVACY depends on !SOF_USERSPACE_LL. Builds without LL user space, such as those using app/internal_ci_overlay.conf, are affected.

The fix

  • Boot and D3 exit: drop the boot-time post from mic_privacy_manager_init(). Boot and D3 exit then access the mic privacy registers exactly as they did before kernel/user partition, Phase 5 part 2: mic privacy state without the notifier #11503, for every policy.
  • Copier configure: a copier now reads the current state when it configures mic privacy, using the new mic_privacy_get_copier_mic_disable_status():
    • FW_MANAGED: the FW-managed mic disable status, in the always-on mic privacy registers.
    • HW_MANAGED: the DMIC mic disable status, in DMIC copiers only. By the time they configure mic privacy, they've probed their DAI, and mic_privacy_enable_dmic_irq() has already accessed the same register. This adds one read of a register the function was already using, and no writes.
    • Other copiers, and the other policies, start from the last state posted, as on main.
    • So that those copiers also get the state, a HW_MANAGED DMIC copier posts the state it reads if it differs from the last one posted. The post is a compare-and-swap against the word read before the register, so it never overwrites a newer state the DMIC interrupt posted in between. Running copiers take it at their next copy.
    • With no DMIC DAI probed, a non-DMIC copier on HW_MANAGED still starts from the last state posted, as before kernel/user partition, Phase 5 part 2: mic privacy state without the notifier #11503. The DMIC registers can't be read then, and the kernel only sends the SoundWire state on a change. The hardware still zeroes the DMA data of the links selected in DDZLS, so only the copier's own fade is missing until the next change.
  • Order: the copier records the sequence number before it reads the state, so a change in between is taken at its next copy.
  • Ramp time: it comes from the DDZWT value the copier already reads in configure.

The behaviour from #11503 is unchanged: a capture started while the mic is muted starts muted.

Testing

  • Reproduced the exception: on a PTL board with no mic privacy policy, I forced the same DMICXPVCCS read at mic_privacy_manager_init() in a test-only build. The DSP panicked during boot (EXCCAUSE 13), and the PC resolved to the sys_read32() in mic_privacy_get_dmic_mic_disable_status().
  • Hardware, PTL, no policy: xt-clang build with internal_ci_overlay.conf and CONFIG_ASSERT=y, on sof-hda-generic.tplg:
    • Boots.
    • Playback at 48k S16/S24/S32 and 44.1k, deepbuffer, and analog capture S16/S32.
    • Full duplex, concurrent playback, and 10x start/stop.
    • 3x runtime D3 suspend/resume with playback, and 5x D3 suspend/resume with capture.
    • All pass, with no DSP errors or asserts.
  • Builds: PTL and WCL, Zephyr SDK gcc, default and with internal_ci_overlay.conf; PTL and WCL, xt-clang, with internal_ci_overlay.conf.
  • Not tested: a board with the HW_MANAGED or FW_MANAGED policy. It needs a run on one of the boards that fail to boot on main.

🤖 Generated with Claude Code

@lgirdwood
lgirdwood marked this pull request as ready for review December 2, 2026 14:43
Copilot AI balanced review requested due to automatic review settings December 2, 2026 14:43
@lgirdwood

Copy link
Copy Markdown
Member Author

@lrudyX lets give this a run in CI as 1st step then if good we can do the copilot review cleanups.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uninitialized privacy-state fallback can leave non-DMIC capture unmuted despite active HW_MANAGED privacy until a later IRQ/IPC update.

1 open issue
What changed in this PR

Fixes the PTL boot regression from #11503 by deferring microphone privacy status reads until copier configuration, when DMIC registers are accessible.

Changes:

  • Removes initial state posting during boot and D3 exit.
  • Adds policy-aware status reads during copier configuration.
  • Reuses the configured zeroing wait time for ramp timing.
File Description
src/​kernel/​audio/​mic_privacy_manager/​mic_privacy_manager_intel.c Removes startup posting and adds a copier-specific status getter.
src/​include/​sof/​audio/​mic_privacy_manager.h Declares the new status getter.
src/​audio/​copier/​copier.c Initializes mute state during configuration and reuses ramp timing.

Review effort: Balanced

Comment thread src/audio/copier/copier.c
Comment on lines +128 to +129
if (muted < 0)
muted = MIC_PRIV_STATE_MUTE(word);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f07e754. With HW_MANAGED, a DMIC copier now posts the state it reads from DMICXPVCCS if it differs from the last state posted. The post is a compare-and-swap against the word read before the register, so it never overwrites a newer state that the DMIC interrupt posted in between. Non-DMIC copiers configured after it start from that state, and running copiers take it at their next copy.

With no DMIC DAI probed, there is nothing safe to read: DMICXPVCCS can't be accessed then, and the kernel only sends the SoundWire state on a change (sof_ptl_mic_privacy_work()). So a non-DMIC copier still starts from the last state posted, the same as before #11503. The mic data is still not exposed in that case: with HW_MANAGED, the hardware zeroes the DMA data of the links selected in DDZLS by itself after the DDZWT time-out. Only the copier's own fade is missing until the next change.

The always-on DFMICPVCS.MDIO (the privacy indicator output) could be a starting state with no DMIC. But the Zephyr driver has no getter for it, and its timing under HW_MANAGED needs checking on a device with that policy, so I've left it for a follow-up.

@intel-sofci

intel-sofci commented Dec 2, 2026 •

Copy link
Copy Markdown

PR 11594: test results

Run date: 2026-12-02 22:04 UTC

Tested commit: f07e754c56c9f8185d97c5f80995579db24d605a

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

Commit bfa5201 ("audio: mic privacy: start a copier muted when the
mic is muted") posts the mic privacy state from
mic_privacy_manager_init(), which runs at boot and on D3 exit. With the
HW_MANAGED policy, the state is in DMICXPVCCS, in the DMIC VSS block,
which the DSP can not access until a DMIC DAI is probed. The read takes
a load/store error exception and the firmware does not boot on PTL
devices with that policy.

Restore the boot and D3 exit accesses to the mic privacy registers from
before that commit, and read the state where a copier configures mic
privacy instead:

- FW_MANAGED: the FW managed mic disable status, in the always-on mic
  privacy registers.
- HW_MANAGED: the DMIC mic disable status, only in DMIC copiers, which
  have probed their DAI by then. The other copiers start from the last
  state posted, so a DMIC copier also posts the state it reads when it
  is not the last state posted, unless a state was posted while it read
  it.

The copier takes the sequence number before it reads the state, so that
a change in between is taken at its next copy, and takes its ramp time
from the DDZWT value it already reads.

Fixes: bfa5201 ("audio: mic privacy: start a copier muted when the mic is muted")
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/mic-privacy-boot-fix branch from 001b193 to f07e754 Compare December 2, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants