Skip to contentSkip to conversation

Introduce playback-only/capture-only DAI link flags

PATCH Superseded Daniel Baluta 2 participants 4 messages Nov 23, 2023 – Nov 24, 2023

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Introduce playback-only/capture-only DAI link flags

From: Daniel Baluta <[email protected]>

This patchseries allows users to specify a link only direction with audio-graph-card2.

Changes since v1 - https://lore.kernel.org/lkml/[email protected]/T/
- used audio-graph-card2 instead of simple-card as we are deprecting simple-card.

Changes since v2:
- Fix device tree binding error reported by Rob

Daniel Baluta (2):
ASoC: audio-graph-card2: Introduce playback-only/capture only DAI link
flags
ASoC: dt-bindings: audio-graph-port: Document new DAI link flags
playback-only/capture-only

 .../bindings/sound/audio-graph-port.yaml      |  6 ++++++
 include/sound/simple_card_utils.h             |  3 +++
 sound/soc/generic/audio-graph-card2.c         |  6 ++++++
 sound/soc/generic/simple-card-utils.c         | 19 +++++++++++++++++++
 4 files changed, 34 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/2 ASoC: audio-graph-card2: Introduce playback-only/capture only DAI link flags

From: Daniel Baluta <[email protected]>

We need this to signal that DAI link supports only one direction that can only be either playback or capture.

---
 include/sound/simple_card_utils.h     |  3 +++
 sound/soc/generic/audio-graph-card2.c |  6 ++++++
 sound/soc/generic/simple-card-utils.c | 19 +++++++++++++++++++
 3 files changed, 28 insertions(+)
include/sound/simple_card_utils.h +3 -0
index e5da10b4c43b..ad67957b7b48 100644
@@ -195,6 +195,9 @@ int graph_util_is_ports0(struct device_node *port);
 int graph_util_parse_dai(struct device *dev, struct device_node *ep,
 			 struct snd_soc_dai_link_component *dlc, int *is_single_link);
 
+int graph_util_parse_link_direction(struct device_node *np,
+				    bool *is_playback_only, bool *is_capture_only);
+
 #ifdef DEBUG
 static inline void simple_util_debug_dai(struct simple_util_priv *priv,
 					 char *name,
sound/soc/generic/audio-graph-card2.c +6 -0
index 7146611df730..04c2eac881c2 100644
@@ -597,6 +597,7 @@ static void graph_link_init(struct simple_util_priv *priv,
 	struct device_node *ep;
 	struct device_node *ports;
 	unsigned int daifmt = 0, daiclk = 0;
+	bool playback_only = 0, capture_only = 0;
 	unsigned int bit_frame = 0;
 
 	if (graph_lnk_is_multi(port)) {
@@ -635,6 +636,11 @@ static void graph_link_init(struct simple_util_priv *priv,
 	if (is_cpu_node)
 		daiclk = snd_soc_daifmt_clock_provider_flipped(daiclk);
 
+	graph_util_parse_link_direction(port, &playback_only, &capture_only);
+
+	dai_link->playback_only = playback_only;
+	dai_link->capture_only = capture_only;
+
 	dai_link->dai_fmt	= daifmt | daiclk;
 	dai_link->init		= simple_util_dai_init;
 	dai_link->ops		= &graph_ops;
sound/soc/generic/simple-card-utils.c +19 -0
index cfa70a56ff0f..9006ef5e95f5 100644
@@ -1129,6 +1129,25 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep,
 }
 EXPORT_SYMBOL_GPL(graph_util_parse_dai);
 
+int graph_util_parse_link_direction(struct device_node *np,
+				    bool *playback_only, bool *capture_only)
+{
+	bool is_playback_only = false;
+	bool is_capture_only = false;
+
+	is_playback_only = of_property_read_bool(np, "playback-only");
+	is_capture_only = of_property_read_bool(np, "capture-only");
+
+	if (is_playback_only && is_capture_only)
+		return -EINVAL;
+
+	*playback_only = is_playback_only;
+	*capture_only = is_capture_only;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(graph_util_parse_link_direction);
+
 /* Module information */
 MODULE_AUTHOR("Kuninori Morimoto <[email protected]>");
 MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v3 1/2] ASoC: audio-graph-card2: Introduce playback-only/capture only DAI link flags

Quoted 5 lines · Daniel Baluta

From: Daniel Baluta <[email protected]>

We need this to signal that DAI link supports only one direction that can only be either playback or capture.
---

You've not provided a Signed-off-by for this so I can't do anything with it, please see Documentation/process/submitting-patches.rst for details on what this is and why it's important.

It'd be good if the changelog explained why we need this.

#3 lore raw

PATCH v3 2/2 ASoC: dt-bindings: audio-graph-port: Document new DAI link flags playback-only/capture-only

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

Document new playback-only and capture-only flags which can be used when dai link can only support just one direction: playback or capture but not both.

---
 .../devicetree/bindings/sound/audio-graph-port.yaml         | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +6 -0
index 60b5e3fd1115..b13c08de505e 100644
@@ -19,6 +19,12 @@ definitions:
     properties:
       mclk-fs:
         $ref: simple-card.yaml#/definitions/mclk-fs
+      playback-only:
+        description: port connection used only for playback
+        $ref: /schemas/types.yaml#/definitions/flag
+      capture-only:
+        description: port connection used only for capture
+        $ref: /schemas/types.yaml#/definitions/flag
 
   endpoint-base:
     allOf:
Signature · 1 line
2.25.1