From 572fd2583806afd9217ca1247017527fbe757bae Mon Sep 17 00:00:00 2001 From: Shazmaan Ali Date: Mon, 14 Mar 2022 15:35:54 -0700 Subject: [PATCH] asoc: codecs: Add Idle detect source select condition Use LEGACY source if any of the below use cases is met: EAR, PBR OFF, IDLE, NG2 and PA GAIN <= 13.5dB Use PRE-LA when: All other cases Change-Id: Iace0c1f6fea367a73cd604b958bd5c8905d29509 Signed-off-by: Shazmaan Ali --- asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c b/asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c index 5f3cc1ebf1..be1b941ff9 100644 --- a/asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c +++ b/asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c @@ -1813,6 +1813,7 @@ static void lpass_cdc_macro_idle_detect_control(struct snd_soc_component *compon int interp, int event) { int reg = 0, mask = 0, val = 0, source_reg = 0; + u16 mode = 0; if (!wsa_priv->idle_detect_cfg.idle_detect_en) return; @@ -1830,10 +1831,14 @@ static void lpass_cdc_macro_idle_detect_control(struct snd_soc_component *compon val = 0x02; } - if (wsa_priv->noise_gate_mode == NG2) - snd_soc_component_update_bits(component, source_reg, 0x80, 0x80); - else + mode = wsa_priv->comp_mode[interp]; + + if ((wsa_priv->noise_gate_mode == NG2 && mode >= G_13P5_DB) || + wsa_priv->noise_gate_mode == IDLE_DETECT || !wsa_priv->pbr_enable || + wsa_priv->wsa_spkrrecv) snd_soc_component_update_bits(component, source_reg, 0x80, 0x00); + else + snd_soc_component_update_bits(component, source_reg, 0x80, 0x80); if (reg && SND_SOC_DAPM_EVENT_ON(event)) snd_soc_component_update_bits(component, reg, mask, val);