build/patch/kernel/archive/sunxi-6.4/patches.megous/ASoC-rockchip-Fix-doubling-of-playback-speed-after-system-sleep.patch

47 lines
1.5 KiB
Diff
Raw Normal View History

From 4ed0a3eb350fb629c9bdd06a79790c4af77e6409 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Mon, 15 Aug 2022 02:23:37 +0200
Subject: [PATCH 374/469] ASoC: rockchip: Fix doubling of playback speed after
system sleep
There is some issue with CRU on RK3399 that can be reproduced by:
- playing some audio and stopping the playback (so that runtime PM suspends I2S)
- putting system to deep sleep and resuming it (using mainline TF-A)
- playing some audio (audio plays at 2x the normal speed)
If the audio is kept playing during system sleep cycle, the issue
does not manifest. Relevant registers in CRU are identical in bug/
no-bug scenarios, so this patch is just touching the CRU registers
without actually changing anything in the end. Touching the registers
fixes the playback speed, though.
Inspired by: https://github.com/djselbeck/linux/commit/cb4be5dec3fa18c4b344c11fed3fc57aa3bea424
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
sound/soc/rockchip/rockchip_i2s.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 575a0b9b01e9..aff3d9a21cf7 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -115,6 +115,13 @@ static int i2s_runtime_resume(struct device *dev)
if (ret)
clk_disable_unprepare(i2s->mclk);
+ if (ret == 0) {
+ unsigned long rate = clk_get_rate(i2s->mclk);
+
+ clk_set_rate(i2s->mclk, rate - 1);
+ clk_set_rate(i2s->mclk, rate);
+ }
+
return ret;
}
--
2.34.1