[PATCH v2 0/2] Introduce playback-only/capture-only DAI link
From: Daniel Baluta daniel.baluta@nxp.com
This patchseries allows users to specify a link only direction with audio-graph-card2.
Changes since v1 - https://lore.kernel.org/lkml/20230801082433.548206-1-daniel.baluta@oss.nxp.c... - used audio-graph-card2 instead of simple-card as we are deprecting simple-card.
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(+)
From: Daniel Baluta daniel.baluta@nxp.com
We need this to signal that DAI link supports only one direction that can only be either playback or capture.
Signed-off-by: Daniel Baluta daniel.baluta@nxp.com --- 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(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index e5da10b4c43b..ad67957b7b48 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -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, diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 7146611df730..04c2eac881c2 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -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; diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index cfa70a56ff0f..9006ef5e95f5 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -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 kuninori.morimoto.gx@renesas.com"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
From: Daniel Baluta daniel.baluta@nxp.com
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.
Signed-off-by: Daniel Baluta daniel.baluta@nxp.com --- .../devicetree/bindings/sound/audio-graph-port.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml index 60b5e3fd1115..0aaa8a29fce2 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml @@ -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:
On Thu, 23 Nov 2023 17:00:12 +0200, Daniel Baluta wrote:
From: Daniel Baluta daniel.baluta@nxp.com
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.
Signed-off-by: Daniel Baluta daniel.baluta@nxp.com
.../devicetree/bindings/sound/audio-graph-port.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors: ./Documentation/devicetree/bindings/sound/audio-graph-port.yaml:22:6: [error] syntax error: expected <block end>, but found '<block mapping start>' (syntax) ./Documentation/devicetree/bindings/sound/audio-graph-port.yaml:23:9: [warning] wrong indentation: expected 7 but found 8 (indentation) ./Documentation/devicetree/bindings/sound/audio-graph-port.yaml:26:9: [warning] wrong indentation: expected 7 but found 8 (indentation)
dtschema/dtc warnings/errors: make[2]: *** Deleting file 'Documentation/devicetree/bindings/sound/audio-graph-port.example.dts' Documentation/devicetree/bindings/sound/audio-graph-port.yaml:22:6: did not find expected key make[2]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/sound/audio-graph-port.example.dts] Error 1 make[2]: *** Waiting for unfinished jobs.... /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/socionext,uniphier-evea.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/cirrus,cs42l51.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/ak4613.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/ti,pcm3168a.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/rockchip-i2s.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/marvell,mmp-sspa.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/st,stm32-i2s.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/sgtl5000.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/wlf,wm8962.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/socionext,uniphier-aio.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/st,stm32-sai.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/everest,es8316.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 ./Documentation/devicetree/bindings/sound/audio-graph-port.yaml:22:6: did not find expected key /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/ti,tlv320aic3x.yaml: while parsing a block mapping in "<unicode string>", line 16, column 5 did not find expected key in "<unicode string>", line 22, column 6 /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/audio-graph-port.yaml: ignoring, error parsing file make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1424: dt_binding_check] Error 2 make: *** [Makefile:234: __sub-make] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/2023112315001...
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
participants (2)
-
Daniel Baluta
-
Rob Herring