Skip to contentSkip to conversation

Audio graph card updates and usage with Tegra210 audio

PATCH Superseded Sameer Pujar 5 participants 31 messages Oct 16, 2020 – Oct 30, 2020

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Audio graph card updates and usage with Tegra210 audio

Summary of changes:
* Support multiple instances of a component. For example there can be multiple I2S devices which can use the same component driver.

* Support open platforms with empty Codec endpoint. Customers can plug their own HW and can populate codec endpoint.

* In a component model there can be many components which can be connected togethe. In such cases Identify no-pcm DPCM DAI links which can be used in BE<->BE connections.

* Add Tegra audio graph driver which is based on generic audio graph driver and specific customizations are done in Tegra driver.

* This pushes DT support for Tegra210 based platforms which uses audio-graph card and above enhancements.

The series is based on following references where DPCM usgae for Tegra Audio and simple-card driver proposal were discussed.

* https://lkml.org/lkml/2020/4/30/519 (DPCM for Tegra)
* https://lkml.org/lkml/2020/6/27/4 (simple-card driver)

Changelog
=========

v3 -> v4
--------
* Added new patches to convert graph.txt and audio-graph-card.txt to corresponding json-schema files. Later these references are used in Tegra audio graph schema.

* AHUB component binding docs are updated to reflect the usage of ports/port/endpoint

* More common stuff is moved into graph_parse_of() and this is used by both generic and Tegra audio graph.

* DT binding for Tegra audio graph is updated to included "ports { }"

* As per the suggestion 'void *data' member is dropped from 'asoc_simple_priv' and instead container method is used to maintain required custom data internal to Tegra audio graph.

v2 -> v3
--------
* Dropped new compatible addition in generic graph driver after reviewing it with Morimoto-san. Instead added Tegra audio graph driver and new compatibles are added in the same.
* Added new patches to expose new members for customization in audio graph driver.
* Added new patch for Tegra audio graph driver and related documentation.
* Minor change in below commit where mutex version of helper is used "ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM"
* DT binding is updated to use the newly exposed compatibles
* No changes in other patches

v1 -> v2
--------
* Re-organized ports/endpoints description for ADMAIF and XBAR. Updated DT patches accordingly.
* After above change, multiple Codec endpoint support is not required and hence dropped for now. This will be considered separately if at all required in future.
* Re-ordered patches in the series.

Sameer Pujar (15):
ASoC: soc-core: Fix component name_prefix parsing
ASoC: soc-pcm: Get all BEs along DAPM path
ASoC: audio-graph: Use of_node and DAI for DPCM DAI link names
ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM
ASoC: audio-graph: Support empty Codec endpoint
ASoC: audio-graph: Expose new members for asoc_simple_priv
ASoC: audio-graph: Expose helpers from audio graph
Documentation: of: Convert graph bindings to json-schema
ASoC: dt-bindings: audio-graph: Convert bindings to json-schema
ASoC: dt-bindings: tegra: Add graph bindings
ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card
ASoC: tegra: Add audio graph based card driver
arm64: defconfig: Enable Tegra audio graph card driver
arm64: tegra: Audio graph header for Tegra210
arm64: tegra: Audio graph sound card for Jetson Nano and TX1

 Documentation/devicetree/bindings/graph.txt        | 128 -----
 Documentation/devicetree/bindings/graph.yaml       | 170 +++++++
 .../devicetree/bindings/sound/audio-graph-card.txt | 337 -------------
 .../bindings/sound/audio-graph-card.yaml           | 548 +++++++++++++++++++++
 .../sound/nvidia,tegra-audio-graph-card.yaml       | 158 ++++++
 .../bindings/sound/nvidia,tegra186-dspk.yaml       |   7 +
 .../bindings/sound/nvidia,tegra210-admaif.yaml     |   7 +
 .../bindings/sound/nvidia,tegra210-ahub.yaml       |   7 +
 .../bindings/sound/nvidia,tegra210-dmic.yaml       |   7 +
 .../bindings/sound/nvidia,tegra210-i2s.yaml        |   7 +
 .../boot/dts/nvidia/tegra210-audio-graph.dtsi      | 153 ++++++
 arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 262 ++++++++++
 arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 146 ++++++
 arch/arm64/configs/defconfig                       |   1 +
 include/sound/graph_card.h                         |  16 +
 include/sound/simple_card_utils.h                  |   3 +
 include/sound/soc.h                                |   1 +
 sound/soc/generic/audio-graph-card.c               | 175 ++++---
 sound/soc/soc-core.c                               |   3 +-
 sound/soc/soc-pcm.c                                |   3 +-
 sound/soc/tegra/Kconfig                            |   9 +
 sound/soc/tegra/Makefile                           |   2 +
 sound/soc/tegra/tegra_audio_graph_card.c           | 255 ++++++++++
 23 files changed, 1882 insertions(+), 523 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 Documentation/devicetree/bindings/graph.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml
 create mode 100644 arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi
 create mode 100644 include/sound/graph_card.h
 create mode 100644 sound/soc/tegra/tegra_audio_graph_card.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/15 ASoC: soc-core: Fix component name_prefix parsing

The "prefix" can be defined in DAI link node or it can be specified as part of the component node itself. Currently "sound-name-prefix" defined in a component is not taking effect. Actually the property is not getting parsed. It can be fixed by parsing "sound-name-prefix" property whenever "prefix" is missing in DAI link Codec node.

---
 sound/soc/soc-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/soc-core.c +2 -1
index ea3986a..cb7333d 100644
@@ -1124,7 +1124,8 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
 	for (i = 0; i < card->num_configs; i++) {
 		struct snd_soc_codec_conf *map = &card->codec_conf[i];
 
-		if (snd_soc_is_matching_component(&map->dlc, component)) {
+		if (snd_soc_is_matching_component(&map->dlc, component) &&
+		    map->name_prefix) {
 			component->name_prefix = map->name_prefix;
 			return;
 		}
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 2/15 ASoC: soc-pcm: Get all BEs along DAPM path

In reply to Sameer Pujar

dpcm_end_walk_at_be() stops the graph walk when first BE is found for the given FE component. In a component model we may want to connect multiple DAIs from different components. A new flag is introduced in 'snd_soc_card', which when set allows DAI/component chaining. Later PCM operations can be called for all these listed components for a valid DAPM path.

---
 include/sound/soc.h | 1 +
 sound/soc/soc-pcm.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
include/sound/soc.h +1 -0
index 3b038c5..9b69d70 100644
@@ -1084,6 +1084,7 @@ struct snd_soc_card {
 	unsigned int fully_routed:1;
 	unsigned int disable_route_checks:1;
 	unsigned int probed:1;
+	unsigned int component_chaining:1;
 
 	void *drvdata;
 };
sound/soc/soc-pcm.c +2 -1
index dcab952..9bd2d65 100644
@@ -1284,7 +1284,8 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
 
 	/* get number of valid DAI paths and their widgets */
 	paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
-			dpcm_end_walk_at_be);
+			fe->card->component_chaining ?
+				NULL : dpcm_end_walk_at_be);
 
 	dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
 			stream ? "capture" : "playback");
Signature · 1 line
2.7.4
#3 lore raw

PATCH v4 3/15 ASoC: audio-graph: Use of_node and DAI for DPCM DAI link names

In reply to Sameer Pujar

For multiple instances of components, using DAI name alone for DAI links is causing conflicts. Components can define multiple DAIs and hence using just a device name won't help either. Thus DT device node reference and DAI names are used to uniquely represent DAI link names.

---
 sound/soc/generic/audio-graph-card.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/generic/audio-graph-card.c +4 -2
index 97b4f54..1e20562 100644
@@ -253,7 +253,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 			goto out_put_node;
 
 		ret = asoc_simple_set_dailink_name(dev, dai_link,
-						   "fe.%s",
+						   "fe.%pOFP.%s",
+						   cpus->of_node,
 						   cpus->dai_name);
 		if (ret < 0)
 			goto out_put_node;
@@ -287,7 +288,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 			goto out_put_node;
 
 		ret = asoc_simple_set_dailink_name(dev, dai_link,
-						   "be.%s",
+						   "be.%pOFP.%s",
+						   codecs->of_node,
 						   codecs->dai_name);
 		if (ret < 0)
 			goto out_put_node;
Signature · 1 line
2.7.4
#4 lore raw

PATCH v4 4/15 ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM

In reply to Sameer Pujar

PCM devices are created for FE dai links with 'no-pcm' flag as '0'. Such DAI links have CPU component which implement either pcm_construct() or pcm_new() at component or dai level respectively. Based on this, current patch exposes a helper function to identify such components and populate 'no_pcm' flag for DPCM DAI link.

This helps to have BE<->BE component links where PCM devices need not be created for CPU component involved in such links.

Cc Kuninori Morimoto <[email protected]>
---
 sound/soc/generic/audio-graph-card.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
sound/soc/generic/audio-graph-card.c +25 -0
index 1e20562..9b06841 100644
@@ -111,6 +111,17 @@ static int graph_get_dai_id(struct device_node *ep)
 	return id;
 }
 
+static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc)
+{
+	struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc);
+
+	if (dai && (dai->component->driver->pcm_construct ||
+		    dai->driver->pcm_new))
+		return true;
+
+	return false;
+}
+
 static int asoc_simple_parse_dai(struct device_node *ep,
 				 struct snd_soc_dai_link_component *dlc,
 				 int *is_single_link)
