Skip to content

Commit ec1b5eb

Browse files
John Madieubroonie
authored andcommitted
ASoC: rsnd: Support unprefixed DT node names for RZ/G3E
The RZ/G3E device tree binding uses standard unprefixed node names ("ssi", "ssiu", "src", "dvc", "mix", "ctu") instead of the legacy "rcar_sound," prefixed names used by R-Car bindings. Convert rsnd_parse_of_node() from a macro into a function that tries the legacy prefixed name first, then falls back to the unprefixed name by stripping the "rcar_sound," prefix. This makes the driver work transparently with both old and new bindings. While at it, update the related comments in dma.c, ssi.c and ssiu.c that reference the hardcoded "rcar_sound,ssiu" / "rcar_sound,ssi" names to note that the driver now accepts both the prefixed and the unprefixed forms. 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-18-john.madieu.xa@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 33a3500 commit ec1b5eb

5 files changed

Lines changed: 48 additions & 14 deletions

File tree

sound/soc/renesas/rcar/core.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,40 @@ rsnd_devm_reset_control_get_optional_indexed(struct device *dev,
13011301
return devm_reset_control_get_optional(dev, name);
13021302
}
13031303

1304+
/*
1305+
* Strip the "rcar_sound," prefix from a legacy node name.
1306+
*
1307+
* The RZ/G3E binding uses unprefixed sub-node names (e.g. "ssi",
1308+
* "ssiu") while earlier R-Car bindings use the legacy "rcar_sound,*"
1309+
* form. This helper returns the unprefixed portion (the part after
1310+
* the comma) or NULL if there is no prefix.
1311+
*
1312+
* Centralising the convention here keeps every call site consistent.
1313+
*/
1314+
static const char *rsnd_node_name_strip_prefix(const char *name)
1315+
{
1316+
const char *comma = strchr(name, ',');
1317+
1318+
return comma ? comma + 1 : NULL;
1319+
}
1320+
1321+
struct device_node *rsnd_parse_of_node(struct rsnd_priv *priv, const char *name)
1322+
{
1323+
struct device_node *np = rsnd_priv_to_dev(priv)->of_node;
1324+
struct device_node *node;
1325+
const char *unprefixed;
1326+
1327+
node = of_get_child_by_name(np, name);
1328+
if (node)
1329+
return node;
1330+
1331+
unprefixed = rsnd_node_name_strip_prefix(name);
1332+
if (unprefixed)
1333+
node = of_get_child_by_name(np, unprefixed);
1334+
1335+
return node;
1336+
}
1337+
13041338
static struct device_node*
13051339
rsnd_pick_endpoint_node_for_ports(struct device_node *e_ports,
13061340
struct device_node *e_port)

sound/soc/renesas/rcar/dma.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,11 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,
794794
int nr, i, idx;
795795

796796
/*
797-
* It should use "rcar_sound,ssiu" on DT.
798-
* But, we need to keep compatibility for old version.
797+
* It should use "rcar_sound,ssiu" (R-Car) or "ssiu" (RZ/G3E) on DT.
798+
* We need to keep compatibility for old version.
799799
*
800-
* If it has "rcar_sound.ssiu", it will be used.
801-
* If not, "rcar_sound.ssi" will be used.
800+
* If it has "rcar_sound.ssiu" or "ssiu", it will be used.
801+
* If not, "rcar_sound.ssi" or "ssi" will be used.
802802
* see
803803
* rsnd_ssiu_dma_req()
804804
* rsnd_ssi_dma_req()

sound/soc/renesas/rcar/rsnd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ rsnd_devm_reset_control_get_optional_indexed(struct device *dev,
501501
/*
502502
* DT
503503
*/
504-
#define rsnd_parse_of_node(priv, node) \
505-
of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, node)
504+
struct device_node *rsnd_parse_of_node(struct rsnd_priv *priv, const char *name);
505+
506506
#define RSND_NODE_DAI "rcar_sound,dai"
507507
#define RSND_NODE_SSI "rcar_sound,ssi"
508508
#define RSND_NODE_SSIU "rcar_sound,ssiu"

sound/soc/renesas/rcar/ssi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,11 +1009,11 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
10091009
char *name;
10101010

10111011
/*
1012-
* It should use "rcar_sound,ssiu" on DT.
1013-
* But, we need to keep compatibility for old version.
1012+
* It should use "rcar_sound,ssiu" (R-Car) or "ssiu" (RZ/G3E) on DT.
1013+
* We need to keep compatibility for old version.
10141014
*
1015-
* If it has "rcar_sound.ssiu", it will be used.
1016-
* If not, "rcar_sound.ssi" will be used.
1015+
* If it has "rcar_sound.ssiu" or "ssiu", it will be used.
1016+
* If not, "rcar_sound.ssi" or "ssi" will be used.
10171017
* see
10181018
* rsnd_ssiu_dma_req()
10191019
* rsnd_dma_of_path()

sound/soc/renesas/rcar/ssiu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ static struct dma_chan *rsnd_ssiu_dma_req(struct rsnd_dai_stream *io,
400400
char *name;
401401

402402
/*
403-
* It should use "rcar_sound,ssiu" on DT.
404-
* But, we need to keep compatibility for old version.
403+
* It should use "rcar_sound,ssiu" (R-Car) or "ssiu" (RZ/G3E) on DT.
404+
* We need to keep compatibility for old versions.
405405
*
406-
* If it has "rcar_sound.ssiu", it will be used.
407-
* If not, "rcar_sound.ssi" will be used.
406+
* If it has "rcar_sound.ssiu" or "ssiu", it will be used.
407+
* If not, "rcar_sound.ssi" or "ssi" will be used.
408408
* see
409409
* rsnd_ssi_dma_req()
410410
* rsnd_dma_of_path()

0 commit comments

Comments
 (0)