sound/soc/generic/simple-card-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
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@nxp.com>
---
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
Hi Laurentiu
Thank you for the patch
> 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.
?? I think this is not a issue ?
> 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@nxp.com>
> ---
> 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
It breaks existing many drivers / connections.
And I'm not 100% understand the situation.
Can I confirm ? your HW has N ports/DAIs, but want to use 2nd
port/DAI only for example. It is OK so far.
But you want to indicate only 1 port (= 2nd port) on DT,
and, your driver registers N DAI drivers anyway ?
If my assumption was correct, why you don't indicate N ports in DT ?
You need to do is not hack to utils, but update your driver to match
DT count and register driver count ?
Thank you for your help !!
Best regards
---
Kuninori Morimoto
© 2016 - 2025 Red Hat, Inc.