@@ -205,6 +216,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 				  int dup_codec)
 {
 	struct device *dev = simple_priv_to_dev(priv);
+	struct snd_soc_card *card = simple_priv_to_card(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
 	struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
 	struct device_node *top = dev->of_node;
@@ -259,6 +271,19 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 		if (ret < 0)
 			goto out_put_node;
 
+		/*
+		 * In BE<->BE connections it is not required to create
+		 * PCM devices at CPU end of the dai link and thus 'no_pcm'
+		 * flag needs to be set. It is useful when there are many
+		 * BE components and some of these have to be connected to
+		 * form a valid audio path.
+		 *
+		 * For example: FE <-> BE1 <-> BE2 <-> ... <-> BEn where
+		 * there are 'n' BE components in the path.
+		 */
+		if (card->component_chaining && !soc_component_is_pcm(cpus))
+			dai_link->no_pcm = 1;
+
 		/* card->num_links includes Codec */
 		asoc_simple_canonicalize_cpu(dai_link, is_single_links);
 	} else {
Signature · 1 line
2.7.4
#5 lore raw

PATCH v4 5/15 ASoC: audio-graph: Support empty Codec endpoint

In reply to Sameer Pujar

For open platforms, which can support pluggable audio cards, Codec endpoint is not fixed always. It actually depends on the compatible HW module that is going to be connected. From SoC side the given I/O interface is always available. Hence such links have fixed CPU endpoint but no Codec endpoint. This patch helps to support such links where user can populate Codec endpoint only and its fields in Platform DT depending on the plugged HW.

Cc Kuninori Morimoto <[email protected]>
---
 sound/soc/generic/audio-graph-card.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/generic/audio-graph-card.c +9 -1
index 9b06841..0ba50be9 100644
@@ -229,6 +229,14 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 	struct snd_soc_dai_link_component *codecs = dai_link->codecs;
 	int ret;
 
+	/*
+	 * Codec endpoint can be NULL for pluggable audio HW.
+	 * Platform DT can populate the Codec endpoint depending on the
+	 * plugged HW.
+	 */
+	if (!li->cpu && !codec_ep)
+		return 0;
+
 	/* Do it all CPU endpoint, and 1st Codec endpoint */
 	if (!li->cpu && dup_codec)
 		return 0;
@@ -565,7 +573,7 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
 	li->link++; /* 1xCPU-dummy */
 	li->dais++; /* 1xCPU */
 
-	if (!dup_codec) {
+	if (!dup_codec && codec_ep) {
 		li->link++; /* 1xdummy-Codec */
 		li->conf++; /* 1xdummy-Codec */
 		li->dais++; /* 1xCodec */
Signature · 1 line
2.7.4
#6 lore raw

PATCH v4 6/15 ASoC: audio-graph: Expose new members for asoc_simple_priv

In reply to Sameer Pujar

Add new members in struct 'asoc_simple_priv'. Idea is to leverage simple or graph card driver as much as possible and vendor can maintain a thin driver to control the behavior by populating these newly exposed members.

Following are the members added in 'asoc_simple_priv':

- 'ops' struct: In some cases SoC vendor drivers may want to implement 'snd_soc_ops' callbacks differently. In such cases custom callbacks would be used.

- 'force_dpcm' flag: Right now simple or graph card drivers detect DAI links as DPCM links if:

* The dpcm_selectable is set AND
* Codec is connected to multiple CPU endpoints or aconvert property is used for rate/channels.

So there is no way to directly specify usage of DPCM alone. So a flag is exposed to mark all links as DPCM. Vendor driver can set this if required.

- 'dpcm_selectable': Currently simple or audio graph drivers provide a way to enable this for specific compatibles. However vendor driver may want to define some additional info. Thus expose this variable where vendor drivers can set this if required.

Audio graph driver is updated to consider above flags or callbacks. Subsequent patches in the series illustrate usage for above.

Cc Kuninori Morimoto <[email protected]>
---
 include/sound/simple_card_utils.h    |  3 +++
 sound/soc/generic/audio-graph-card.c | 41 ++++++++++++++++++++++++++++--------
 2 files changed, 35 insertions(+), 9 deletions(-)
include/sound/simple_card_utils.h +3 -0
index 86a1e95..ba4a3e1 100644
@@ -56,6 +56,9 @@ struct asoc_simple_priv {
 	struct asoc_simple_dai *dais;
 	struct snd_soc_codec_conf *codec_conf;
 	struct gpio_desc *pa_gpio;
+	const struct snd_soc_ops *ops;
+	unsigned int dpcm_selectable:1;
+	unsigned int force_dpcm:1;
 };
 #define simple_priv_to_card(priv)	(&(priv)->snd_card)
 #define simple_priv_to_props(priv, i)	((priv)->dai_props + (i))
sound/soc/generic/audio-graph-card.c +32 -9

71 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH v4 7/15 ASoC: audio-graph: Expose helpers from audio graph

In reply to Sameer Pujar

This commit exposes following functions which can be used by a sound card driver based on generic audio graph driver. Idea is vendors can have a thin driver and re-use common stuff from audio graph driver.

- graph_card_probe()
- graph_parse_of()

In doing so a new header file is added for above. The graph_probe() function is simplified by moving more common stuff to graph_parse_of().

Cc Kuninori Morimoto <[email protected]>
---
 include/sound/graph_card.h           | 16 ++++++
 sound/soc/generic/audio-graph-card.c | 95 +++++++++++++++++++-----------------
 2 files changed, 66 insertions(+), 45 deletions(-)
 create mode 100644 include/sound/graph_card.h
include/sound/graph_card.h new file +16 -0
new file mode 100644
index 0000000..bbb5a13
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * ASoC audio graph card support
+ *
+ */
+
+#ifndef __GRAPH_CARD_H
+#define __GRAPH_CARD_H
+
+#include <sound/simple_card_utils.h>
+
+int graph_card_probe(struct snd_soc_card *card);
+
+int graph_parse_of(struct asoc_simple_priv *priv, struct device *dev);
+
+#endif /* __GRAPH_CARD_H */
sound/soc/generic/audio-graph-card.c +50 -45

151 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH v4 8/15 Documentation: of: Convert graph bindings to json-schema

In reply to Sameer Pujar

Convert device tree bindings of graph to YAML format.

---
 Documentation/devicetree/bindings/graph.txt  | 128 --------------------
 Documentation/devicetree/bindings/graph.yaml | 170 +++++++++++++++++++++++++++
 2 files changed, 170 insertions(+), 128 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 Documentation/devicetree/bindings/graph.yaml
Documentation/devicetree/bindings/graph.txt deleted +0 -128
deleted file mode 100644
index 0415e2c..0000000
@@ -1,128 +0,0 @@
-Common bindings for device graphs
-
-General concept
----------------
-
-The hierarchical organisation of the device tree is well suited to describe
-control flow to devices, but there can be more complex connections between
-devices that work together to form a logical compound device, following an
-arbitrarily complex graph.
-There already is a simple directed graph between devices tree nodes using
-phandle properties pointing to other nodes to describe connections that
-can not be inferred from device tree parent-child relationships. The device
-tree graph bindings described herein abstract more complex devices that can
-have multiple specifiable ports, each of which can be linked to one or more
-ports of other devices.
-
-These common bindings do not contain any information about the direction or
-type of the connections, they just map their existence. Specific properties
-may be described by specialized bindings depending on the type of connection.
-
-To see how this binding applies to video pipelines, for example, see
-Documentation/devicetree/bindings/media/video-interfaces.txt.
-Here the ports describe data interfaces, and the links between them are
-the connecting data buses. A single port with multiple connections can
-correspond to multiple devices being connected to the same physical bus.
-
-Organisation of ports and endpoints
------------------------------------
-
-Ports are described by child 'port' nodes contained in the device node.
-Each port node contains an 'endpoint' subnode for each remote device port
-connected to this port. If a single port is connected to more than one
-remote device, an 'endpoint' child node must be provided for each link.
-If more than one port is present in a device node or there is more than one
-endpoint at a port, or a port node needs to be associated with a selected
-hardware interface, a common scheme using '#address-cells', '#size-cells'
-and 'reg' properties is used to number the nodes.
-
-device {
-        ...
-        #address-cells = <1>;
-        #size-cells = <0>;
-
-        port@0 {
-	        #address-cells = <1>;
-	        #size-cells = <0>;
-		reg = <0>;
-
-                endpoint@0 {
-			reg = <0>;
-			...
-		};
-                endpoint@1 {
-			reg = <1>;
-			...
-		};
-        };
-
-        port@1 {
-		reg = <1>;
-
-		endpoint { ... };
-	};
-};
-
-All 'port' nodes can be grouped under an optional 'ports' node, which
-allows to specify #address-cells, #size-cells properties for the 'port'
-nodes independently from any other child device nodes a device might
-have.
-
-device {
-        ...
-        ports {
-                #address-cells = <1>;
-                #size-cells = <0>;
-
-                port@0 {
-                        ...
-                        endpoint@0 { ... };
-                        endpoint@1 { ... };
-                };
-
-                port@1 { ... };
-        };
-};
-
-Links between endpoints
------------------------
-
-Each endpoint should contain a 'remote-endpoint' phandle property that points
-to the corresponding endpoint in the port of the remote device. In turn, the
-remote endpoint should contain a 'remote-endpoint' property. If it has one, it
-must not point to anything other than the local endpoint. Two endpoints with
-their 'remote-endpoint' phandles pointing at each other form a link between the
-containing ports.
-
-device-1 {
-        port {
-                device_1_output: endpoint {
-                        remote-endpoint = <&device_2_input>;
-                };
-        };
-};
-
-device-2 {
-        port {
-                device_2_input: endpoint {
-                        remote-endpoint = <&device_1_output>;
-                };
-        };
-};
-
-Required properties
--------------------
-
-If there is more than one 'port' or more than one 'endpoint' node or 'reg'
-property present in the port and/or endpoint nodes then the following
-properties are required in a relevant parent node:
-
- - #address-cells : number of cells required to define port/endpoint
-                    identifier, should be 1.
- - #size-cells    : should be zero.
-
-Optional endpoint properties
-----------------------------
-
-- remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
-
Documentation/devicetree/bindings/graph.yaml new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#9 lore raw

Re: [PATCH v4 08/15] Documentation: of: Convert graph bindings to json-schema

Quoted 1 line · Sameer Pujar

Convert device tree bindings of graph to YAML format.

Thanks for doing this.

Quoted 8 lines
---
 Documentation/devicetree/bindings/graph.txt  | 128 --------------------
 Documentation/devicetree/bindings/graph.yaml | 170 +++++++++++++++++++++++++++
 2 files changed, 170 insertions(+), 128 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 Documentation/devicetree/bindings/graph.yaml

I'd like to move this to the dtschema repository instead.

Documentation/devicetree/bindings/graph.yaml line 1

Quoted 7 lines
Documentation/devicetree/bindings/graph.yaml new file +1 -0
new file mode 100644
index 0000000..67804c1
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

As the original text defaulted to GPL2, this needs Philipp's permission to re-license.

Quoted 31 lines
Documentation/devicetree/bindings/graph.yaml new file +31 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/graph.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common bindings for device graphs
+
+description: |
+  The hierarchical organisation of the device tree is well suited to describe
+  control flow to devices, but there can be more complex connections between
+  devices that work together to form a logical compound device, following an
+  arbitrarily complex graph.
+  There already is a simple directed graph between devices tree nodes using
+  phandle properties pointing to other nodes to describe connections that
+  can not be inferred from device tree parent-child relationships. The device
+  tree graph bindings described herein abstract more complex devices that can
+  have multiple specifiable ports, each of which can be linked to one or more
+  ports of other devices.
+
+  These common bindings do not contain any information about the direction or
+  type of the connections, they just map their existence. Specific properties
+  may be described by specialized bindings depending on the type of connection.
+
+  To see how this binding applies to video pipelines, for example, see
+  Documentation/devicetree/bindings/media/video-interfaces.txt.
+  Here the ports describe data interfaces, and the links between them are
+  the connecting data buses. A single port with multiple connections can
+  correspond to multiple devices being connected to the same physical bus.
+
+maintainers:
+  - Philipp Zabel <[email protected]>

Documentation/devicetree/bindings/graph.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+
+definitions:
+
+  port:
+    type: object
+    description: |
+      If there is more than one 'port' or more than one 'endpoint' node
+      or 'reg' property present in the port and/or endpoint nodes then
+      '#address-cells' and '#size-cells' properties are required in relevant
+      parent node.

reg property.

Documentation/devicetree/bindings/graph.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/graph.yaml new file +5 -0
+
+    patternProperties:
+      "^endpoint(@[0-9a-f]+)?$":
+        type: object
+        properties:

reg?

Documentation/devicetree/bindings/graph.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+          remote-endpoint:
+            description: |
+              phandle to an 'endpoint' subnode of a remote device node.
+            $ref: /schemas/types.yaml#/definitions/phandle
+
+  ports:
+    type: object
+    patternProperties:
+      "^port(@[0-9a-f]+)?$":
+        $ref: "#/definitions/port"

No reason for this to be under 'definitions'. Just move down.

Documentation/devicetree/bindings/graph.yaml line 67

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+
+properties:
+  ports:
+    $ref: "#/definitions/ports"
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: "#/definitions/port"
+
+additionalProperties: false

This needs to be true here. But you need this within 'ports' and 'port'. (I think... I think we only have extra properties within endpoint nodes.)

Quoted 106 lines
Documentation/devicetree/bindings/graph.yaml new file +103 -0
+
+examples:
+  # Organisation of ports and endpoints:
+  #
+  # Ports are described by child 'port' nodes contained in the device node.
+  # Each port node contains an 'endpoint' subnode for each remote device port
+  # connected to this port. If a single port is connected to more than one
+  # remote device, an 'endpoint' child node must be provided for each link.
+  # If more than one port is present in a device node or there is more than
+  # one endpoint at a port, or a port node needs to be associated with a
+  # selected hardware interface, a common scheme using '#address-cells',
+  # '#size-cells' and 'reg' properties is used to number the nodes.
+  - |
+    device {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@0 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <0>;
+
+            endpoint@0 {
+                reg = <0>;
+                // ...
+            };
+            endpoint@1 {
+                reg = <1>;
+                // ...
+            };
+        };
+
+        port@1 {
+            reg = <1>;
+
+            endpoint {
+                // ...
+            };
+        };
+    };
+
+  # All 'port' nodes can be grouped under an optional 'ports' node, which
+  # allows to specify #address-cells, #size-cells properties for the 'port'
+  # nodes independently from any other child device nodes a device might
+  # have.
+  - |
+    device {
+        // ...
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <0>;
+                // ...
+
+                endpoint@0 {
+                    reg = <0>;
+                    // ...
+                };
+                endpoint@1 {
+                    reg = <1>;
+                    // ...
+                };
+            };
+
+            port@1 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <1>;
+                // ...
+            };
+        };
+    };
+
+  # Links between endpoints:
+  #
+  # Each endpoint should contain a 'remote-endpoint' phandle property that
+  # points to the corresponding endpoint in the port of the remote device.
+  # In turn, the remote endpoint should contain a 'remote-endpoint' property.
+  # If it has one, it must not point to anything other than the local endpoint.
+  # Two endpoints with their 'remote-endpoint' phandles pointing at each other
+  # form a link between the containing ports.
+  - |
+    device-1 {
+        port {
+            device_1_output: endpoint {
+                remote-endpoint = <&device_2_input>;
+            };
+        };
+    };
+
+    device-2 {
+        port {
+            device_2_input: endpoint {
+                remote-endpoint = <&device_1_output>;
+            };
+        };
+    };
+
+...
Signature · 1 line
2.7.4
#10 lore raw

Re: [PATCH v4 08/15] Documentation: of: Convert graph bindings to json-schema

Quoted 10 lines
Quoted 9 lines
---
  Documentation/devicetree/bindings/graph.txt  | 128 --------------------
  Documentation/devicetree/bindings/graph.yaml | 170 +++++++++++++++++++++++++++
  2 files changed, 170 insertions(+), 128 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/graph.txt create mode 100644 Documentation/devicetree/bindings/graph.yaml

I'd like to move this to the dtschema repository instead.

Do you mean I need to separately submit this patch for dtschema repo?

...

Quoted 34 lines
Quoted 34 lines

