From 69adc7f1a90aeb00237b1002f813b7a8e71e17c4 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Tue, 23 Jul 2024 11:44:59 +0800 Subject: [PATCH] ASoC: codecs: rk3506: set AUDIO_ADC_PGA0 to get better THD performance Before: THD is -91.34dB. After: THD is -103.13dB. Change-Id: Ieaf326326a36ca320effcd924825dce33c5775fc Signed-off-by: Jason Zhu --- sound/soc/codecs/rk3506_codec.c | 3 +++ sound/soc/codecs/rk3506_codec.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/sound/soc/codecs/rk3506_codec.c b/sound/soc/codecs/rk3506_codec.c index 8b36a6570b5f..7c8cec32e4e2 100644 --- a/sound/soc/codecs/rk3506_codec.c +++ b/sound/soc/codecs/rk3506_codec.c @@ -164,6 +164,9 @@ static int rk3506_codec_reset(struct snd_soc_component *component) snd_soc_component_update_bits(component, AUDIO_ADC_PGA2, PGA_BUF_IB_SEL_MSK | PGA_BUF_CHOP_SEL_MSK, PGA_BUF_IB_SEL_167_PCT | PGA_BUF_CHOP_SEL_400K); + snd_soc_component_update_bits(component, AUDIO_ADC_PGA0, + PGA_INPUT_DEC_MSK | PGA_GAIN_MASK, + PGA_INPUT_DEC_N4_34DB | PGA_GAIN_3DB); clk_disable_unprepare(rk3506->pclk); diff --git a/sound/soc/codecs/rk3506_codec.h b/sound/soc/codecs/rk3506_codec.h index 709c7a6c4cf2..d036aa863c18 100644 --- a/sound/soc/codecs/rk3506_codec.h +++ b/sound/soc/codecs/rk3506_codec.h @@ -153,6 +153,8 @@ #define PGA_INPUT_DEC_N7_34DB (0x2 << 1) #define PGA_INPUT_DEC_N10_34DB (0x3 << 1) #define PGA_GAIN_SHIFT (0x3) +#define PGA_GAIN_MASK (0x1f << PGA_GAIN_SHIFT) +#define PGA_GAIN_3DB (0x10 << PGA_GAIN_SHIFT) #define PGA_GAIN_MIN (0x0) #define PGA_GAIN_MAX (0x1f)