[PATCH v1 1/6] ASoC: codecs: rk3308: restore MICBIAS voltage after reset

From: Xing Zheng

Date: Sun Nov 01 2026 - 00:02:14 EST


The platform probe programs the requested MICBIAS voltage before
registering the component. The component probe subsequently resets the
codec, losing that setting before capture starts.

Cache the validated voltage selector and apply it during component
initialization after reset. Keep the reset selector when the property is
absent.

Fixes: 4ed0915f5bc4 ("ASoC: codecs: Add RK3308 internal audio codec driver")
Signed-off-by: Xing Zheng <zhengxing@xxxxxxxxxxxxxx>
---
sound/soc/codecs/rk3308_codec.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c
index a3d41cd8150d..7a18ff45e391 100644
--- a/sound/soc/codecs/rk3308_codec.c
+++ b/sound/soc/codecs/rk3308_codec.c
@@ -46,6 +46,7 @@ struct rk3308_codec_priv {
struct clk *mclk_tx;
struct snd_soc_component *component;
unsigned char codec_ver;
+ u32 micbias_level;
};

static struct clk_bulk_data rk3308_codec_clocks[] = {
@@ -840,6 +841,10 @@ static int rk3308_codec_initialize(struct rk3308_codec_priv *rk3308)
{
int grp;

+ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0),
+ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK,
+ rk3308->micbias_level);
+
/*
* Init ADC digital vol to 0 dB (reset value is 0xff, undocumented).
* Range: -97dB ~ +32dB.
@@ -997,9 +1002,8 @@ static int rk3308_codec_set_micbias_level(struct rk3308_codec_priv *rk3308)
"Invalid value %u for 'rockchip,micbias-avdd-percent'\n",
percent);

- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0),
- RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK,
- mult << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT);
+ /* The component probe resets the codec after this property is parsed. */
+ rk3308->micbias_level = mult << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT;

return 0;
}