+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/graph.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/graph.yaml new file +30 -0
+
+title: Common bindings for device graphs
+
+description: |
+  The hierarchical organisation of the device tree is well suited to describe
+  control flow to devices, but there can be more complex connections between
+  devices that work together to form a logical compound device, following an
+  arbitrarily complex graph.
+  There already is a simple directed graph between devices tree nodes using
+  phandle properties pointing to other nodes to describe connections that
+  can not be inferred from device tree parent-child relationships. The device
+  tree graph bindings described herein abstract more complex devices that can
+  have multiple specifiable ports, each of which can be linked to one or more
+  ports of other devices.
+
+  These common bindings do not contain any information about the direction or
+  type of the connections, they just map their existence. Specific properties
+  may be described by specialized bindings depending on the type of connection.
+
+  To see how this binding applies to video pipelines, for example, see
+  Documentation/devicetree/bindings/media/video-interfaces.txt.
+  Here the ports describe data interfaces, and the links between them are
+  the connecting data buses. A single port with multiple connections can
+  correspond to multiple devices being connected to the same physical bus.
+
+maintainers:
+  - Philipp Zabel <[email protected]>
+
+definitions:
+
Quoted 8 lines

Documentation/devicetree/bindings/graph.yaml line 42

Quoted 7 lines
Documentation/devicetree/bindings/graph.yaml new file +7 -0
+  port:
+    type: object
+    description: |
+      If there is more than one 'port' or more than one 'endpoint' node
+      or 'reg' property present in the port and/or endpoint nodes then
+      '#address-cells' and '#size-cells' properties are required in relevant
+      parent node.

reg property.

done

Quoted 7 lines

Documentation/devicetree/bindings/graph.yaml line 47

Quoted 6 lines
Documentation/devicetree/bindings/graph.yaml new file +5 -0
+
+    patternProperties:
+      "^endpoint(@[0-9a-f]+)?$":
+        type: object
+        properties:

reg?

done

Quoted 11 lines

Documentation/devicetree/bindings/graph.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+          remote-endpoint:
+            description: |
+              phandle to an 'endpoint' subnode of a remote device node.
+            $ref: /schemas/types.yaml#/definitions/phandle
+
+  ports:
+    type: object
+    patternProperties:
+      "^port(@[0-9a-f]+)?$":
+        $ref: "#/definitions/port"

No reason for this to be under 'definitions'. Just move down.

Would definitions be needed if some schemas want to refer the base graph schema? Or is it like they can just directly include the base schema and definitions are not really required?

But what if they want to extend few properties. For example:

graph.yaml
----------
endpoint {
    remote-endpoint = <>;
};

*audio-graph-card.yaml
----------------------
endpoint {
    remote-endpoint = <>;

    property-x;
    node-x {
        ...
    };
};

Quoted 14 lines

Documentation/devicetree/bindings/graph.yaml line 67

Quoted 11 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+
+properties:
+  ports:
+    $ref: "#/definitions/ports"
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: "#/definitions/port"
+
+additionalProperties: false

This needs to be true here. But you need this within 'ports' and 'port'. (I think... I think we only have extra properties within endpoint nodes.)

I think currently audio-graph allows few properties at port/ports. I am not sure if Morimoto-san has plans to get rid of this.

Acked-by
#11 lore raw

Re: [PATCH v4 08/15] Documentation: of: Convert graph bindings to json-schema

In reply to Rob Herring

Hi Sameer, Rob,

Quoted 4 lines · Rob Herring
Quoted 1 line · Sameer Pujar

Convert device tree bindings of graph to YAML format.

Thanks for doing this.

Seconded.

Quoted 4 lines
Quoted 4 lines
---
 Documentation/devicetree/bindings/graph.txt  | 128 --------------------

The removed Documentation/devicetree/bindings/graph.txt is referenced by a lot of files, tree-wide. Should the references be updated in the same series?

Quoted 7 lines
Quoted 4 lines
 Documentation/devicetree/bindings/graph.yaml | 170 +++++++++++++++++++++++++++
 2 files changed, 170 insertions(+), 128 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 Documentation/devicetree/bindings/graph.yaml

I'd like to move this to the dtschema repository instead.

Quoted 10 lines

Documentation/devicetree/bindings/graph.yaml line 1

Quoted 7 lines
Documentation/devicetree/bindings/graph.yaml new file +1 -0
new file mode 100644
index 0000000..67804c1
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

As the original text defaulted to GPL2, this needs Philipp's permission to re-license.

Quoted 35 lines
Quoted 35 lines
Documentation/devicetree/bindings/graph.yaml new file +35 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/graph.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common bindings for device graphs
+
+description: |
+  The hierarchical organisation of the device tree is well suited to describe
+  control flow to devices, but there can be more complex connections between
+  devices that work together to form a logical compound device, following an
+  arbitrarily complex graph.
+  There already is a simple directed graph between devices tree nodes using
+  phandle properties pointing to other nodes to describe connections that
+  can not be inferred from device tree parent-child relationships. The device
+  tree graph bindings described herein abstract more complex devices that can
+  have multiple specifiable ports, each of which can be linked to one or more
+  ports of other devices.
+
+  These common bindings do not contain any information about the direction or
+  type of the connections, they just map their existence. Specific properties
+  may be described by specialized bindings depending on the type of connection.
+
+  To see how this binding applies to video pipelines, for example, see
+  Documentation/devicetree/bindings/media/video-interfaces.txt.
+  Here the ports describe data interfaces, and the links between them are
+  the connecting data buses. A single port with multiple connections can
+  correspond to multiple devices being connected to the same physical bus.
+
+maintainers:
+  - Philipp Zabel <[email protected]>
+
+definitions:
+
+  port:
Quoted 8 lines

Documentation/devicetree/bindings/graph.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/graph.yaml new file +6 -0
+    type: object
+    description: |
+      If there is more than one 'port' or more than one 'endpoint' node
+      or 'reg' property present in the port and/or endpoint nodes then
+      '#address-cells' and '#size-cells' properties are required in relevant
+      parent node.

reg property.

What about #address-cells and #size-cells in port and ports nodes? These must either be #address-cells = <1>, #size-cells = <0>, or they can be absent if the parent node already has the same, or if a port node only contains a single endpoint.

Quoted 134 lines

Documentation/devicetree/bindings/graph.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/graph.yaml new file +5 -0
+
+    patternProperties:
+      "^endpoint(@[0-9a-f]+)?$":
+        type: object
+        properties:

reg?

Documentation/devicetree/bindings/graph.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+          remote-endpoint:
+            description: |
+              phandle to an 'endpoint' subnode of a remote device node.
+            $ref: /schemas/types.yaml#/definitions/phandle
+
+  ports:
+    type: object
+    patternProperties:
+      "^port(@[0-9a-f]+)?$":
+        $ref: "#/definitions/port"

No reason for this to be under 'definitions'. Just move down.

Documentation/devicetree/bindings/graph.yaml line 67

Quoted 10 lines
Documentation/devicetree/bindings/graph.yaml new file +10 -0
+
+properties:
+  ports:
+    $ref: "#/definitions/ports"
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: "#/definitions/port"
+
+additionalProperties: false

This needs to be true here. But you need this within 'ports' and 'port'. (I think... I think we only have extra properties within endpoint nodes.)

Quoted 98 lines
Documentation/devicetree/bindings/graph.yaml new file +98 -0
+
+examples:
+  # Organisation of ports and endpoints:
+  #
+  # Ports are described by child 'port' nodes contained in the device node.
+  # Each port node contains an 'endpoint' subnode for each remote device port
+  # connected to this port. If a single port is connected to more than one
+  # remote device, an 'endpoint' child node must be provided for each link.
+  # If more than one port is present in a device node or there is more than
+  # one endpoint at a port, or a port node needs to be associated with a
+  # selected hardware interface, a common scheme using '#address-cells',
+  # '#size-cells' and 'reg' properties is used to number the nodes.
+  - |
+    device {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@0 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <0>;
+
+            endpoint@0 {
+                reg = <0>;
+                // ...
+            };
+            endpoint@1 {
+                reg = <1>;
+                // ...
+            };
+        };
+
+        port@1 {
+            reg = <1>;
+
+            endpoint {
+                // ...
+            };
+        };
+    };
+
+  # All 'port' nodes can be grouped under an optional 'ports' node, which
+  # allows to specify #address-cells, #size-cells properties for the 'port'
+  # nodes independently from any other child device nodes a device might
+  # have.
+  - |
+    device {
+        // ...
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <0>;
+                // ...
+
+                endpoint@0 {
+                    reg = <0>;
+                    // ...
+                };
+                endpoint@1 {
+                    reg = <1>;
+                    // ...
+                };
+            };
+
+            port@1 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <1>;
+                // ...
+            };
+        };
+    };
+
+  # Links between endpoints:
+  #
+  # Each endpoint should contain a 'remote-endpoint' phandle property that
+  # points to the corresponding endpoint in the port of the remote device.
+  # In turn, the remote endpoint should contain a 'remote-endpoint' property.
+  # If it has one, it must not point to anything other than the local endpoint.
+  # Two endpoints with their 'remote-endpoint' phandles pointing at each other
+  # form a link between the containing ports.
+  - |
+    device-1 {
+        port {
+            device_1_output: endpoint {
+                remote-endpoint = <&device_2_input>;
+            };
+        };
+    };
+
+    device-2 {
+        port {
+            device_2_input: endpoint {
+                remote-endpoint = <&device_1_output>;
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/graph.yaml new file +5 -0
+            };
+        };
+    };
+
+...
Signature · 1 line
2.7.4

regards
Philipp

#12 lore raw

Re: [PATCH v4 08/15] Documentation: of: Convert graph bindings to json-schema

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
---
  Documentation/devicetree/bindings/graph.txt  | 128 --------------------

The removed Documentation/devicetree/bindings/graph.txt is referenced by a lot of files, tree-wide. Should the references be updated in the same series?

May be possible to include in the same series if it is just about using 'graph.yaml' reference instead of 'graph.txt' in various files.

...

Quoted 42 lines
Quoted 34 lines
Quoted 34 lines

+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/graph.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/graph.yaml new file +30 -0
+
+title: Common bindings for device graphs
+
+description: |
+  The hierarchical organisation of the device tree is well suited to describe
+  control flow to devices, but there can be more complex connections between
+  devices that work together to form a logical compound device, following an
+  arbitrarily complex graph.
+  There already is a simple directed graph between devices tree nodes using
+  phandle properties pointing to other nodes to describe connections that
+  can not be inferred from device tree parent-child relationships. The device
+  tree graph bindings described herein abstract more complex devices that can
+  have multiple specifiable ports, each of which can be linked to one or more
+  ports of other devices.
+
+  These common bindings do not contain any information about the direction or
+  type of the connections, they just map their existence. Specific properties
+  may be described by specialized bindings depending on the type of connection.
+
+  To see how this binding applies to video pipelines, for example, see
+  Documentation/devicetree/bindings/media/video-interfaces.txt.
+  Here the ports describe data interfaces, and the links between them are
+  the connecting data buses. A single port with multiple connections can
+  correspond to multiple devices being connected to the same physical bus.
+
+maintainers:
+  - Philipp Zabel <[email protected]>
+
+definitions:
+
Quoted 8 lines

Documentation/devicetree/bindings/graph.yaml line 42

Quoted 7 lines
Documentation/devicetree/bindings/graph.yaml new file +7 -0
+  port:
+    type: object
+    description: |
+      If there is more than one 'port' or more than one 'endpoint' node
+      or 'reg' property present in the port and/or endpoint nodes then
+      '#address-cells' and '#size-cells' properties are required in relevant
+      parent node.

reg property.

Quoted 4 lines

What about #address-cells and #size-cells in port and ports nodes? These must either be #address-cells = <1>, #size-cells = <0>, or they can be absent if the parent node already has the same, or if a port node only contains a single endpoint.

Yes, will list these properties for port/ports.

...

#13 lore raw

PATCH v4 9/15 ASoC: dt-bindings: audio-graph: Convert bindings to json-schema

In reply to Sameer Pujar

Convert device tree bindings of audio graph card to YAML format. Also expose some common definitions which can be used by similar graph based audio sound cards.

Cc Kuninori Morimoto <[email protected]>
---
 .../devicetree/bindings/sound/audio-graph-card.txt | 337 -------------
 .../bindings/sound/audio-graph-card.yaml           | 548 +++++++++++++++++++++
 2 files changed, 548 insertions(+), 337 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
