ASoC: rt5682s: Enable ASRC auto-disable to fix pop during jack plug-in while playback

When codec's ASRC was enabled, the DA and AD filters use
the reference clk which tracks the I2S clks.
And if the I2S clks' timing of open and close are not expected,
this patch allows the filters to switch to use sysclk if
ASRC's ref clks disappeared and could fix the below possible issues:
1. Avoid DA filter to keep surplus samples.
2. Avoid that AD filter works failed during dapm's power on.

For example,
if I2S clks were closed before dacdat during playback off
due to jack unplug, it causes ref clks disappeared and
DA filter remained some samples which will produce pop noise
on the next HP playback.
ASRC auto-disable could clear the samples during the playback off.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211001074113.2223-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Derek Fang 2021-10-01 15:41:12 +08:00 committed by Mark Brown
parent bd8bec1408
commit 04a8374c32
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
2 changed files with 16 additions and 0 deletions

View file

@ -1061,6 +1061,9 @@ int rt5682s_sel_asrc_clk_src(struct snd_soc_component *component,
RT5682S_FILTER_CLK_SEL_MASK, clk_src << RT5682S_FILTER_CLK_SEL_SFT);
}
snd_soc_component_update_bits(component, RT5682S_PLL_TRACK_11,
RT5682S_ASRCIN_AUTO_CLKOUT_MASK, RT5682S_ASRCIN_AUTO_CLKOUT_EN);
return 0;
}
EXPORT_SYMBOL_GPL(rt5682s_sel_asrc_clk_src);

View file

@ -994,6 +994,19 @@
#define RT5682S_ASRCIN_FTK_M2_MASK (0x7 << 4)
#define RT5682S_ASRCIN_FTK_M2_SFT 4
/* ASRC Control 11 (0x008c) */
#define RT5682S_ASRCIN_AUTO_CLKOUT_MASK (0x1 << 5)
#define RT5682S_ASRCIN_AUTO_CLKOUT_EN (0x1 << 5)
#define RT5682S_ASRCIN_AUTO_CLKOUT_DIS (0x0 << 5)
#define RT5682S_ASRCIN_AUTO_RST_MASK (0x1 << 4)
#define RT5682S_ASRCIN_AUTO_RST_EN (0x1 << 4)
#define RT5682S_ASRCIN_AUTO_RST_DIS (0x0 << 4)
#define RT5682S_SEL_LRCK_DET_MASK (0x3)
#define RT5682S_SEL_LRCK_DET_DIV8 (0x3)
#define RT5682S_SEL_LRCK_DET_DIV4 (0x2)
#define RT5682S_SEL_LRCK_DET_DIV2 (0x1)
#define RT5682S_SEL_LRCK_DET_DIV1 (0x0)
/* Depop Mode Control 1 (0x008e) */
#define RT5682S_OUT_HP_L_EN (0x1 << 6)
#define RT5682S_OUT_HP_R_EN (0x1 << 5)