]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: rsnd: Add reset controller support to rsnd_mod
authorJohn Madieu <john.madieu.xa@bp.renesas.com>
Mon, 25 May 2026 11:02:15 +0000 (11:02 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 1 Jun 2026 14:30:13 +0000 (15:30 +0100)
The RZ/G3E SoC requires per-module reset control for the audio subsystem.
Add reset controller support to struct rsnd_mod and update rsnd_mod_init()
to accept and handle a reset_control parameter and mirror it in
rsnd_mod_quit().

Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20260525110230.4014435-4-john.madieu.xa@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/renesas/rcar/adg.c
sound/soc/renesas/rcar/cmd.c
sound/soc/renesas/rcar/core.c
sound/soc/renesas/rcar/ctu.c
sound/soc/renesas/rcar/dma.c
sound/soc/renesas/rcar/dvc.c
sound/soc/renesas/rcar/mix.c
sound/soc/renesas/rcar/rsnd.h
sound/soc/renesas/rcar/src.c
sound/soc/renesas/rcar/ssi.c
sound/soc/renesas/rcar/ssiu.c

index 8641b73d1f777034ff65031e48919528a6571545..0105c60a144e038d5a7a4dd9b7af4867a080c2dc 100644 (file)
@@ -780,7 +780,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
                return -ENOMEM;
 
        ret = rsnd_mod_init(priv, &adg->mod, &adg_ops,
-                     NULL, 0, 0);
+                     NULL, NULL, 0, 0);
        if (ret)
                return ret;
 
index 8d9a1e345a22c3ff9ead02fba771d7702040d50a..13beef3897978e9382be2ab7b7a5afc28b24c68c 100644 (file)
@@ -171,7 +171,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv)
 
        for_each_rsnd_cmd(cmd, priv, i) {
                int ret = rsnd_mod_init(priv, rsnd_mod_get(cmd),
-                                       &rsnd_cmd_ops, NULL,
+                                       &rsnd_cmd_ops, NULL, NULL,
                                        RSND_MOD_CMD, i);
                if (ret)
                        return ret;
index 2dc078358612d796de787d42c119eee87cdf9a7c..2038e3079a9a5b252ff35d4dc5195ab6ad5ae331 100644 (file)
@@ -196,18 +196,29 @@ int rsnd_mod_init(struct rsnd_priv *priv,
                  struct rsnd_mod *mod,
                  struct rsnd_mod_ops *ops,
                  struct clk *clk,
+                 struct reset_control *rstc,
                  enum rsnd_mod_type type,
                  int id)
 {
-       int ret = clk_prepare(clk);
+       int ret;
 
+       ret = clk_prepare_enable(clk);
        if (ret)
                return ret;
 
+       ret = reset_control_deassert(rstc);
+       if (ret) {
+               clk_disable_unprepare(clk);
+               return ret;
+       }
+
+       clk_disable(clk);
+
        mod->id         = id;
        mod->ops        = ops;
        mod->type       = type;
        mod->clk        = clk;
+       mod->rstc       = rstc;
        mod->priv       = priv;
 
        return 0;
@@ -215,6 +226,8 @@ int rsnd_mod_init(struct rsnd_priv *priv,
 
 void rsnd_mod_quit(struct rsnd_mod *mod)
 {
+       reset_control_assert(mod->rstc);
+       mod->rstc = NULL;
        clk_unprepare(mod->clk);
        mod->clk = NULL;
 }
index bd4c61f9fb3c3369dadc2f6ae043234b3e0d1e8d..81bba6a1af6e5c3f6f1a7c3c3e54506c367e2a78 100644 (file)
@@ -360,7 +360,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
                }
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
-                                   clk, RSND_MOD_CTU, i);
+                                   clk, NULL, RSND_MOD_CTU, i);
                if (ret)
                        goto rsnd_ctu_probe_done;
 
index 2035ce06fe4c4aeaa8620d817910a5319732fa58..68c859897e6831c0a24fde84c11fea48a052acab 100644 (file)
@@ -803,7 +803,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
 
        *dma_mod = rsnd_mod_get(dma);
 
-       ret = rsnd_mod_init(priv, *dma_mod, ops, NULL,
+       ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, NULL,
                            type, dma_id);
        if (ret < 0)
                return ret;
@@ -879,5 +879,5 @@ audmapp_end:
        priv->dma = dmac;
 
        /* dummy mem mod for debug */
-       return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, 0, 0);
+       return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, NULL, 0, 0);
 }
index 988cbddbc6114497a276f5ebbb1227fc1f6a6e63..bf7146ceb5f62181d5f7bf66e3f039a9d0c0c4c0 100644 (file)
@@ -364,7 +364,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
                }
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops,
-                                   clk, RSND_MOD_DVC, i);
+                                   clk, NULL, RSND_MOD_DVC, i);
                if (ret)
                        goto rsnd_dvc_probe_done;
 
index aea74e7033051d27c08121a1ae29882e5bdfa860..566e9b2a488cdf3bf2bd3a0ad18369e8ab7d1347 100644 (file)
@@ -328,7 +328,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
                }
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops,
-                                   clk, RSND_MOD_MIX, i);
+                                   clk, NULL, RSND_MOD_MIX, i);
                if (ret)
                        goto rsnd_mix_probe_done;
 
index 3e666125959b47e98446910bebff958d3840f006..3d419b31cf405ac501afe9e0ae1daa5cf924c537 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/reset.h>
 #include <linux/sh_dma.h>
 #include <linux/workqueue.h>
 #include <sound/soc.h>
@@ -353,6 +354,7 @@ struct rsnd_mod {
        struct rsnd_mod_ops *ops;
        struct rsnd_priv *priv;
        struct clk *clk;
+       struct reset_control *rstc;
        u32 status;
 };
 /*
@@ -420,6 +422,7 @@ int rsnd_mod_init(struct rsnd_priv *priv,
                  struct rsnd_mod *mod,
                  struct rsnd_mod_ops *ops,
                  struct clk *clk,
+                 struct reset_control *rstc,
                  enum rsnd_mod_type type,
                  int id);
 void rsnd_mod_quit(struct rsnd_mod *mod);
index 6a3dbc84f4746a693b9456f506f2112cf6a849f1..8b58cc20e7a836bb983866b3b7d77fa15b3d0131 100644 (file)
@@ -766,7 +766,7 @@ int rsnd_src_probe(struct rsnd_priv *priv)
                }
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(src),
-                                   &rsnd_src_ops, clk, RSND_MOD_SRC, i);
+                                   &rsnd_src_ops, clk, NULL, RSND_MOD_SRC, i);
                if (ret)
                        goto rsnd_src_probe_done;
 
index 0420041e282c5d225662d99ff078ce0c39cb3b94..c06cebb36170ca261303fcb543be69cc66249e1b 100644 (file)
@@ -1225,7 +1225,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
                        ops = &rsnd_ssi_dma_ops;
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
-                                   RSND_MOD_SSI, i);
+                                   NULL, RSND_MOD_SSI, i);
                if (ret)
                        goto rsnd_ssi_probe_done;
 
index 244fb833292a748be620607edb1f2a8a0a6d94d5..0cfa84fe5ea869b0b8104637df083be94a301313 100644 (file)
@@ -586,7 +586,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)
                }
 
                ret = rsnd_mod_init(priv, rsnd_mod_get(ssiu),
-                                   ops, NULL, RSND_MOD_SSIU, i);
+                                   ops, NULL, NULL, RSND_MOD_SSIU, i);
                if (ret)
                        return ret;
        }