Skip to content

Commit 9b52ed5

Browse files
committed
audio: mic_privacy: Fix fade effect in audio after D3 resume
When resuming from D3 state with microphone privacy enabled, a short fade-out effect appears in the audio stream instead of immediate silence. This causes test failures in mic privacy validation tests that expect complete silence when privacy is enabled. The issue occurs because fade parameters aren't properly reset after D3 transitions. This patch fixes the issue by explicitly resetting all fade parameters during resume from D3: - Set mic_privacy_state directly to MIC_PRIV_MUTED to avoid fade effects - Reset fade_in_out_bytes, gain_env and fade_in_sg_count parameters - Add validation checks to ensure the mic_priv structure is valid With these changes, the audio stream properly transitions to silence without fade artifacts when privacy is enabled after D3 resume. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent 4825dba commit 9b52ed5

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

zephyr/lib/cpu.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ static void resume_dais(void)
111111
struct dai_data *dd;
112112

113113
#if CONFIG_INTEL_ADSP_MIC_PRIVACY
114-
/* Re-initialize mic privacy manager first to ensure proper state
115-
* before DAI resume
116-
*/
114+
/* Re-initialize mic privacy manager first to ensure proper state before DAI resume */
117115
mic_privacy_manager_init();
118116
#endif
119117

@@ -139,7 +137,16 @@ static void resume_dais(void)
139137
/* Update privacy settings based on saved state */
140138
mic_privacy_fill_settings(&settings, MIC_PRIV_MUTED);
141139
mic_privacy_propagate_settings(&settings);
142-
/* Re-enable DMIC IRQ to handle further privacy state changes */
140+
/* Ensure we're starting from a clean state with no fade effects */
141+
if (cd->mic_priv->mic_privacy_state) {
142+
/* Force immediate mute without fade effect */
143+
cd->mic_priv->mic_privacy_state = MIC_PRIV_MUTED;
144+
cd->mic_priv->fade_in_out_bytes = 0;
145+
cd->mic_priv->mic_priv_gain_params.gain_env = 0;
146+
cd->mic_priv->mic_priv_gain_params.fade_in_sg_count = 0;
147+
}
148+
149+
/* Re-enable MIC IRQ to handle further privacy state changes */
143150
mic_privacy_enable_dmic_irq(true);
144151
mic_privacy_enabled = false;
145152
tr_dbg(&zephyr_tr, "DMIC privacy settings restored after D3");

0 commit comments

Comments
 (0)