diff options
author | Shuming Fan <shumingf@realtek.com> | 2023-08-11 11:38:22 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-08-13 19:16:32 +0200 |
commit | 37aba3190891d4de189bd5192ee95220e295f34d (patch) | |
tree | 1f63263c98ac295958a193cd2d6b1533f6367659 /sound/soc/codecs/rt1308-sdw.c | |
parent | ASoC: meson: axg-tdm-formatter: fix channel slot allocation (diff) | |
download | linux-37aba3190891d4de189bd5192ee95220e295f34d.tar.xz linux-37aba3190891d4de189bd5192ee95220e295f34d.zip |
ASoC: rt1308-sdw: fix random louder sound
This patch uses a vendor register to check whether the system hibernated ever.
The driver will only set the preset when the driver brings up or the system hibernated.
It will avoid the unknown issue that makes the speaker output louder and can't control the volume.
Signed-off-by: Shuming Fan <shumingf@realtek.com
Link: https://lore.kernel.org/r/20230811093822.37573-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org
Diffstat (limited to 'sound/soc/codecs/rt1308-sdw.c')
-rw-r--r-- | sound/soc/codecs/rt1308-sdw.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index f43520ca3187..e566c8ddd3e9 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -52,6 +52,7 @@ static bool rt1308_volatile_register(struct device *dev, unsigned int reg) case 0x300a: case 0xc000: case 0xc710: + case 0xcf01: case 0xc860 ... 0xc863: case 0xc870 ... 0xc873: return true; @@ -213,7 +214,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) { struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev); int ret = 0; - unsigned int tmp; + unsigned int tmp, hibernation_flag; if (rt1308->hw_init) return 0; @@ -242,6 +243,10 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) pm_runtime_get_noresume(&slave->dev); + regmap_read(rt1308->regmap, 0xcf01, &hibernation_flag); + if ((hibernation_flag != 0x00) && rt1308->first_hw_init) + goto _preset_ready_; + /* sw reset */ regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0); @@ -282,6 +287,12 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave) regmap_write(rt1308->regmap, 0xc100, 0xd7); regmap_write(rt1308->regmap, 0xc101, 0xd7); + /* apply BQ params */ + rt1308_apply_bq_params(rt1308); + + regmap_write(rt1308->regmap, 0xcf01, 0x01); + +_preset_ready_: if (rt1308->first_hw_init) { regcache_cache_bypass(rt1308->regmap, false); regcache_mark_dirty(rt1308->regmap); |