[PATCH v2 2/6] ASoC: renesas: fsi: Fix hang by enabling SPU clock
From: phucduc . bui
Date: Mon Apr 13 2026 - 06:14:34 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Enable/disable the shared SPU clock in hw startup/shutdown. Without this,
accessing FSI registers may hang the system.
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
Changes in v2:
- Move SPU clock enable/disable handling from fsi_dai_startup/shutdown
to fsi_hw_startup/shutdown
sound/soc/renesas/fsi.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c
index 196ec7bac33d..109e06b5f32d 100644
--- a/sound/soc/renesas/fsi.c
+++ b/sound/soc/renesas/fsi.c
@@ -1492,6 +1492,18 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
struct device *dev)
{
u32 data = 0;
+ int ret = 0;
+ /* enable spu clock */
+ mutex_lock(&fsi->master->clk_lock);
+ if (fsi->master->clk_spu && fsi->master->spu_count++ == 0) {
+ ret = clk_prepare_enable(fsi->master->clk_spu);
+ if (ret < 0) {
+ fsi->master->spu_count--;
+ mutex_unlock(&fsi->master->clk_lock);
+ return ret;
+ }
+ }
+ mutex_unlock(&fsi->master->clk_lock);
/* clock setting */
if (fsi_is_clk_master(fsi))
@@ -1549,6 +1561,11 @@ static int fsi_hw_shutdown(struct fsi_priv *fsi,
/* stop master clock */
if (fsi_is_clk_master(fsi))
return fsi_clk_disable(dev, fsi);
+ /* stop spu clock */
+ mutex_lock(&fsi->master->clk_lock);
+ if (fsi->master->clk_spu && --fsi->master->spu_count == 0)
+ clk_disable_unprepare(fsi->master->clk_spu);
+ mutex_unlock(&fsi->master->clk_lock);
return 0;
}
--
2.43.0