Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: audio-graph-card2: Introduce playback-only/capture-only DAI link flags

We need this to support MICFIL PDM found on i.MX8MP where the DAI link
supports only capture direction.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20231128081119.106360-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Daniel Baluta and committed by
Mark Brown
d29351e8 6475b8e1

+28
+3
include/sound/simple_card_utils.h
··· 195 195 int graph_util_parse_dai(struct device *dev, struct device_node *ep, 196 196 struct snd_soc_dai_link_component *dlc, int *is_single_link); 197 197 198 + int graph_util_parse_link_direction(struct device_node *np, 199 + bool *is_playback_only, bool *is_capture_only); 200 + 198 201 #ifdef DEBUG 199 202 static inline void simple_util_debug_dai(struct simple_util_priv *priv, 200 203 char *name,
+6
sound/soc/generic/audio-graph-card2.c
··· 760 760 struct device_node *ep; 761 761 struct device_node *ports; 762 762 unsigned int daifmt = 0, daiclk = 0; 763 + bool playback_only = 0, capture_only = 0; 763 764 unsigned int bit_frame = 0; 764 765 765 766 if (graph_lnk_is_multi(port)) { ··· 798 797 daiclk = snd_soc_daifmt_clock_provider_from_bitmap(bit_frame); 799 798 if (is_cpu_node) 800 799 daiclk = snd_soc_daifmt_clock_provider_flipped(daiclk); 800 + 801 + graph_util_parse_link_direction(port, &playback_only, &capture_only); 802 + 803 + dai_link->playback_only = playback_only; 804 + dai_link->capture_only = capture_only; 801 805 802 806 dai_link->dai_fmt = daifmt | daiclk; 803 807 dai_link->init = simple_util_dai_init;
+19
sound/soc/generic/simple-card-utils.c
··· 1129 1129 } 1130 1130 EXPORT_SYMBOL_GPL(graph_util_parse_dai); 1131 1131 1132 + int graph_util_parse_link_direction(struct device_node *np, 1133 + bool *playback_only, bool *capture_only) 1134 + { 1135 + bool is_playback_only = false; 1136 + bool is_capture_only = false; 1137 + 1138 + is_playback_only = of_property_read_bool(np, "playback-only"); 1139 + is_capture_only = of_property_read_bool(np, "capture-only"); 1140 + 1141 + if (is_playback_only && is_capture_only) 1142 + return -EINVAL; 1143 + 1144 + *playback_only = is_playback_only; 1145 + *capture_only = is_capture_only; 1146 + 1147 + return 0; 1148 + } 1149 + EXPORT_SYMBOL_GPL(graph_util_parse_link_direction); 1150 + 1132 1151 /* Module information */ 1133 1152 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); 1134 1153 MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");