devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <alvin@pqrs.dk>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: "Alvin Šipraga" <alsi@bang-olufsen.dk>,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] ASoC: audio-graph-card2: parse symmetric-clock-roles property
Date: Fri,  2 Jun 2023 11:03:20 +0200	[thread overview]
Message-ID: <20230602090322.1876359-4-alvin@pqrs.dk> (raw)
In-Reply-To: <20230602090322.1876359-1-alvin@pqrs.dk>

From: Alvin Šipraga <alsi@bang-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@bang-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


  parent reply	other threads:[~2023-06-02  9:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02  9:03 [PATCH 0/4] ASoC: support dai-links with symmetric clock roles Alvin Šipraga
2023-06-02  9:03 ` [PATCH 1/4] ASoC: dt-bindings: document new symmetric-clock-role flag Alvin Šipraga
2023-06-02 10:13   ` Rob Herring
2023-06-02 11:43   ` Mark Brown
2023-06-02 12:12     ` Alvin Šipraga
2023-06-02 12:19       ` Mark Brown
2023-06-02 12:42         ` Alvin Šipraga
2023-06-06 14:39           ` Mark Brown
2023-06-05 11:42         ` Alvin Šipraga
2023-06-02  9:03 ` [PATCH 2/4] ASoC: core: add support for dai-links with symmetric clock roles Alvin Šipraga
2023-06-02  9:03 ` Alvin Šipraga [this message]
2023-06-05  0:35   ` [PATCH 3/4] ASoC: audio-graph-card2: parse symmetric-clock-roles property Kuninori Morimoto
2023-06-05 10:58     ` Alvin Šipraga
2023-06-02  9:03 ` [PATCH 4/4] ASoC: simple-card: " Alvin Šipraga
2023-06-05  0:28   ` Kuninori Morimoto
2023-06-05 11:12     ` Alvin Šipraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602090322.1876359-4-alvin@pqrs.dk \
    --to=alvin@pqrs.dk \
    --cc=alsa-devel@alsa-project.org \
    --cc=alsi@bang-olufsen.dk \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).