Documentation/devicetree/bindings/sound/audio-graph-card.txt deleted +0 -337
deleted file mode 100644
index d5f6919..0000000
@@ -1,337 +0,0 @@
-Audio Graph Card:
-
-Audio Graph Card specifies audio DAI connections of SoC <-> codec.
-It is based on common bindings for device graphs.
-see ${LINUX}/Documentation/devicetree/bindings/graph.txt
-
-Basically, Audio Graph Card property is same as Simple Card.
-see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.yaml
-
-Below are same as Simple-Card.
-
-- label
-- widgets
-- routing
-- dai-format
-- frame-master
-- bitclock-master
-- bitclock-inversion
-- frame-inversion
-- mclk-fs
-- hp-det-gpio
-- mic-det-gpio
-- dai-tdm-slot-num
-- dai-tdm-slot-width
-- clocks / system-clock-frequency
-
-Required properties:
-
-- compatible				: "audio-graph-card";
-- dais					: list of CPU DAI port{s}
-
-Optional properties:
-- pa-gpios: GPIO used to control external amplifier.
-
------------------------
-Example: Single DAI case
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		dais = <&cpu_port>;
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint: endpoint {
-				remote-endpoint = <&codec_endpoint>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
-	audio-codec {
-		...
-		port {
-			codec_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint>;
-			};
-		};
-	};
-
------------------------
-Example: Multi DAI case
------------------------
-
-	sound-card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-
-		dais = <&cpu_port0
-			&cpu_port1
-			&cpu_port2>;
-	};
-
-	audio-codec@0 {
-		...
-		port {
-			codec0_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint0>;
-			};
-		};
-	};
-
-	audio-codec@1 {
-		...
-		port {
-			codec1_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint1>;
-			};
-		};
-	};
-
-	audio-codec@2 {
-		...
-		port {
-			codec2_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint2>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		ports {
-			cpu_port0: port@0 {
-				cpu_endpoint0: endpoint {
-					remote-endpoint = <&codec0_endpoint>;
-
-					dai-format = "left_j";
-					...
-				};
-			};
-			cpu_port1: port@1 {
-				cpu_endpoint1: endpoint {
-					remote-endpoint = <&codec1_endpoint>;
-
-					dai-format = "i2s";
-					...
-				};
-			};
-			cpu_port2: port@2 {
-				cpu_endpoint2: endpoint {
-					remote-endpoint = <&codec2_endpoint>;
-
-					dai-format = "i2s";
-					...
-				};
-			};
-		};
-	};
-
-
------------------------
-Example: Sampling Rate Conversion
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-		prefix = "codec";
-		routing = "codec Playback", "DAI0 Playback",
-			  "DAI0 Capture",   "codec Capture";
-		convert-rate = <48000>;
-
-		dais = <&cpu_port>;
-	};
-
-	audio-codec {
-		...
-		port {
-			codec_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint: endpoint {
-				remote-endpoint = <&codec_endpoint>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
------------------------
-Example: 2 CPU 1 Codec (Mixing)
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-		routing = "codec Playback", "DAI0 Playback",
-			  "codec Playback", "DAI1 Playback",
-			  "DAI0 Capture",   "codec Capture";
-
-		dais = <&cpu_port>;
-	};
-
-	audio-codec {
-		...
-
-		audio-graph-card,prefix = "codec";
-		audio-graph-card,convert-rate = <48000>;
-		port {
-			reg = <0>;
-			codec_endpoint0: endpoint@0 {
-				remote-endpoint = <&cpu_endpoint0>;
-			};
-			codec_endpoint1: endpoint@1 {
-				remote-endpoint = <&cpu_endpoint1>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint0: endpoint@0 {
-				remote-endpoint = <&codec_endpoint0>;
-
-				dai-format = "left_j";
-				...
-			};
-			cpu_endpoint1: endpoint@1 {
-				remote-endpoint = <&codec_endpoint1>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
------------------------
-Example: Multi DAI with DPCM
------------------------
-
-	CPU0 ------ ak4613
-	CPU1 ------ HDMI
-	CPU2 ------ PCM3168A-p	/* DPCM 1ch/2ch */
-	CPU3 --/		/* DPCM 3ch/4ch */
-	CPU4 --/		/* DPCM 5ch/6ch */
-	CPU5 --/		/* DPCM 7ch/8ch */
-	CPU6 ------ PCM3168A-c
-
-	sound_card: sound {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-
-		routing =	"pcm3168a Playback", "DAI2 Playback",
-				"pcm3168a Playback", "DAI3 Playback",
-				"pcm3168a Playback", "DAI4 Playback",
-				"pcm3168a Playback", "DAI5 Playback";
-
-		dais = <&snd_port0	/* ak4613 */
-			&snd_port1	/* HDMI0  */
-			&snd_port2	/* pcm3168a playback */
-			&snd_port3	/* pcm3168a capture  */
-			>;
-	};
-
-	ak4613: codec@10 {
-		...
-		port {
-			ak4613_endpoint: endpoint {
-				remote-endpoint = <&rsnd_endpoint0>;
-			};
-		};
-	};
-
-	pcm3168a: audio-codec@44 {
-		...
-		audio-graph-card,prefix = "pcm3168a";
-		audio-graph-card,convert-channels = <8>; /* TDM Split */
-		ports {
-			port@0 {
-				reg = <0>;
-				pcm3168a_endpoint_p1: endpoint@1 {
-					remote-endpoint = <&rsnd_endpoint2>;
-					...
-				};
-				pcm3168a_endpoint_p2: endpoint@2 {
-					remote-endpoint = <&rsnd_endpoint3>;
-					...
-				};
-				pcm3168a_endpoint_p3: endpoint@3 {
-					remote-endpoint = <&rsnd_endpoint4>;
-					...
-				};
-				pcm3168a_endpoint_p4: endpoint@4 {
-					remote-endpoint = <&rsnd_endpoint5>;
-					...
-				};
-			};
-			port@1 {
-				reg = <1>;
-				pcm3168a_endpoint_c: endpoint {
-					remote-endpoint = <&rsnd_endpoint6>;
-					...
-				};
-			};
-		};
-	};
-
-	&sound {
-		ports {
-			snd_port0: port@0 {
-				rsnd_endpoint0: endpoint {
-					remote-endpoint = <&ak4613_endpoint>;
-					...
-				};
-			};
-			snd_port1: port@1 {
-				rsnd_endpoint1: endpoint {
-					remote-endpoint = <&dw_hdmi0_snd_in>;
-					...
-				};
-			};
-			snd_port2: port@2 {
-				#address-cells = <1>;
-				#size-cells = <0>;
-				rsnd_endpoint2: endpoint@2 {
-					remote-endpoint = <&pcm3168a_endpoint_p1>;
-					...
-				};
-				rsnd_endpoint3: endpoint@3 {
-					remote-endpoint = <&pcm3168a_endpoint_p2>;
-					...
-				};
-				rsnd_endpoint4: endpoint@4 {
-					remote-endpoint = <&pcm3168a_endpoint_p3>;
-					...
-				};
-				rsnd_endpoint5: endpoint@5 {
-					remote-endpoint = <&pcm3168a_endpoint_p4>;
-					...
-				};
-			};
-			snd_port3: port@6 {
-				rsnd_endpoint6: endpoint {
-					remote-endpoint = <&pcm3168a_endpoint_c>;
-					...
-				};
-			};
-		};
-	};
Documentation/devicetree/bindings/sound/audio-graph-card.yaml new file +548 -0

548 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

Re: [PATCH v4 09/15] ASoC: dt-bindings: audio-graph: Convert bindings to json-schema

Hi Sameer

Quoted 7 lines

Convert device tree bindings of audio graph card to YAML format. Also expose some common definitions which can be used by similar graph based audio sound cards.

Cc Kuninori Morimoto <[email protected]>

---

I'm posting this patch to Rob & DT ML.
Not yet accepted, though..

Quoted 906 lines
 .../devicetree/bindings/sound/audio-graph-card.txt | 337 -------------
 .../bindings/sound/audio-graph-card.yaml           | 548 +++++++++++++++++++++
 2 files changed, 548 insertions(+), 337 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
Documentation/devicetree/bindings/sound/audio-graph-card.txt deleted +0 -337
deleted file mode 100644
index d5f6919..0000000
@@ -1,337 +0,0 @@
-Audio Graph Card:
-
-Audio Graph Card specifies audio DAI connections of SoC <-> codec.
-It is based on common bindings for device graphs.
-see ${LINUX}/Documentation/devicetree/bindings/graph.txt
-
-Basically, Audio Graph Card property is same as Simple Card.
-see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.yaml
-
-Below are same as Simple-Card.
-
-- label
-- widgets
-- routing
-- dai-format
-- frame-master
-- bitclock-master
-- bitclock-inversion
-- frame-inversion
-- mclk-fs
-- hp-det-gpio
-- mic-det-gpio
-- dai-tdm-slot-num
-- dai-tdm-slot-width
-- clocks / system-clock-frequency
-
-Required properties:
-
-- compatible				: "audio-graph-card";
-- dais					: list of CPU DAI port{s}
-
-Optional properties:
-- pa-gpios: GPIO used to control external amplifier.
-
------------------------
-Example: Single DAI case
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		dais = <&cpu_port>;
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint: endpoint {
-				remote-endpoint = <&codec_endpoint>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
-	audio-codec {
-		...
-		port {
-			codec_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint>;
-			};
-		};
-	};
-
------------------------
-Example: Multi DAI case
------------------------
-
-	sound-card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-
-		dais = <&cpu_port0
-			&cpu_port1
-			&cpu_port2>;
-	};
-
-	audio-codec@0 {
-		...
-		port {
-			codec0_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint0>;
-			};
-		};
-	};
-
-	audio-codec@1 {
-		...
-		port {
-			codec1_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint1>;
-			};
-		};
-	};
-
-	audio-codec@2 {
-		...
-		port {
-			codec2_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint2>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		ports {
-			cpu_port0: port@0 {
-				cpu_endpoint0: endpoint {
-					remote-endpoint = <&codec0_endpoint>;
-
-					dai-format = "left_j";
-					...
-				};
-			};
-			cpu_port1: port@1 {
-				cpu_endpoint1: endpoint {
-					remote-endpoint = <&codec1_endpoint>;
-
-					dai-format = "i2s";
-					...
-				};
-			};
-			cpu_port2: port@2 {
-				cpu_endpoint2: endpoint {
-					remote-endpoint = <&codec2_endpoint>;
-
-					dai-format = "i2s";
-					...
-				};
-			};
-		};
-	};
-
-
------------------------
-Example: Sampling Rate Conversion
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-		prefix = "codec";
-		routing = "codec Playback", "DAI0 Playback",
-			  "DAI0 Capture",   "codec Capture";
-		convert-rate = <48000>;
-
-		dais = <&cpu_port>;
-	};
-
-	audio-codec {
-		...
-		port {
-			codec_endpoint: endpoint {
-				remote-endpoint = <&cpu_endpoint>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint: endpoint {
-				remote-endpoint = <&codec_endpoint>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
------------------------
-Example: 2 CPU 1 Codec (Mixing)
------------------------
-
-	sound_card {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-		routing = "codec Playback", "DAI0 Playback",
-			  "codec Playback", "DAI1 Playback",
-			  "DAI0 Capture",   "codec Capture";
-
-		dais = <&cpu_port>;
-	};
-
-	audio-codec {
-		...
-
-		audio-graph-card,prefix = "codec";
-		audio-graph-card,convert-rate = <48000>;
-		port {
-			reg = <0>;
-			codec_endpoint0: endpoint@0 {
-				remote-endpoint = <&cpu_endpoint0>;
-			};
-			codec_endpoint1: endpoint@1 {
-				remote-endpoint = <&cpu_endpoint1>;
-			};
-		};
-	};
-
-	dai-controller {
-		...
-		cpu_port: port {
-			cpu_endpoint0: endpoint@0 {
-				remote-endpoint = <&codec_endpoint0>;
-
-				dai-format = "left_j";
-				...
-			};
-			cpu_endpoint1: endpoint@1 {
-				remote-endpoint = <&codec_endpoint1>;
-
-				dai-format = "left_j";
-				...
-			};
-		};
-	};
-
------------------------
-Example: Multi DAI with DPCM
------------------------
-
-	CPU0 ------ ak4613
-	CPU1 ------ HDMI
-	CPU2 ------ PCM3168A-p	/* DPCM 1ch/2ch */
-	CPU3 --/		/* DPCM 3ch/4ch */
-	CPU4 --/		/* DPCM 5ch/6ch */
-	CPU5 --/		/* DPCM 7ch/8ch */
-	CPU6 ------ PCM3168A-c
-
-	sound_card: sound {
-		compatible = "audio-graph-card";
-
-		label = "sound-card";
-
-		routing =	"pcm3168a Playback", "DAI2 Playback",
-				"pcm3168a Playback", "DAI3 Playback",
-				"pcm3168a Playback", "DAI4 Playback",
-				"pcm3168a Playback", "DAI5 Playback";
-
-		dais = <&snd_port0	/* ak4613 */
-			&snd_port1	/* HDMI0  */
-			&snd_port2	/* pcm3168a playback */
-			&snd_port3	/* pcm3168a capture  */
-			>;
-	};
-
-	ak4613: codec@10 {
-		...
-		port {
-			ak4613_endpoint: endpoint {
-				remote-endpoint = <&rsnd_endpoint0>;
-			};
-		};
-	};
-
-	pcm3168a: audio-codec@44 {
-		...
-		audio-graph-card,prefix = "pcm3168a";
-		audio-graph-card,convert-channels = <8>; /* TDM Split */
-		ports {
-			port@0 {
-				reg = <0>;
-				pcm3168a_endpoint_p1: endpoint@1 {
-					remote-endpoint = <&rsnd_endpoint2>;
-					...
-				};
-				pcm3168a_endpoint_p2: endpoint@2 {
-					remote-endpoint = <&rsnd_endpoint3>;
-					...
-				};
-				pcm3168a_endpoint_p3: endpoint@3 {
-					remote-endpoint = <&rsnd_endpoint4>;
-					...
-				};
-				pcm3168a_endpoint_p4: endpoint@4 {
-					remote-endpoint = <&rsnd_endpoint5>;
-					...
-				};
-			};
-			port@1 {
-				reg = <1>;
-				pcm3168a_endpoint_c: endpoint {
-					remote-endpoint = <&rsnd_endpoint6>;
-					...
-				};
-			};
-		};
-	};
-
-	&sound {
-		ports {
-			snd_port0: port@0 {
-				rsnd_endpoint0: endpoint {
-					remote-endpoint = <&ak4613_endpoint>;
-					...
-				};
-			};
-			snd_port1: port@1 {
-				rsnd_endpoint1: endpoint {
-					remote-endpoint = <&dw_hdmi0_snd_in>;
-					...
-				};
-			};
-			snd_port2: port@2 {
-				#address-cells = <1>;
-				#size-cells = <0>;
-				rsnd_endpoint2: endpoint@2 {
-					remote-endpoint = <&pcm3168a_endpoint_p1>;
-					...
-				};
-				rsnd_endpoint3: endpoint@3 {
-					remote-endpoint = <&pcm3168a_endpoint_p2>;
-					...
-				};
-				rsnd_endpoint4: endpoint@4 {
-					remote-endpoint = <&pcm3168a_endpoint_p3>;
-					...
-				};
-				rsnd_endpoint5: endpoint@5 {
-					remote-endpoint = <&pcm3168a_endpoint_p4>;
-					...
-				};
-			};
-			snd_port3: port@6 {
-				rsnd_endpoint6: endpoint {
-					remote-endpoint = <&pcm3168a_endpoint_c>;
-					...
-				};
-			};
-		};
-	};
Documentation/devicetree/bindings/sound/audio-graph-card.yaml new file +548 -0
new file mode 100644
index 0000000..d4b56bd
@@ -0,0 +1,548 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/audio-graph-card.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic audio graph card
+
+description: |
+  Audio Graph Card specifies audio DAI connections of SoC <-> codec.
+  It is based on common bindings for device graphs.
+  see ${LINUX}/Documentation/devicetree/bindings/graph.yaml
+
+  Basically, Audio Graph Card properties are similar to Simple Card.
+  see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.yaml
+  Common definitions required here are referenced from above.
+
+maintainers:
+  - Kuninori Morimoto <[email protected]>
+
+definitions:
+
+  end-point:
+    type: object
+    properties:
+      mclk-fs:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+      prefix:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/prefix
+
+      convert-rate:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-rate
+
+      convert-channels:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-channels
+
+      frame-inversion:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/frame-inversion
+
+      bitclock-inversion:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/bitclock-inversion
+
+      frame-master:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/frame-master
+
+      bitclock-master:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/bitclock-master
+
+      dai-tdm-slot-num:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/dai-tdm-slot-num
+
+      dai-tdm-slot-width:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/dai-tdm-slot-width
+
+      clocks:
+        maxItems: 1
+
+      system-clock-frequency:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/system-clock-frequency
+
+      system-clock-direction-out:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/system-clock-direction-out
+
+      dai-format:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/format
+
+      remote-endpoint:
+        description: phandle to an 'endpoint' subnode of a remote device node.
+        $ref: /schemas/types.yaml#/definitions/phandle
+
+  port:
+    type: object
+    description: |
+      If there is more than one 'port' or more than one 'endpoint' node
+      or 'reg' property present in the port and/or endpoint nodes then
+      '#address-cells' and '#size-cells' properties are required in relevant
+      parent node.
+    properties:
+      convert-rate:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-rate
+
+      convert-channels:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-channels
+
+      prefix:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/prefix
+
+      mclk-fs:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+    patternProperties:
+      "^endpoint(@[0-9a-f]+)?$":
+        type: object
+        $ref: "#/definitions/end-point"
+
+  ports:
+    type: object
+    properties:
+      convert-rate:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-rate
+
+      convert-channels:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/convert-channels
+
+      prefix:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/prefix
+
+      mclk-fs:
+        $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+    patternProperties:
+      "^port(@[0-9a-f]+)?$":
+        $ref: "#/definitions/port"
+
+properties:
+  compatible:
+    items:
+      - const: audio-graph-card
+
+  dais:
+    description: list of CPU DAI port{s}
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+
+  label:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/label
+
+  pa-gpios:
+    description: GPIO used to control external amplifier.
+
+  widgets:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/widgets
+
+  routing:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/routing
+
+  convert-rate:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/convert-rate
+
+  convert-channels:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/convert-channels
+
+  mclk-fs:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+  prefix:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/prefix
+
+  hp-det-gpio:
+    maxItems: 1
+
+  mic-det-gpio:
+    maxItems: 1
+
+  ports:
+    $ref: "#/definitions/ports"
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: "#/definitions/port"
+
+required:
+  - compatible
+  - dais
+
+additionalProperties: false
+
+examples:
+  # ---------------
+  # Single DAI case
+  # ---------------
+  - |
+    sound_card {
+        compatible = "audio-graph-card";
+
+        dais = <&cpu_port>;
+    };
+
+    dai-controller {
+        // ...
+
+        cpu_port: port {
+            cpu_endpoint: endpoint {
+                remote-endpoint = <&codec_endpoint>;
+
+                dai-format = "left_j";
+
+                // ...
+            };
+        };
+    };
+
+    audio-codec {
+        // ...
+
+        port {
+            codec_endpoint: endpoint {
+                remote-endpoint = <&cpu_endpoint>;
+            };
+        };
+    };
+
+  # --------------
+  # Multi DAI case
+  # --------------
+  - |
+    sound-card {
+        compatible = "audio-graph-card";
+
+        label = "sound-card";
+
+        dais = <&cpu_port0
+                &cpu_port1
+                &cpu_port2>;
+    };
+
+    audio-codec-0 {
+        // ...
+
+        port {
+            codec0_endpoint: endpoint {
+                remote-endpoint = <&cpu_endpoint0>;
+            };
+        };
+    };
+
+    audio-codec-1 {
+        // ...
+
+        port {
+            codec1_endpoint: endpoint {
+                remote-endpoint = <&cpu_endpoint1>;
+            };
+        };
+    };
+
+    audio-codec-2 {
+        // ...
+
+        port {
+            codec2_endpoint: endpoint {
+                remote-endpoint = <&cpu_endpoint2>;
+            };
+        };
+    };
+
+    dai-controller {
+        // ...
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            cpu_port0: port@0 {
+                reg = <0>;
+
+                cpu_endpoint0: endpoint {
+                    remote-endpoint = <&codec0_endpoint>;
+
+                    dai-format = "left_j";
+
+                    // ...
+                };
+            };
+            cpu_port1: port@1 {
+                reg = <1>;
+
+                cpu_endpoint1: endpoint {
+                    remote-endpoint = <&codec1_endpoint>;
+
+                    dai-format = "i2s";
+
+                    // ...
+                };
+            };
+            cpu_port2: port@2 {
+                reg = <2>;
+
+                cpu_endpoint2: endpoint {
+                    remote-endpoint = <&codec2_endpoint>;
+
+                    dai-format = "i2s";
+
+                    // ...
+                };
+            };
+        };
+    };
+
+  # ------------------------
+  # Sampling Rate Conversion
+  # ------------------------
+  - |
+    sound_card {
+        compatible = "audio-graph-card";
+
+        label = "sound-card";
+        prefix = "codec";
+        routing = "codec Playback", "DAI0 Playback",
+                  "DAI0 Capture",   "codec Capture";
+        convert-rate = <48000>;
+
+        dais = <&cpu_port_src>;
+    };
+
+    audio-codec {
+        // ...
+
+        port {
+            codec_endpoint_src: endpoint {
+                remote-endpoint = <&cpu_endpoint_src>;
+            };
+        };
+    };
+
+    dai-controller {
+        // ...
+
+        cpu_port_src: port {
+            cpu_endpoint_src: endpoint {
+                remote-endpoint = <&codec_endpoint_src>;
+
+                dai-format = "left_j";
+
+                // ...
+            };
+        };
+    };
+
+  # ----------------------
+  # 2 CPU 1 Codec (Mixing)
+  # ----------------------
+  - |
+    sound_card {
+        compatible = "audio-graph-card";
+
+        label = "sound-card";
+        routing = "codec Playback", "DAI0 Playback",
+                  "codec Playback", "DAI1 Playback",
+                  "DAI0 Capture",   "codec Capture";
+
+        dais = <&cpu_port_mix>;
+    };
+
+    audio-codec {
+        // ...
+
+        audio-graph-card,prefix = "codec";
+        audio-graph-card,convert-rate = <48000>;
+
+        port {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            codec_endpoint0_mix: endpoint@0 {
+                reg = <0>;
+
+                remote-endpoint = <&cpu_endpoint0_mix>;
+            };
+            codec_endpoint1_mix: endpoint@1 {
+                reg = <1>;
+
+                remote-endpoint = <&cpu_endpoint1_mix>;
+            };
+        };
+    };
+
+    dai-controller {
+        // ...
+
+        cpu_port_mix: port {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            cpu_endpoint0_mix: endpoint@0 {
+                reg = <0>;
+
+                remote-endpoint = <&codec_endpoint0_mix>;
+
+                dai-format = "left_j";
+
+                // ...
+            };
+            cpu_endpoint1_mix: endpoint@1 {
+                reg = <1>;
+
+                remote-endpoint = <&codec_endpoint1_mix>;
+
+                dai-format = "left_j";
+
+                // ...
+            };
+        };
+    };
+
+  # -------------------
+  # Multi DAI with DPCM
+  #
+  #  CPU0 ------ ak4613
+  #  CPU1 ------ HDMI
+  #  CPU2 ------ PCM3168A-p    /* DPCM 1ch/2ch */
+  #  CPU3 --/                  /* DPCM 3ch/4ch */
+  #  CPU4 --/                  /* DPCM 5ch/6ch */
+  #  CPU5 --/                  /* DPCM 7ch/8ch */
+  #  CPU6 ------ PCM3168A-c
+  # -------------------
+  - |
+    sound_card: sound {
+        compatible = "audio-graph-card";
+
+        label = "sound-card";
+
+        routing = "pcm3168a Playback", "DAI2 Playback",
+                  "pcm3168a Playback", "DAI3 Playback",
+                  "pcm3168a Playback", "DAI4 Playback",
+                  "pcm3168a Playback", "DAI5 Playback";
+
+        dais = <&snd_port0    /* ak4613 */
+                &snd_port1    /* HDMI0  */
+                &snd_port2    /* pcm3168a playback */
+                &snd_port3    /* pcm3168a capture  */
+                >;
+    };
+
+    ak4613: codec-10 {
+        // ...
+
+        port {
+            ak4613_endpoint: endpoint {
+                remote-endpoint = <&rsnd_endpoint0>;
+            };
+        };
+    };
+
+    pcm3168a: audio-codec-44 {
+        // ...
+
+        audio-graph-card,prefix = "pcm3168a";
+        audio-graph-card,convert-channels = <8>; /* TDM Split */
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                reg = <0>;
+                pcm3168a_endpoint_p1: endpoint@1 {
+                    reg = <1>;
+                    remote-endpoint = <&rsnd_endpoint2>;
+
+                    // ...
+                };
+                pcm3168a_endpoint_p2: endpoint@2 {
+                    reg = <2>;
+                    remote-endpoint = <&rsnd_endpoint3>;
+
+                    // ...
+                };
+                pcm3168a_endpoint_p3: endpoint@3 {
+                    reg = <3>;
+                    remote-endpoint = <&rsnd_endpoint4>;
+
+                    // ...
+                };
+                pcm3168a_endpoint_p4: endpoint@4 {
+                    reg = <4>;
+                    remote-endpoint = <&rsnd_endpoint5>;
+
+                    // ...
+                };
+            };
+            port@1 {
+                reg = <1>;
+                pcm3168a_endpoint_c: endpoint {
+                    remote-endpoint = <&rsnd_endpoint6>;
+
+                    // ...
+                };
+            };
+        };
+    };
+
+    dai-controller {
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            snd_port0: port@0 {
+                reg = <0>;
+                rsnd_endpoint0: endpoint {
+                    remote-endpoint = <&ak4613_endpoint>;
+
+                    // ...
+                };
+            };
+            snd_port1: port@1 {
+                reg = <1>;
+                rsnd_endpoint1: endpoint {
+                    remote-endpoint = <&dw_hdmi0_snd_in>;
+
+                    // ...
+                };
+            };
+            snd_port2: port@2 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                reg = <2>;
+                rsnd_endpoint2: endpoint@2 {
+                    reg = <2>;
+                    remote-endpoint = <&pcm3168a_endpoint_p1>;
+
+                    // ...
+                };
+                rsnd_endpoint3: endpoint@3 {
+                    reg = <3>;
+                    remote-endpoint = <&pcm3168a_endpoint_p2>;
+
+                    // ...
+                };
+                rsnd_endpoint4: endpoint@4 {
+                    reg = <4>;
+                    remote-endpoint = <&pcm3168a_endpoint_p3>;
+
+                    // ...
+                };
+                rsnd_endpoint5: endpoint@5 {
+                    reg = <5>;
+                    remote-endpoint = <&pcm3168a_endpoint_p4>;
+
+                    // ...
+                };
+            };
+            snd_port3: port@6 {
+                reg = <6>;
+                rsnd_endpoint6: endpoint {
+                    remote-endpoint = <&pcm3168a_endpoint_c>;
+
+                    // ...
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.7.4
#15 lore raw

Re: [PATCH v4 09/15] ASoC: dt-bindings: audio-graph: Convert bindings to json-schema

Hi Morimoto-san,

Quoted 9 lines
Quoted 7 lines

Convert device tree bindings of audio graph card to YAML format. Also expose some common definitions which can be used by similar graph based audio sound cards.

Cc Kuninori Morimoto <[email protected]>

---

I'm posting this patch to Rob & DT ML.
Not yet accepted, though..

Thanks for letting me know. I guess below is your patch,
http://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Do you have plans to resend this or send next revision?

I can drop my patch once yours is merged and refer the same for Tegra audio graph card.

Thanks,
Sameer.

#16 lore raw

Re: [PATCH v4 09/15] ASoC: dt-bindings: audio-graph: Convert bindings to json-schema

Hi Sameer

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines

Convert device tree bindings of audio graph card to YAML format. Also expose some common definitions which can be used by similar graph based audio sound cards.

Cc Kuninori Morimoto <[email protected]>

---

I'm posting this patch to Rob & DT ML.
Not yet accepted, though..

Quoted 6 lines

Thanks for letting me know. I guess below is your patch,
http://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Do you have plans to resend this or send next revision?

I can drop my patch once yours is merged and refer the same for Tegra audio graph card.

I'm waiting response from Rob now.
It is merge window now. I will re-post it without his response if -rc1 was released.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

maintainer
#17 lore raw

Re: [PATCH v4 09/15] ASoC: dt-bindings: audio-graph: Convert bindings to json-schema

Quoted 17 lines · Kuninori Morimoto

Hi Sameer

Quoted 14 lines
Quoted 9 lines
Quoted 7 lines

Convert device tree bindings of audio graph card to YAML format. Also expose some common definitions which can be used by similar graph based audio sound cards.

Cc Kuninori Morimoto <[email protected]>

---

I'm posting this patch to Rob & DT ML.
Not yet accepted, though..

Thanks for letting me know. I guess below is your patch,
http://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Do you have plans to resend this or send next revision?

Quoted 6 lines
Quoted 2 lines

I can drop my patch once yours is merged and refer the same for Tegra audio graph card.

I'm waiting response from Rob now.
It is merge window now. I will re-post it without his response if -rc1 was released.

Sorry, fell off my radar. Now replied.

Rob

#18 lore raw

PATCH v4 10/15 ASoC: dt-bindings: tegra: Add graph bindings

In reply to Sameer Pujar

Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.

---
 Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml  | 7 +++++++
 .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml          | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml  | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml  | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml   | 7 +++++++
 5 files changed, 35 insertions(+)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +7 -0
index ed2fb32..23875b1 100644
@@ -55,6 +55,13 @@ properties:
       The name can be "DSPK1" or "DSPKx", where x depends on the maximum
       available instances on a Tegra SoC.
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/sound/nvidia,tegra210-admaif.yaml +7 -0
index c028b25..26ba725 100644
@@ -37,6 +37,13 @@ properties:
 
   dma-names: true
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
 if:
   properties:
     compatible:
Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml +7 -0
index d772197..d6aa849 100644
@@ -56,6 +56,13 @@ properties:
 
   ranges: true
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml +7 -0
index 2a3207b..36232ed 100644
@@ -56,6 +56,13 @@ properties:
       The name can be "DMIC1" or "DMIC2" ... "DMICx", where x depends
       on the maximum available instances on a Tegra SoC.
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml +7 -0
index dfc1bf7..f5cdf33 100644
@@ -74,6 +74,13 @@ properties:
       The name can be "I2S1" or "I2S2" ... "I2Sx", where x depends
       on the maximum available instances on a Tegra SoC.
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
 required:
   - compatible
   - reg
Signature · 1 line
2.7.4
maintainer
#19 lore raw

Re: [PATCH v4 10/15] ASoC: dt-bindings: tegra: Add graph bindings

Quoted 18 lines · Sameer Pujar

Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.

---
 Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml  | 7 +++++++
 .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml          | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml  | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml  | 7 +++++++
 Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml   | 7 +++++++
 5 files changed, 35 insertions(+)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +0 -0
index ed2fb32..23875b1 100644

Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 63

Quoted 9 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +6 -0
@@ -55,6 +55,13 @@ properties:
       The name can be "DSPK1" or "DSPKx", where x depends on the maximum
       available instances on a Tegra SoC.
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port

You should have either 'ports' or a single 'port' (yes, the graph binding allowed multiple port nodes without 'ports', but that should be deprecated IMO)

#20 lore raw

Re: [PATCH v4 10/15] ASoC: dt-bindings: tegra: Add graph bindings

Quoted 26 lines
Quoted 25 lines

Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.

---
  Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml  | 7 +++++++
  .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml          | 7 +++++++
  Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml  | 7 +++++++
  Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml  | 7 +++++++
  Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml   | 7 +++++++
  5 files changed, 35 insertions(+)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +3 -0
index ed2fb32..23875b1 100644
@@ -55,6 +55,13 @@ properties:
        The name can be "DSPK1" or "DSPKx", where x depends on the maximum
        available instances on a Tegra SoC.
 
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/ports
+
Quoted 6 lines

Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 63

Quoted 3 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +3 -0
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port

You should have either 'ports' or a single 'port' (yes, the graph binding allowed multiple port nodes without 'ports', but that should be deprecated IMO)

OK, will drop this and just use 'port' here.

#21 lore raw

PATCH v4 11/15 ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card

In reply to Sameer Pujar

Add YAML schema for Tegra audio graph sound card DT bindings. It uses the same DT bindings provided by generic audio graph driver. Along with this few standard clock DT bindings are added which are specifically required for Tegra audio.

---
 .../sound/nvidia,tegra-audio-graph-card.yaml       | 158 +++++++++++++++++++++
 1 file changed, 158 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +158 -0
new file mode 100644
index 0000000..284d185
@@ -0,0 +1,158 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-graph-card.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph based Tegra sound card driver
+
+description: |
+  This is based on generic audio graph card driver along with additional
+  customizations for Tegra platforms. It uses the same bindings with
+  additional standard clock DT bindings required for Tegra.
+
+  See{LINUX}/Documentation/devicetree/bindings/sound/audio-graph-card.yaml
+
+maintainers:
+  - Jon Hunter <[email protected]>
+  - Sameer Pujar <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nvidia,tegra210-audio-graph-card
+          - nvidia,tegra186-audio-graph-card
+
+  dais:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/dais
+
+  label:
+    $ref: /schemas/sound/simple-card.yaml#/properties/label
+
+  pa-gpios:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/pa-gpios
+
+  widgets:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/widgets
+
+  routing:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/routing
+
+  mclk-fs:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+  prefix:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/prefix
+
+  clocks:
+   minItems: 2
+
+  clock-names:
+   minItems: 2
+   items:
+     - const: pll_a
+     - const: plla_out0
+
+  assigned-clocks:
+    minItems: 1
+    maxItems: 3
+
+  assigned-clock-parents:
+    minItems: 1
+    maxItems: 3
+
+  assigned-clock-rates:
+    minItems: 1
+    maxItems: 3
+
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port
+
+additionalProperties: false
+
+required:
+  - compatible
+  - dais
+  - clocks
+  - clock-names
+  - assigned-clocks
+  - assigned-clock-parents
+
+examples:
+  - |
+    #include<dt-bindings/clock/tegra210-car.h>
+
+    tegra_sound {
+        compatible = "nvidia,tegra210-audio-graph-card";
+
+        clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+                 <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+        clock-names = "pll_a", "plla_out0";
+
+        assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+                          <&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
+                          <&tegra_car TEGRA210_CLK_EXTERN1>;
+        assigned-clock-parents = <0>, <0>, <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+        assigned-clock-rates = <368640000>, <49152000>, <12288000>;
+
+        dais = /* FE */
+               <&admaif1_port>,
+               /* Router */
+               <&xbar_i2s1_port>,
+               /* I/O DAP Ports */
+               <&i2s1_port>;
+
+        label = "jetson-tx1-ape";
+    };
+
+    tegra_ahub: ahub@702d0800 {
+        // ...
+
+        reg = <0x702d0800 0x800>;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            xbar_i2s1_port: port@a {
+                reg = <0xa>;
+                xbar_i2s1_ep: endpoint {
+                    remote-endpoint = <&i2s1_cif_ep>;
+                };
+            };
+        };
+    };
+
+    tegra_i2s1: i2s@702d1000 {
+        // ...
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        reg = <0x702d1000 0x100>;
+
+        port@0 {
+            reg = <0>;
+
+            i2s1_cif_ep: endpoint {
+                remote-endpoint = <&xbar_i2s1_ep>;
+            };
+        };
+
+        i2s1_port: port@1 {
+            reg = <1>;
+
+            i2s1_dap: endpoint {
+                dai-format = "i2s";
+
+                // ...
+            };
+        };
+    };
+
+...
Signature · 1 line
2.7.4
maintainer
#22 lore raw

Re: [PATCH v4 11/15] ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card

Quoted 21 lines · Sameer Pujar

Add YAML schema for Tegra audio graph sound card DT bindings. It uses the same DT bindings provided by generic audio graph driver. Along with this few standard clock DT bindings are added which are specifically required for Tegra audio.

---
 .../sound/nvidia,tegra-audio-graph-card.yaml       | 158 +++++++++++++++++++++
 1 file changed, 158 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +4 -0
new file mode 100644
index 0000000..284d185
@@ -0,0 +1,158 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-graph-card.yaml#

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph based Tegra sound card driver
+
+description: |
+  This is based on generic audio graph card driver along with additional
+  customizations for Tegra platforms. It uses the same bindings with
+  additional standard clock DT bindings required for Tegra.
+
+  See{LINUX}/Documentation/devicetree/bindings/sound/audio-graph-card.yaml

You should be able to just $ref this at the top level.

Quoted 23 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +22 -0
+
+maintainers:
+  - Jon Hunter <[email protected]>
+  - Sameer Pujar <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nvidia,tegra210-audio-graph-card
+          - nvidia,tegra186-audio-graph-card
+
 
+  dais:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/dais
+
+  label:
+    $ref: /schemas/sound/simple-card.yaml#/properties/label
+
+  pa-gpios:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/pa-gpios
+
+  widgets:

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +10 -0
+    $ref: /schemas/sound/simple-card.yaml#/definitions/widgets
+
+  routing:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/routing
+
+  mclk-fs:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+  prefix:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/prefix

And drop all of these.

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 52

Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+
+  clocks:
+   minItems: 2
+
+  clock-names:
+   minItems: 2

Don't need this.

Quoted 12 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +12 -0
+   items:
+     - const: pll_a
+     - const: plla_out0
+
+  assigned-clocks:
+    minItems: 1
+    maxItems: 3
+
+  assigned-clock-parents:
+    minItems: 1
+    maxItems: 3
+

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 74

Quoted 10 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +10 -0
+  assigned-clock-rates:
+    minItems: 1
+    maxItems: 3
+
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port

And these can be dropped. Unless what each port is is Tegra specific.

Quoted 87 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +84 -0
+
+additionalProperties: false
+
+required:
+  - compatible
+  - dais
+  - clocks
+  - clock-names
+  - assigned-clocks
+  - assigned-clock-parents
+
+examples:
+  - |
+    #include<dt-bindings/clock/tegra210-car.h>
+
+    tegra_sound {
+        compatible = "nvidia,tegra210-audio-graph-card";
+
+        clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+                 <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+        clock-names = "pll_a", "plla_out0";
+
+        assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+                          <&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
+                          <&tegra_car TEGRA210_CLK_EXTERN1>;
+        assigned-clock-parents = <0>, <0>, <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+        assigned-clock-rates = <368640000>, <49152000>, <12288000>;
+
+        dais = /* FE */
+               <&admaif1_port>,
+               /* Router */
+               <&xbar_i2s1_port>,
+               /* I/O DAP Ports */
+               <&i2s1_port>;
+
+        label = "jetson-tx1-ape";
+    };
+
+    tegra_ahub: ahub@702d0800 {
+        // ...
+
+        reg = <0x702d0800 0x800>;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            xbar_i2s1_port: port@a {
+                reg = <0xa>;
+                xbar_i2s1_ep: endpoint {
+                    remote-endpoint = <&i2s1_cif_ep>;
+                };
+            };
+        };
+    };
+
+    tegra_i2s1: i2s@702d1000 {
+        // ...
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        reg = <0x702d1000 0x100>;
+
+        port@0 {
+            reg = <0>;
+
+            i2s1_cif_ep: endpoint {
+                remote-endpoint = <&xbar_i2s1_ep>;
+            };
+        };
+
+        i2s1_port: port@1 {
+            reg = <1>;
+
+            i2s1_dap: endpoint {
+                dai-format = "i2s";
+
+                // ...
+            };
+        };
+    };
+
+...
Signature · 1 line
2.7.4
#23 lore raw

Re: [PATCH v4 11/15] ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card

Quoted 25 lines
Quoted 25 lines

Add YAML schema for Tegra audio graph sound card DT bindings. It uses the same DT bindings provided by generic audio graph driver. Along with this few standard clock DT bindings are added which are specifically required for Tegra audio.

---
  .../sound/nvidia,tegra-audio-graph-card.yaml       | 158 +++++++++++++++++++++
  1 file changed, 158 insertions(+)

create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
new file mode 100644
index 0000000..284d185
@@ -0,0 +1,158 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-graph-card.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph based Tegra sound card driver
Quoted 8 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 14

Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
+
+description: |
+  This is based on generic audio graph card driver along with additional
+  customizations for Tegra platforms. It uses the same bindings with
+  additional standard clock DT bindings required for Tegra.
+
+  See{LINUX}/Documentation/devicetree/bindings/sound/audio-graph-card.yaml

You should be able to just $ref this at the top level.

I am seeing one problem while using $ref like below. allOf:
  - $ref: /schemas/sound/audio-graph-card.yaml

I see below while running doc validator. "Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.example.dt.yaml: tegra_sound: compatible:0: 'audio-graph-card' was expected"

Is there a way to avoid this?

Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +25 -0
+
+maintainers:
+  - Jon Hunter <[email protected]>
+  - Sameer Pujar <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nvidia,tegra210-audio-graph-card
+          - nvidia,tegra186-audio-graph-card
+
 
+  dais:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/dais
+
+  label:
+    $ref: /schemas/sound/simple-card.yaml#/properties/label
+
+  pa-gpios:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/pa-gpios
+
+  widgets:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/widgets
+
+  routing:
Quoted 8 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 46

Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
+    $ref: /schemas/sound/simple-card.yaml#/definitions/routing
+
+  mclk-fs:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+  prefix:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/prefix

And drop all of these.

Could not re-use because of above compatible problem. Also require some additional properties for Tegra.

Quoted 7 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 52

Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+
+  clocks:
+   minItems: 2
+
+  clock-names:
+   minItems: 2

Don't need this.

This is required for Tegra audio graph card to update clock rates at runtime.

Quoted 17 lines
Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+   items:
+     - const: pll_a
+     - const: plla_out0
+
+  assigned-clocks:
+    minItems: 1

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +10 -0
+    maxItems: 3
+
+  assigned-clock-parents:
+    minItems: 1
+    maxItems: 3
+
+  assigned-clock-rates:
+    minItems: 1
+    maxItems: 3
+

It is required for initialisation of above clocks with specific rates.

Quoted 7 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 74

Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port

And these can be dropped. Unless what each port is is Tegra specific.

May be I can drop this if I could just directly include audio-graph-card.yaml and extend required properties for Tegra.

maintainer
#24 lore raw

Re: [PATCH v4 11/15] ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card

Quoted 39 lines · Sameer Pujar
Quoted 26 lines
Quoted 26 lines

Add YAML schema for Tegra audio graph sound card DT bindings. It uses the same DT bindings provided by generic audio graph driver. Along with this few standard clock DT bindings are added which are specifically required for Tegra audio.

---
  .../sound/nvidia,tegra-audio-graph-card.yaml       | 158 +++++++++++++++++++++
  1 file changed, 158 insertions(+)

create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
new file mode 100644
index 0000000..284d185
@@ -0,0 +1,158 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-graph-card.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph based Tegra sound card driver
Quoted 8 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 14

Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
+
+description: |
+  This is based on generic audio graph card driver along with additional
+  customizations for Tegra platforms. It uses the same bindings with
+  additional standard clock DT bindings required for Tegra.
+
+  See{LINUX}/Documentation/devicetree/bindings/sound/audio-graph-card.yaml

You should be able to just $ref this at the top level.

I am seeing one problem while using $ref like below. allOf:
- $ref: /schemas/sound/audio-graph-card.yaml

Quoted 5 lines

I see below while running doc validator. "Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.example.dt.yaml:
tegra_sound: compatible:0: 'audio-graph-card' was expected"

Is there a way to avoid this?

Adjust the schemas so the constraints match. You can't say it must be one thing in one place and something else here. Your choices are:

- Drop compatible from audio-graph-card.yaml. You can define a 2nd schema that references audio-graph-card.yaml and defines the compatible.
- Use 'contains' in audio-graph-card.yaml and then make 'audio-graph-card' a fallback here.

The best option depends on what existing users have.

Quoted 45 lines
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +24 -0
+maintainers:
+  - Jon Hunter <[email protected]>
+  - Sameer Pujar <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nvidia,tegra210-audio-graph-card
+          - nvidia,tegra186-audio-graph-card
+
 
+  dais:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/dais
+
+  label:
+    $ref: /schemas/sound/simple-card.yaml#/properties/label
+
+  pa-gpios:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/pa-gpios
+
+  widgets:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/widgets
+
+  routing:
Quoted 8 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 46

Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +7 -0
+    $ref: /schemas/sound/simple-card.yaml#/definitions/routing
+
+  mclk-fs:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/mclk-fs
+
+  prefix:
+    $ref: /schemas/sound/simple-card.yaml#/definitions/prefix

And drop all of these.

Could not re-use because of above compatible problem. Also require some additional properties for Tegra.

Quoted 7 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 52

Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+
+  clocks:
+   minItems: 2
+
+  clock-names:
+   minItems: 2

Don't need this.

Quoted 2 lines

This is required for Tegra audio graph card to update clock rates at runtime.

I mean you can drop 'minItems: 2' as it is redundant. The 'items' list size implies the size.

Quoted 27 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +8 -0
+   items:
+     - const: pll_a
+     - const: plla_out0
+
+  assigned-clocks:
+    minItems: 1
+    maxItems: 3
+
Quoted 8 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 68

Quoted 8 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +8 -0
+  assigned-clock-parents:
+    minItems: 1
+    maxItems: 3
+
+  assigned-clock-rates:
+    minItems: 1
+    maxItems: 3
+

It is required for initialisation of above clocks with specific rates.

Quoted 7 lines

Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml line 74

Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +6 -0
+  ports:
+    $ref: /schemas/sound/audio-graph-card.yaml#/properties/ports
+
+patternProperties:
+  "^port(@[0-9a-f]+)?$":
+    $ref: /schemas/sound/audio-graph-card.yaml#/definitions/port

And these can be dropped. Unless what each port is is Tegra specific.

Quoted 2 lines

May be I can drop this if I could just directly include audio-graph-card.yaml and extend required properties for Tegra.

There are numerous examples of doing that.

Rob

#25 lore raw

PATCH v4 12/15 ASoC: tegra: Add audio graph based card driver

In reply to Sameer Pujar

Add Tegra audio machine driver which is based on generic audio graph card driver. It re-uses most of the common stuff from audio graph driver and uses the same DT binding. Required Tegra specific customizations are done in the driver and additional DT bindings are required for clock handling.

Details on the customizations done:

- Update PLL rates at runtime: Tegra HW supports multiple sample rates (multiples of 8x and 11.025x) and both of these groups require different PLL rates. Hence there is a requirement to update this at runtime. This is achieved by providing a custom 'snd_soc_ops' and in hw_param() callback PLL rate is updated as per the sample rate.

- Internal structure 'tegra_audio_graph_data' is used to maintain clock handles of PLL.

- The 'force_dpcm' flag is set to use DPCM for all DAI links.

- The 'component_chaining' flag is set to use DPCM with component model.

---
 sound/soc/tegra/Kconfig                  |   9 ++
 sound/soc/tegra/Makefile                 |   2 +
 sound/soc/tegra/tegra_audio_graph_card.c | 255 +++++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+)
 create mode 100644 sound/soc/tegra/tegra_audio_graph_card.c
sound/soc/tegra/Kconfig +9 -0
index 3d91bd3..9959605 100644
@@ -118,6 +118,15 @@ config SND_SOC_TEGRA210_ADMAIF
 	  channel. Buffer size is configurable for each ADMAIIF channel.
 	  Say Y or M if you want to add support for Tegra210 ADMAIF module.
 
+config SND_SOC_TEGRA_AUDIO_GRAPH_CARD
+	tristate "Audio Graph Card based Tegra driver"
+	depends on SND_AUDIO_GRAPH_CARD
+	help
+	  Config to enable Tegra audio machine driver based on generic
+	  audio graph driver. It is a thin driver written to customize
+	  few things for Tegra audio. Most of the code is re-used from
+	  audio graph driver and the same DT bindings are used.
+
 config SND_SOC_TEGRA_RT5640
 	tristate "SoC Audio support for Tegra boards using an RT5640 codec"
 	depends on SND_SOC_TEGRA && I2C && GPIOLIB
sound/soc/tegra/Makefile +2 -0
index 60040a0..b17dd6e 100644
@@ -38,6 +38,7 @@ snd-soc-tegra-trimslice-objs := trimslice.o
 snd-soc-tegra-alc5632-objs := tegra_alc5632.o
 snd-soc-tegra-max98090-objs := tegra_max98090.o
 snd-soc-tegra-sgtl5000-objs := tegra_sgtl5000.o
+snd-soc-tegra-audio-graph-card-objs := tegra_audio_graph_card.o
 
 obj-$(CONFIG_SND_SOC_TEGRA_RT5640) += snd-soc-tegra-rt5640.o
 obj-$(CONFIG_SND_SOC_TEGRA_RT5677) += snd-soc-tegra-rt5677.o
@@ -48,3 +49,4 @@ obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o
 obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o
 obj-$(CONFIG_SND_SOC_TEGRA_MAX98090) += snd-soc-tegra-max98090.o
 obj-$(CONFIG_SND_SOC_TEGRA_SGTL5000) += snd-soc-tegra-sgtl5000.o
+obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) += snd-soc-tegra-audio-graph-card.o
sound/soc/tegra/tegra_audio_graph_card.c new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
2.7.4
#26 lore raw

PATCH v4 13/15 arm64: defconfig: Enable Tegra audio graph card driver

In reply to Sameer Pujar

This commit enables Tegra audio graph card driver which is based on the generic audio-graph card driver. This is intended to be used on platforms based on Tegra210 and later chips.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 17a2df6..903fba8 100644
@@ -713,6 +713,7 @@ CONFIG_SND_SOC_TEGRA210_DMIC=m
 CONFIG_SND_SOC_TEGRA210_I2S=m
 CONFIG_SND_SOC_TEGRA186_DSPK=m
 CONFIG_SND_SOC_TEGRA210_ADMAIF=m
+CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD=m
 CONFIG_SND_SOC_AK4613=m
 CONFIG_SND_SOC_ES7134=m
 CONFIG_SND_SOC_ES7241=m
Signature · 1 line
2.7.4
#27 lore raw

PATCH v4 14/15 arm64: tegra: Audio graph header for Tegra210

In reply to Sameer Pujar

Expose a header which describes DT bindings required to use audio-graph based sound card. All Tegra210 based platforms can include this header and add platform specific information. Currently, from SoC point of view, all links are exposed for ADMAIF, AHUB, I2S and DMIC components.

---
 .../boot/dts/nvidia/tegra210-audio-graph.dtsi      | 153 +++++++++++++++++++++
 1 file changed, 153 insertions(+)
 create mode 100644 arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi
arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi new file +153 -0
new file mode 100644
index 0000000..5c54358
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+	tegra_sound {
+		status = "disabled";
+
+		clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+			 <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+		clock-names = "pll_a", "plla_out0";
+
+		assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
+				  <&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
+				  <&tegra_car TEGRA210_CLK_EXTERN1>;
+		assigned-clock-parents = <0>, <0>, <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+		assigned-clock-rates = <368640000>, <49152000>, <12288000>;
+	};
+};
+
+&tegra_admaif {
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		admaif1_port: port@0 {
+			reg = <0>;
+			admaif1_ep: endpoint {
+				remote-endpoint = <&xbar_admaif1_ep>;
+			};
+		};
+		admaif2_port: port@1 {
+			reg = <1>;
+			admaif2_ep: endpoint {
+				remote-endpoint = <&xbar_admaif2_ep>;
+			};
+		};
+		admaif3_port: port@2 {
+			reg = <2>;
+			admaif3_ep: endpoint {
+				remote-endpoint = <&xbar_admaif3_ep>;
+			};
+		};
+		admaif4_port: port@3 {
+			reg = <3>;
+			admaif4_ep: endpoint {
+				remote-endpoint = <&xbar_admaif4_ep>;
+			};
+		};
+		admaif5_port: port@4 {
+			reg = <4>;
+			admaif5_ep: endpoint {
+				remote-endpoint = <&xbar_admaif5_ep>;
+			};
+		};
+		admaif6_port: port@5 {
+			reg = <5>;
+			admaif6_ep: endpoint {
+				remote-endpoint = <&xbar_admaif6_ep>;
+			};
+		};
+		admaif7_port: port@6 {
+			reg = <6>;
+			admaif7_ep: endpoint {
+				remote-endpoint = <&xbar_admaif7_ep>;
+			};
+		};
+		admaif8_port: port@7 {
+			reg = <7>;
+			admaif8_ep: endpoint {
+				remote-endpoint = <&xbar_admaif8_ep>;
+			};
+		};
+		admaif9_port: port@8 {
+			reg = <8>;
+			admaif9_ep: endpoint {
+				remote-endpoint = <&xbar_admaif9_ep>;
+			};
+		};
+		admaif10_port: port@9 {
+			reg = <9>;
+			admaif10_ep: endpoint {
+				remote-endpoint = <&xbar_admaif10_ep>;
+			};
+		};
+	};
+};
+
+&tegra_ahub {
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0x0>;
+			xbar_admaif1_ep: endpoint {
+				remote-endpoint = <&admaif1_ep>;
+			};
+		};
+		port@1 {
+			reg = <0x1>;
+			xbar_admaif2_ep: endpoint {
+				remote-endpoint = <&admaif2_ep>;
+			};
+		};
+		port@2 {
+			reg = <0x2>;
+			xbar_admaif3_ep: endpoint {
+				remote-endpoint = <&admaif3_ep>;
+			};
+		};
+		port@3 {
+			reg = <0x3>;
+			xbar_admaif4_ep: endpoint {
+				remote-endpoint = <&admaif4_ep>;
+			};
+		};
+		port@4 {
+			reg = <0x4>;
+			xbar_admaif5_ep: endpoint {
+				remote-endpoint = <&admaif5_ep>;
+			};
+		};
+		port@5 {
+			reg = <0x5>;
+			xbar_admaif6_ep: endpoint {
+				remote-endpoint = <&admaif6_ep>;
+			};
+		};
+		port@6 {
+			reg = <0x6>;
+			xbar_admaif7_ep: endpoint {
+				remote-endpoint = <&admaif7_ep>;
+			};
+		};
+		port@7 {
+			reg = <0x7>;
+			xbar_admaif8_ep: endpoint {
+				remote-endpoint = <&admaif8_ep>;
+			};
+		};
+		port@8 {
+			reg = <0x8>;
+			xbar_admaif9_ep: endpoint {
+				remote-endpoint = <&admaif9_ep>;
+			};
+		};
+		port@9 {
+			reg = <0x9>;
+			xbar_admaif10_ep: endpoint {
+				remote-endpoint = <&admaif10_ep>;
+			};
+		};
+	};
+};
Signature · 1 line
2.7.4
#28 lore raw

