Skip to content

Commit 83c9631

Browse files
John Madieubroonie
authored andcommitted
ASoC: rsnd: Add reset controller support to rsnd_mod
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>
1 parent c075827 commit 83c9631

11 files changed

Lines changed: 27 additions & 11 deletions

File tree

sound/soc/renesas/rcar/adg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
780780
return -ENOMEM;
781781

782782
ret = rsnd_mod_init(priv, &adg->mod, &adg_ops,
783-
NULL, 0, 0);
783+
NULL, NULL, 0, 0);
784784
if (ret)
785785
return ret;
786786

sound/soc/renesas/rcar/cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv)
171171

172172
for_each_rsnd_cmd(cmd, priv, i) {
173173
int ret = rsnd_mod_init(priv, rsnd_mod_get(cmd),
174-
&rsnd_cmd_ops, NULL,
174+
&rsnd_cmd_ops, NULL, NULL,
175175
RSND_MOD_CMD, i);
176176
if (ret)
177177
return ret;

sound/soc/renesas/rcar/core.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,25 +196,38 @@ int rsnd_mod_init(struct rsnd_priv *priv,
196196
struct rsnd_mod *mod,
197197
struct rsnd_mod_ops *ops,
198198
struct clk *clk,
199+
struct reset_control *rstc,
199200
enum rsnd_mod_type type,
200201
int id)
201202
{
202-
int ret = clk_prepare(clk);
203+
int ret;
203204

205+
ret = clk_prepare_enable(clk);
204206
if (ret)
205207
return ret;
206208

209+
ret = reset_control_deassert(rstc);
210+
if (ret) {
211+
clk_disable_unprepare(clk);
212+
return ret;
213+
}
214+
215+
clk_disable(clk);
216+
207217
mod->id = id;
208218
mod->ops = ops;
209219
mod->type = type;
210220
mod->clk = clk;
221+
mod->rstc = rstc;
211222
mod->priv = priv;
212223

213224
return 0;
214225
}
215226

216227
void rsnd_mod_quit(struct rsnd_mod *mod)
217228
{
229+
reset_control_assert(mod->rstc);
230+
mod->rstc = NULL;
218231
clk_unprepare(mod->clk);
219232
mod->clk = NULL;
220233
}

sound/soc/renesas/rcar/ctu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
360360
}
361361

362362
ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
363-
clk, RSND_MOD_CTU, i);
363+
clk, NULL, RSND_MOD_CTU, i);
364364
if (ret)
365365
goto rsnd_ctu_probe_done;
366366

sound/soc/renesas/rcar/dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
803803

804804
*dma_mod = rsnd_mod_get(dma);
805805

806-
ret = rsnd_mod_init(priv, *dma_mod, ops, NULL,
806+
ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, NULL,
807807
type, dma_id);
808808
if (ret < 0)
809809
return ret;
@@ -879,5 +879,5 @@ int rsnd_dma_probe(struct rsnd_priv *priv)
879879
priv->dma = dmac;
880880

881881
/* dummy mem mod for debug */
882-
return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, 0, 0);
882+
return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, NULL, 0, 0);
883883
}

sound/soc/renesas/rcar/dvc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
364364
}
365365

366366
ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops,
367-
clk, RSND_MOD_DVC, i);
367+
clk, NULL, RSND_MOD_DVC, i);
368368
if (ret)
369369
goto rsnd_dvc_probe_done;
370370

sound/soc/renesas/rcar/mix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
328328
}
329329

330330
ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops,
331-
clk, RSND_MOD_MIX, i);
331+
clk, NULL, RSND_MOD_MIX, i);
332332
if (ret)
333333
goto rsnd_mix_probe_done;
334334

sound/soc/renesas/rcar/rsnd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/list.h>
1616
#include <linux/module.h>
1717
#include <linux/of.h>
18+
#include <linux/reset.h>
1819
#include <linux/sh_dma.h>
1920
#include <linux/workqueue.h>
2021
#include <sound/soc.h>
@@ -353,6 +354,7 @@ struct rsnd_mod {
353354
struct rsnd_mod_ops *ops;
354355
struct rsnd_priv *priv;
355356
struct clk *clk;
357+
struct reset_control *rstc;
356358
u32 status;
357359
};
358360
/*
@@ -420,6 +422,7 @@ int rsnd_mod_init(struct rsnd_priv *priv,
420422
struct rsnd_mod *mod,
421423
struct rsnd_mod_ops *ops,
422424
struct clk *clk,
425+
struct reset_control *rstc,
423426
enum rsnd_mod_type type,
424427
int id);
425428
void rsnd_mod_quit(struct rsnd_mod *mod);

sound/soc/renesas/rcar/src.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ int rsnd_src_probe(struct rsnd_priv *priv)
766766
}
767767

768768
ret = rsnd_mod_init(priv, rsnd_mod_get(src),
769-
&rsnd_src_ops, clk, RSND_MOD_SRC, i);
769+
&rsnd_src_ops, clk, NULL, RSND_MOD_SRC, i);
770770
if (ret)
771771
goto rsnd_src_probe_done;
772772

sound/soc/renesas/rcar/ssi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
12251225
ops = &rsnd_ssi_dma_ops;
12261226

12271227
ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
1228-
RSND_MOD_SSI, i);
1228+
NULL, RSND_MOD_SSI, i);
12291229
if (ret)
12301230
goto rsnd_ssi_probe_done;
12311231

0 commit comments

Comments
 (0)