[PATCH v4 10/10] ASoC: renesas: fsi: Add SPU clock control in hw_startup/shutdown
From: phucduc . bui
Date: Fri Jun 05 2026 - 08:38:07 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Enable and disable the SPU clock in fsi_hw_startup() and
fsi_hw_shutdown() to ensure the clock is active while the
driver accesses hardware registers.
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/renesas/fsi.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c
index 6537321242c0..d7cc5a14a099 100644
--- a/sound/soc/renesas/fsi.c
+++ b/sound/soc/renesas/fsi.c
@@ -1585,6 +1585,19 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
struct device *dev)
{
u32 data = 0;
+ int ret;
+
+ /* enable spu clock */
+ if (fsi->master->clk_spu) {
+ scoped_guard(spinlock_irqsave, &fsi->master->lock) {
+ if (fsi->master->spu_count == 0) {
+ ret = clk_enable(fsi->master->clk_spu);
+ if (ret < 0)
+ return ret;
+ }
+ fsi->master->spu_count++;
+ }
+ }
/* clock setting */
if (fsi_is_clk_master(fsi))
@@ -1642,6 +1655,12 @@ static int fsi_hw_shutdown(struct fsi_priv *fsi,
/* stop master clock */
if (fsi_is_clk_master(fsi))
return fsi_clk_disable(dev, fsi);
+ if (fsi->master->clk_spu) {
+ scoped_guard(spinlock_irqsave, &fsi->master->lock) {
+ if (--fsi->master->spu_count == 0)
+ clk_disable(fsi->master->clk_spu);
+ }
+ }
return 0;
}
--
2.43.0