-
Notifications
You must be signed in to change notification settings - Fork 349
audio: mic_privacy: Fix incorrect state after D3 exit #10035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audio: mic_privacy: Fix incorrect state after D3 exit #10035
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request addresses two issues with the microphone privacy feature during D3 transitions by re-establishing correct state handling on resume and eliminating unwanted audio fade effects.
- Re-initializes the mic privacy manager and saves/restores privacy settings during D3 transitions.
- Eliminates fade effects by forcefully setting the mic privacy state to MUTED in the resume routine.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| zephyr/lib/cpu.c | Updates state handling for mic privacy during D3 suspend/resume and re-enables IRQs post-resume. |
| src/audio/mic_privacy_manager/mic_privacy_manager_intel.c | Enhances DMIC IRQ handling and restores settings during initialization after D3 transitions. |
adbcf54 to
d10c58f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issues with microphone privacy during D3 state transitions by re-establishing proper privacy settings and eliminating fade artifacts during resume. Key changes include re-initializing the mic privacy manager on resume, restoring MIC privacy settings without fade effects, and updating the DMIC IRQ handling logic.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| zephyr/lib/cpu.c | Added logic to save and restore MIC privacy settings during D3. |
| src/audio/mic_privacy_manager/mic_privacy_manager_intel.c | Enhanced IRQ handling by adding device/API checks and adjusting disable logic. |
Comments suppressed due to low confidence (1)
src/audio/mic_privacy_manager/mic_privacy_manager_intel.c:85
- When disabling the DMIC IRQ, if get_dmic_irq_status() returns false, there is no call to explicitly disable the IRQ. Consider adding a call to mic_privacy_api->enable_dmic_irq(false, NULL) to ensure the IRQ is disabled in all cases.
else { /* Check current status immediately to handle any transitions during D3 */
d10c58f to
9b52ed5
Compare
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor notes, but no blockers.
| /* Ensure we're starting from a clean state with no fade effects */ | ||
| if (cd->mic_priv->mic_privacy_state) { | ||
| /* Force immediate mute without fade effect */ | ||
| cd->mic_priv->mic_privacy_state = MIC_PRIV_MUTED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if FW went to D3 during fade in? Previous state was MIC_PRIV_FADE_IN, expected to be unmuted soon, but here we force mute. there will be state mismatch. I recommend reading mic state directly from HW
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fragment is only intended to eliminate the fade-out effect. In the case when mic privacy was turned off during D3, fade-in is still present (at least that's how the audio behaves in the test).
9b52ed5 to
faf7a3b
Compare
| else | ||
|
|
||
| /* Check current status immediately to handle any transitions during D3 */ | ||
| if (mic_privacy_api->get_dmic_irq_status()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have interrupts disabled at cpu level here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
When resuming from D3 state, the microphone privacy feature wasn't properly restored, causing two critical issues: 1. The system didn't respond to privacy button inputs after D3 transitions 2. A short fade-out effect appeared in audio when privacy was enabled, causing test failures that expected complete silence This patch provides a comprehensive solution by: - Adding mic_privacy_manager_init() to resume_dais() to ensure proper re-initialization of the microphone privacy subsystem after D3 - Implementing mic_privacy_get_mic_disable_status() to correctly retrieve the current microphone disable status - Storing the mic_disable_status before entering D3 and comparing it after resume to detect changes during low power state - Enhancing mic_privacy_enable_dmic_irq() to immediately check for IRQ status after D3 transitions to catch events that occurred during suspended state - Explicitly resetting fade parameters (fade_in_out_bytes, gain parameters) to ensure immediate silence without fade artifacts when privacy is enabled - Adding proper error handling and validation to ensure the mic_priv structure is valid before access With these changes, the microphone privacy feature works correctly through power state transitions and properly mutes audio without fade artifacts when privacy is enabled after D3 resume. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
faf7a3b to
9479454
Compare
This PR fixes two issues with the microphone privacy feature during D3 state transitions:
Re-establishes proper microphone privacy functionality after D3 resume by:
mic_privacy_managerin theresume_dais()functionEliminates unwanted fade effect in audio when resuming from D3 with privacy enabled by:
mic_privacy_statetoMUTEDwithout fade effectsThese changes ensure microphone privacy works reliably through power state transitions and correctly mutes audio without any fade artifacts when privacy is enabled.