Skip to content

Commit df8ce73

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 5a1483f commit df8ce73

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
@@ -113,9 +113,7 @@ static void resume_dais(void)
113113
struct dai_data *dd;
114114

115115
#if CONFIG_INTEL_ADSP_MIC_PRIVACY
116-
/* Re-initialize mic privacy manager first to ensure proper state
117-
* before DAI resume
118-
*/
116+
/* Re-initialize mic privacy manager first to ensure proper state before DAI resume */
119117
mic_privacy_manager_init();
120118
#endif
121119

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

0 commit comments

Comments
 (0)