From b1773149c4e1ebf559f08bf0a590750b575042e9 Mon Sep 17 00:00:00 2001 From: Binyuan Lan Date: Tue, 11 Jul 2023 03:25:50 +0000 Subject: [PATCH] ASoC: rockchip: rk817-codec: Solve pop problems cause by re-configure APLL SMIC TudorAG and previous versions: During playback, a POP sound occurs when the recording is opened. This patch is intended to fix this issue. Change-Id: I86f79cd531738113092723e1ef198b093ae472b9 Signed-off-by: Binyuan Lan --- sound/soc/codecs/rk817_codec.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c index a334f763224a..c178da3e52a2 100644 --- a/sound/soc/codecs/rk817_codec.c +++ b/sound/soc/codecs/rk817_codec.c @@ -286,10 +286,10 @@ static struct rk817_reg_val_typ playback_power_up_list[] = { {RK817_CODEC_AREF_RTCFG1, 0x40}, {RK817_CODEC_DDAC_POPD_DACST, 0x02}, /* APLL */ - {RK817_CODEC_APLL_CFG0, 0x04}, + /* {RK817_CODEC_APLL_CFG0, 0x04}, */ {RK817_CODEC_APLL_CFG1, 0x58}, {RK817_CODEC_APLL_CFG2, 0x2d}, - {RK817_CODEC_APLL_CFG4, 0xa5}, + /* {RK817_CODEC_APLL_CFG4, 0xa5}, */ {RK817_CODEC_APLL_CFG5, 0x00}, {RK817_CODEC_DI2S_RXCMD_TSD, 0x00}, @@ -324,10 +324,10 @@ static struct rk817_reg_val_typ capture_power_up_list[] = { {RK817_CODEC_AREF_RTCFG1, 0x40}, {RK817_CODEC_DADC_SR_ACL0, 0x02}, /* {RK817_CODEC_DTOP_DIGEN_CLKE, 0xff}, */ - {RK817_CODEC_APLL_CFG0, 0x04}, + /* {RK817_CODEC_APLL_CFG0, 0x04}, */ {RK817_CODEC_APLL_CFG1, 0x58}, {RK817_CODEC_APLL_CFG2, 0x2d}, - {RK817_CODEC_APLL_CFG4, 0xa5}, + /* {RK817_CODEC_APLL_CFG4, 0xa5}, */ {RK817_CODEC_APLL_CFG5, 0x00}, /*{RK817_CODEC_DI2S_RXCMD_TSD, 0x00},*/ @@ -378,12 +378,16 @@ static int rk817_codec_power_up(struct snd_soc_component *component, int type) playback_power_up_list[i].value); } - /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */ + /* configure APLL CFG0/4 */ if (rk817->chip_ver <= 0x4) { DBG("%s (%d): SMIC TudorAG and previous versions\n", __func__, __LINE__); snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c); snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95); + } else { + DBG("%s: SMIC TudorAG version later\n", __func__); + snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04); + snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5); } snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, @@ -405,12 +409,16 @@ static int rk817_codec_power_up(struct snd_soc_component *component, int type) capture_power_up_list[i].value); } - /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */ + /* configure APLL CFG0/4 */ if (rk817->chip_ver <= 0x4) { DBG("%s (%d): SMIC TudorAG and previous versions\n", __func__, __LINE__); snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c); snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95); + } else { + DBG("%s: SMIC TudorAG version later\n", __func__); + snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04); + snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5); } snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE,