Skip to content

Commit 37aba31

Browse files
shumingfanbroonie
authored andcommitted
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
1 parent c1f848f commit 37aba31

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sound/soc/codecs/rt1308-sdw.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static bool rt1308_volatile_register(struct device *dev, unsigned int reg)
5252
case 0x300a:
5353
case 0xc000:
5454
case 0xc710:
55+
case 0xcf01:
5556
case 0xc860 ... 0xc863:
5657
case 0xc870 ... 0xc873:
5758
return true;
@@ -213,7 +214,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
213214
{
214215
struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
215216
int ret = 0;
216-
unsigned int tmp;
217+
unsigned int tmp, hibernation_flag;
217218

218219
if (rt1308->hw_init)
219220
return 0;
@@ -242,6 +243,10 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
242243

243244
pm_runtime_get_noresume(&slave->dev);
244245

246+
regmap_read(rt1308->regmap, 0xcf01, &hibernation_flag);
247+
if ((hibernation_flag != 0x00) && rt1308->first_hw_init)
248+
goto _preset_ready_;
249+
245250
/* sw reset */
246251
regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0);
247252

@@ -282,6 +287,12 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
282287
regmap_write(rt1308->regmap, 0xc100, 0xd7);
283288
regmap_write(rt1308->regmap, 0xc101, 0xd7);
284289

290+
/* apply BQ params */
291+
rt1308_apply_bq_params(rt1308);
292+
293+
regmap_write(rt1308->regmap, 0xcf01, 0x01);
294+
295+
_preset_ready_:
285296
if (rt1308->first_hw_init) {
286297
regcache_cache_bypass(rt1308->regmap, false);
287298
regcache_mark_dirty(rt1308->regmap);

0 commit comments

Comments
 (0)