Skip to content

Commit faf7a3b

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 a760faa commit faf7a3b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

zephyr/lib/cpu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ static void resume_dais(void)
137137
/* Update privacy settings based on saved state */
138138
mic_privacy_fill_settings(&settings, MIC_PRIV_MUTED);
139139
mic_privacy_propagate_settings(&settings);
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+
140149
/* Re-enable DMIC IRQ to handle further privacy state changes */
141150
mic_privacy_enable_dmic_irq(true);
142151
mic_privacy_enabled = false;

0 commit comments

Comments
 (0)