Skip to content

Commit adbcf54

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 9ee7789 commit adbcf54

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

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

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

0 commit comments

Comments
 (0)