From: John Madieu Date: Mon, 25 May 2026 11:02:27 +0000 (+0000) Subject: ASoC: rsnd: src: Acquire shared SCU clocks for RZ/G3E X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=799836bc37ac9d31beb9effb4d02318f45e53b8f;p=thirdparty%2Flinux.git ASoC: rsnd: src: Acquire shared SCU clocks for RZ/G3E The RZ/G3E SoC requires explicit SCU (Sampling Rate Converter Unit) clock management: - scu: SCU top-level module clock (CPG_CLKON_15.CLK6_ON) - scu_x2: SCU top-level double-rate clock (CPG_CLKON_15.CLK7_ON) - scu_supply: SCU register-access / housekeeping clock (CPG_CLKON_23.CLK14_ON) Without every one of them enabled, no SCU register is reachable. Hold these in a new struct rsnd_src_ctrl and acquire them with devm_clk_get_optional_enabled(). scu_supply is intentionally left untouched by the system suspend/resume path added later in the series, so SCU registers stay reachable across PM transitions. Signed-off-by: John Madieu Acked-by: Kuninori Morimoto Link: https://patch.msgid.link/20260525110230.4014435-16-john.madieu.xa@bp.renesas.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 95843a20c43cc..7d7da6cecf091 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -698,6 +698,7 @@ struct rsnd_priv { /* * below value will be filled on rsnd_src_probe() */ + void *src_ctrl; void *src; int src_nr; diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 43abe13137bfd..88ea9aad5caef 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -53,6 +53,14 @@ struct rsnd_src { ((pos) = (struct rsnd_src *)(priv)->src + i); \ i++) +struct rsnd_src_ctrl { + struct clk *scu; + struct clk *scu_x2; + struct clk *scu_supply; +}; + +#define rsnd_priv_to_src_ctrl(priv) \ + ((struct rsnd_src_ctrl *)(priv)->src_ctrl) /* * image of SRC (Sampling Rate Converter) @@ -712,6 +720,7 @@ int rsnd_src_probe(struct rsnd_priv *priv) { struct device_node *node; struct device *dev = rsnd_priv_to_dev(priv); + struct rsnd_src_ctrl *src_ctrl; struct rsnd_src *src; struct clk *clk; int i, nr, ret; @@ -726,6 +735,12 @@ int rsnd_src_probe(struct rsnd_priv *priv) goto rsnd_src_probe_done; } + src_ctrl = devm_kzalloc(dev, sizeof(*src_ctrl), GFP_KERNEL); + if (!src_ctrl) { + ret = -ENOMEM; + goto rsnd_src_probe_done; + } + src = devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL); if (!src) { ret = -ENOMEM; @@ -734,6 +749,28 @@ int rsnd_src_probe(struct rsnd_priv *priv) priv->src_nr = nr; priv->src = src; + priv->src_ctrl = src_ctrl; + + src_ctrl->scu = devm_clk_get_optional_enabled(dev, "scu"); + if (IS_ERR(src_ctrl->scu)) { + ret = dev_err_probe(dev, PTR_ERR(src_ctrl->scu), + "failed to get scu clock\n"); + goto rsnd_src_probe_done; + } + + src_ctrl->scu_x2 = devm_clk_get_optional_enabled(dev, "scu_x2"); + if (IS_ERR(src_ctrl->scu_x2)) { + ret = dev_err_probe(dev, PTR_ERR(src_ctrl->scu_x2), + "failed to get scu_x2 clock\n"); + goto rsnd_src_probe_done; + } + + src_ctrl->scu_supply = devm_clk_get_optional_enabled(dev, "scu_supply"); + if (IS_ERR(src_ctrl->scu_supply)) { + ret = dev_err_probe(dev, PTR_ERR(src_ctrl->scu_supply), + "failed to get scu_supply clock\n"); + goto rsnd_src_probe_done; + } i = 0; for_each_child_of_node_scoped(node, np) {