diff mbox series

[1/7,v2] ASoC: simple-card-utils: care endpoint reg for asoc_simple_card_get_dai_id()

Message ID 87efam2p5t.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: merge audio-graph-scu into audio-graph - final step | expand

Commit Message

Kuninori Morimoto Dec. 13, 2018, 1:35 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

commit b6f3fc005a2c8 ("ASoC: simple-card-utils: fixup
asoc_simple_card_get_dai_id() counting") fixuped getting DAI ID
method. But, we need to consider about endpoint case, too.
This patch fixup it.

For example) MIXer case

	DAI0 -+- CPU <--> Codec - DAI0
	DAI1 /

	/* CPU has 2 DAIs */
	CPU {
		port {
			cpu-ep0: endpint@0 {
				reg = <0>; /* for DAI0 */
				remote-endpoint = <codec-ep0>;
			};
			cpu-ep1: endpint@1 {
				reg = <1>; /* for DAI1 */
				remote-endpoint = <codec-ep1>;
			};
		};
	}

	/* Codec has 1 DAI */
	Codec {
		port {
			reg = <0>; /* both are for DAI0 */
			codec-ep0: endpint@0 {
				remote-endpoint = <cpu-ep0>;
			};
			codec-ep1: endpint@1 {
				remote-endpoint = <cpu-ep1>;
			};
		};
	}

Fixes: commit b6f3fc005a2c8 ("ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting")
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card-utils.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Tony Lindgren Dec. 13, 2018, 4:06 p.m. UTC | #1
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> [181213 01:35]:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> commit b6f3fc005a2c8 ("ASoC: simple-card-utils: fixup
> asoc_simple_card_get_dai_id() counting") fixuped getting DAI ID
> method. But, we need to consider about endpoint case, too.
> This patch fixup it.

Works for my test case now thanks:

Tested-by: Tony Lindgren <tony@atomide.com>
diff mbox series

Patch

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 17d8aee..fec3bf7 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -284,6 +284,9 @@  static int asoc_simple_card_get_dai_id(struct device_node *ep)
 	if (ret)
 		return -ENXIO;
 
+	if (info.id)
+		return info.id;
+
 	return info.port;
 }