[PATCH RFC] ASoC: simple-card-utils: always find dlc using result of graph_get_dai_id()
From: Laurentiu Mihalcea
Date: Thu Feb 06 2025 - 11:18:57 EST
From: Laurentiu Mihalcea <laurentiu.mihalcea@xxxxxxx>
If the number of ports is 1, the DAI name will be the one corresponding
to dai_drv[0]. If ARRAY_SIZE(dai_drv) > 1, this means users are forced
to specify all ports corresponding to the DAIs. For instance:
(it is assumed that ARRAY_SIZE(dai_drv) is 2)
[snippet taken from DTS]
dai: my_dai@cafecafe {
/* some more properties go here */
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
endpoint {
/* specify remote here */
};
};
port@1 {
reg = <1>;
endpoint {
/* specify remote here */
};
};
};
};
[/snippet taken from DTS]
This is problematic when users don't want to connect all ports. In the
above example, we're forced to specify all ports even if we want to
"connect" only port@1, for instance, to a remote endpoint.
Generally speaking, assuming that ARRAY_SIZE(dai_drv) is N, and we want to
connect a single port: i, we'd need to specify at least two ports in the
DTS so that "of_graph_get_endpoint_count(node) > 1" is evaluated to true
and the ID resulting from "graph_get_dai_id()" is taken into account.
Fix this by always using 1 as the number of arguments passed to
snd_soc_get_dlc(). This way, snd_soc_get_dlc() will use the ID computed
by graph_get_dai_id(), which takes the value of the 'reg' property into
account if specified.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@xxxxxxx>
---
sound/soc/generic/simple-card-utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index dd414634b4ac..a592617e1b0e 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -1103,7 +1103,7 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep,
/* Get dai->name */
args.np = node;
args.args[0] = graph_get_dai_id(ep);
- args.args_count = (of_graph_get_endpoint_count(node) > 1);
+ args.args_count = 1;
/*
* FIXME
--
2.34.1