[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230602090322.1876359-4-alvin@pqrs.dk>
Date: Fri, 2 Jun 2023 11:03:20 +0200
From: Alvin Šipraga <alvin@...s.dk>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Cc: Alvin Šipraga <alsi@...g-olufsen.dk>,
alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] ASoC: audio-graph-card2: parse symmetric-clock-roles property
From: Alvin Šipraga <alsi@...g-olufsen.dk>
The property, when set, specifies that both ends of the dai-link should
have the same clock consumer/provider roles. Like with parsing of DAI
format, the property can be specified in multiple places:
ports {
(A)
port {
(B)
endpoint {
(C)
};
};
};
So each place has to be checked. In case the clock roles are symmetric,
there is then no need to flip the role when parsing the DAI format on
the CPU side, as it should then be the same on the Codec side.
Signed-off-by: Alvin Šipraga <alsi@...g-olufsen.dk>
---
sound/soc/generic/audio-graph-card2.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
index 25aa79dd55b3..9b4ebfd0c0b6 100644
--- a/sound/soc/generic/audio-graph-card2.c
+++ b/sound/soc/generic/audio-graph-card2.c
@@ -721,13 +721,18 @@ static void graph_link_init(struct asoc_simple_priv *priv,
if (of_node_name_eq(ports, "ports"))
graph_parse_daifmt(ports, &daifmt, &bit_frame); /* (A) */
+ if (of_property_read_bool(ep, "symmetric-clock-roles") ||
+ of_property_read_bool(port, "symmetric-clock-roles") ||
+ of_property_read_bool(ports, "symmetric-clock-roles"))
+ dai_link->symmetric_clock_roles = 1;
+
/*
* convert bit_frame
* We need to flip clock_provider if it was CPU node,
* because it is Codec base.
*/
daiclk = snd_soc_daifmt_clock_provider_from_bitmap(bit_frame);
- if (is_cpu_node)
+ if (is_cpu_node && !dai_link->symmetric_clock_roles)
daiclk = snd_soc_daifmt_clock_provider_flipped(daiclk);
dai_link->dai_fmt = daifmt | daiclk;
--
2.40.0
Powered by blists - more mailing lists