Skip to content

Commit 4185b95

Browse files
SenWang125broonie
authored andcommitted
ASoC: simple-card-utils: fix graph_util_is_ports0() for DT overlays
graph_util_is_ports0() identifies DPCM front-end (ports@0) vs back-end (ports@1) by calling of_get_child_by_name() to find the first "ports" child and comparing pointers. This relies on child iteration order matching DTS source order. When the DPCM topology comes from a DT overlay, __of_attach_node() inserts new children at the head of the sibling list, reversing the order. of_get_child_by_name() then returns ports@1 instead of ports@0, causing all front-end links to be classified as back-ends. The card registers with no PCM devices. Fix this by matching the unit address directly from the node name instead of relying on sibling order. Fixes: 9293925 ("ASoC: simple-card-utils: add asoc_graph_is_ports0()") Signed-off-by: Sen Wang <sen@ti.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/20260309042109.2576612-1-sen@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 634672f commit 4185b95

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

sound/soc/generic/simple-card-utils.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,11 +1038,15 @@ int graph_util_is_ports0(struct device_node *np)
10381038
else
10391039
port = np;
10401040

1041-
struct device_node *ports __free(device_node) = of_get_parent(port);
1042-
struct device_node *top __free(device_node) = of_get_parent(ports);
1043-
struct device_node *ports0 __free(device_node) = of_get_child_by_name(top, "ports");
1041+
struct device_node *ports __free(device_node) = of_get_parent(port);
1042+
const char *at = strchr(kbasename(ports->full_name), '@');
10441043

1045-
return ports0 == ports;
1044+
/*
1045+
* Since child iteration order may differ
1046+
* between a base DT and DT overlays,
1047+
* string match "ports" or "ports@0" in the node name instead.
1048+
*/
1049+
return !at || !strcmp(at, "@0");
10461050
}
10471051
EXPORT_SYMBOL_GPL(graph_util_is_ports0);
10481052

0 commit comments

Comments
 (0)