PATCH v4 15/15 arm64: tegra: Audio graph sound card for Jetson Nano and TX1

In reply to Sameer Pujar

Enable support for audio-graph based sound card on Jetson-Nano and Jetson-TX1. Depending on the platform, required I/O interfaces are enabled.

* Jetson-Nano: Enable I2S3, I2S4, DMIC1 and DMIC2.
* Jetson-TX1: Enable all I2S and DMIC interfaces.

---
 arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 262 +++++++++++++++++++++
 arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 146 ++++++++++++
 2 files changed, 408 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts +262 -0
index 4c9c2a0..dab24b4 100644
@@ -3,6 +3,7 @@
 
 #include "tegra210-p2180.dtsi"
 #include "tegra210-p2597.dtsi"
+#include "tegra210-audio-graph.dtsi"
 
 / {
 	model = "NVIDIA Jetson TX1 Developer Kit";
@@ -127,4 +128,265 @@
 			status = "okay";
 		};
 	};
+
+	tegra_sound {
+		status = "okay";
+
+		compatible = "nvidia,tegra210-audio-graph-card";
+
+		dais = /* FE */
+		       <&admaif1_port>, <&admaif2_port>, <&admaif3_port>,
+		       <&admaif4_port>, <&admaif5_port>, <&admaif6_port>,
+		       <&admaif7_port>, <&admaif8_port>, <&admaif9_port>,
+		       <&admaif10_port>,
+		       /* Router */
+		       <&xbar_i2s1_port>, <&xbar_i2s2_port>, <&xbar_i2s3_port>,
+		       <&xbar_i2s4_port>, <&xbar_i2s5_port>, <&xbar_dmic1_port>,
+		       <&xbar_dmic2_port>, <&xbar_dmic3_port>,
+		       /* I/O DAP Ports */
+		       <&i2s1_port>, <&i2s2_port>, <&i2s3_port>, <&i2s4_port>,
+		       <&i2s5_port>, <&dmic1_port>, <&dmic2_port>, <&dmic3_port>;
+
+		label = "jetson-tx1-ape";
+	};
+};
+
+&tegra_admaif {
+	status = "okay";
+};
+
+&tegra_ahub {
+	status = "okay";
+
+	ports {
+		xbar_i2s1_port: port@a {
+			reg = <0xa>;
+			xbar_i2s1_ep: endpoint {
+				remote-endpoint = <&i2s1_cif_ep>;
+			};
+		};
+		xbar_i2s2_port: port@b {
+			reg = <0xb>;
+			xbar_i2s2_ep: endpoint {
+				remote-endpoint = <&i2s2_cif_ep>;
+			};
+		};
+		xbar_i2s3_port: port@c {
+			reg = <0xc>;
+			xbar_i2s3_ep: endpoint {
+				remote-endpoint = <&i2s3_cif_ep>;
+			};
+		};
+		xbar_i2s4_port: port@d {
+			reg = <0xd>;
+			xbar_i2s4_ep: endpoint {
+				remote-endpoint = <&i2s4_cif_ep>;
+			};
+		};
+		xbar_i2s5_port: port@e {
+			reg = <0xe>;
+			xbar_i2s5_ep: endpoint {
+				remote-endpoint = <&i2s5_cif_ep>;
+			};
+		};
+		xbar_dmic1_port: port@f {
+			reg = <0xf>;
+			xbar_dmic1_ep: endpoint {
+				remote-endpoint = <&dmic1_cif_ep>;
+			};
+		};
+		xbar_dmic2_port: port@10 {
+			reg = <0x10>;
+			xbar_dmic2_ep: endpoint {
+				remote-endpoint = <&dmic2_cif_ep>;
+			};
+		};
+		xbar_dmic3_port: port@11 {
+			reg = <0x11>;
+			xbar_dmic3_ep: endpoint {
+				remote-endpoint = <&dmic3_cif_ep>;
+			};
+		};
+	};
+};
+
+&tegra_i2s1 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			i2s1_cif_ep: endpoint {
+				remote-endpoint = <&xbar_i2s1_ep>;
+			};
+		};
+		i2s1_port: port@1 {
+			reg = <1>;
+			i2s1_dap: endpoint {
+				dai-format = "i2s";
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_i2s2 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			i2s2_cif_ep: endpoint {
+				remote-endpoint = <&xbar_i2s2_ep>;
+			};
+		};
+		i2s2_port: port@1 {
+			reg = <1>;
+			i2s2_dap: endpoint {
+				dai-format = "i2s";
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_i2s3 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			i2s3_cif_ep: endpoint {
+				remote-endpoint = <&xbar_i2s3_ep>;
+			};
+		};
+		i2s3_port: port@1 {
+			reg = <1>;
+			i2s3_dap_ep: endpoint {
+				dai-format = "i2s";
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_i2s4 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			i2s4_cif_ep: endpoint {
+				remote-endpoint = <&xbar_i2s4_ep>;
+			};
+		};
+		i2s4_port: port@1 {
+			reg = <1>;
+			i2s4_dap: endpoint {
+				dai-format = "i2s";
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_i2s5 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			i2s5_cif_ep: endpoint {
+				remote-endpoint = <&xbar_i2s5_ep>;
+			};
+		};
+		i2s5_port: port@1 {
+			reg = <1>;
+			i2s5_dap: endpoint {
+				dai-format = "i2s";
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_dmic1 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			dmic1_cif_ep: endpoint {
+				remote-endpoint = <&xbar_dmic1_ep>;
+			};
+		};
+		dmic1_port: port@1 {
+			reg = <1>;
+			dmic1_dap: endpoint {
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_dmic2 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			dmic2_cif_ep: endpoint {
+				remote-endpoint = <&xbar_dmic2_ep>;
+			};
+		};
+		dmic2_port: port@1 {
+			reg = <1>;
+			dmic2_dap: endpoint {
+				/* Placeholder for external Codec */
+			};
+		};
+	};
+};
+
+&tegra_dmic3 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			dmic3_cif_ep: endpoint {
+				remote-endpoint = <&xbar_dmic3_ep>;
+			};
+		};
+		dmic3_port: port@1 {
+			reg = <1>;
+			dmic3_dap: endpoint {
+				/* Placeholder for external Codec */
+			};
+		};
+	};
 };
arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts +146 -0

156 lines not on this page · raw message

Signature · 1 line
2.7.4
#29 lore raw
In reply to Sameer Pujar

Hi Mark, Morimoto-san,

Quoted 68 lines

Summary of changes:
* Support multiple instances of a component. For example there can be multiple I2S devices which can use the same component driver.

* Support open platforms with empty Codec endpoint. Customers can plug their own HW and can populate codec endpoint.

* In a component model there can be many components which can be connected togethe. In such cases Identify no-pcm DPCM DAI links which can be used in BE<->BE connections.

* Add Tegra audio graph driver which is based on generic audio graph driver and specific customizations are done in Tegra driver.

* This pushes DT support for Tegra210 based platforms which uses audio-graph card and above enhancements.

The series is based on following references where DPCM usgae for Tegra Audio and simple-card driver proposal were discussed.

* https://lkml.org/lkml/2020/4/30/519 (DPCM for Tegra)
* https://lkml.org/lkml/2020/6/27/4 (simple-card driver)

Changelog
=========

v3 -> v4
--------
* Added new patches to convert graph.txt and audio-graph-card.txt to corresponding json-schema files. Later these references are used in Tegra audio graph schema.

* AHUB component binding docs are updated to reflect the usage of ports/port/endpoint

* More common stuff is moved into graph_parse_of() and this is used by both generic and Tegra audio graph.

* DT binding for Tegra audio graph is updated to included "ports { }"

* As per the suggestion 'void *data' member is dropped from 'asoc_simple_priv' and instead container method is used to maintain required custom data internal to Tegra audio graph.

v2 -> v3
--------
* Dropped new compatible addition in generic graph driver after reviewing it with Morimoto-san. Instead added Tegra audio graph driver and new compatibles are added in the same.
* Added new patches to expose new members for customization in audio graph driver.
* Added new patch for Tegra audio graph driver and related documentation.
* Minor change in below commit where mutex version of helper is used "ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM"
* DT binding is updated to use the newly exposed compatibles
* No changes in other patches

v1 -> v2
--------
* Re-organized ports/endpoints description for ADMAIF and XBAR. Updated DT patches accordingly.
* After above change, multiple Codec endpoint support is not required and hence dropped for now. This will be considered separately if at all required in future.
* Re-ordered patches in the series.

Quoted 8 lines

Sameer Pujar (15):
ASoC: soc-core: Fix component name_prefix parsing
ASoC: soc-pcm: Get all BEs along DAPM path
ASoC: audio-graph: Use of_node and DAI for DPCM DAI link names
ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM
ASoC: audio-graph: Support empty Codec endpoint
ASoC: audio-graph: Expose new members for asoc_simple_priv
ASoC: audio-graph: Expose helpers from audio graph

Would you suggest to keep above in a separate series and thus not blocked by below doc updates? If so do I need to resend above in a next revision or if these are good to be picked up?

Quoted 4 lines

Documentation: of: Convert graph bindings to json-schema
ASoC: dt-bindings: audio-graph: Convert bindings to json-schema
ASoC: dt-bindings: tegra: Add graph bindings
ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card

Documentation patches in the series have some dependency over Morimoto-san's audio-graph series https://patchwork.kernel.org/project/alsa-devel/list/?series=372759. I will update doc related patches once dependency is merged.

Quoted 4 lines

ASoC: tegra: Add audio graph based card driver
arm64: defconfig: Enable Tegra audio graph card driver
arm64: tegra: Audio graph header for Tegra210
arm64: tegra: Audio graph sound card for Jetson Nano and TX1

maintainer
#30 lore raw
Quoted 11 lines · Sameer Pujar

Hi Mark, Morimoto-san,

Quoted 8 lines

Sameer Pujar (15):
ASoC: soc-core: Fix component name_prefix parsing
ASoC: soc-pcm: Get all BEs along DAPM path
ASoC: audio-graph: Use of_node and DAI for DPCM DAI link names
ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM
ASoC: audio-graph: Support empty Codec endpoint
ASoC: audio-graph: Expose new members for asoc_simple_priv
ASoC: audio-graph: Expose helpers from audio graph

Quoted 3 lines

Would you suggest to keep above in a separate series and thus not blocked by below doc updates? If so do I need to resend above in a next revision or if these are good to be picked up?

It's probably better to split things up given that the dependencies for the last bit are on another series.