summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2025-01-14 22:56:17 +0100
committerMark Brown <broonie@kernel.org>2025-01-15 13:11:19 +0000
commite436d43551764bd6ca22a1ab1e80e98939b8aec7 (patch)
treec14036b3dcfbecb980bb68cfdd3181e76833ee7b
parentd4e91adfc261de1454538ee6437e6014a2d1fca1 (diff)
ASoC: dapm: add support for preparing streams
Codec driver can implement .hw_params and/or .prepare from struct snd_soc_dai_ops. For codec-to-codec links only the former (.hw_params) callback has been called. On platforms like Amlogic Meson8/8b/8m2 the SoC's sound card (sound/soc/meson/gx-card.c) uses a codec-to-codec link for the HDMI codec output because further digital routing is required after the backend. The new DRM HDMI (audio) codec framework (which internally uses sound/soc/codecs/hdmi-codec.c) relies on the .prepare callback of the hdmi-codec to be called. Implement calls to snd_soc_dai_prepare() so the .prepare callback is called. In this case the mandatory part is the call to prepare the sink (which is the hdmi-codec on those platforms). Also call snd_soc_dai_prepare() for the source to stay consistent with the rest of the code (even though it's not strictly necessary to make the DRM HDMI codec framework work on Amlogic Meson8/8b/8m2). For platforms or sound cards without a codec-to-codec link with additional parameters (which applies to most hardware) this changes nothing as the .prepare callback is already called via snd_pcm_do_prepare() (as well as dpcm_fe_dai_prepare() and dpcm_be_dai_prepare()) on those. Suggested-by: Jerome Brunet <jbrunet@baylibre.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20250114215617.336105-3-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-dapm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c0d2c8afe92c..b5116b700d73 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -4013,6 +4013,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
break;
case SND_SOC_DAPM_POST_PMU:
+ snd_soc_dapm_widget_for_each_source_path(w, path) {
+ source = path->source->priv;
+
+ snd_soc_dai_prepare(source, substream);
+ }
+
+ snd_soc_dapm_widget_for_each_sink_path(w, path) {
+ sink = path->sink->priv;
+
+ snd_soc_dai_prepare(sink, substream);
+ }
+
snd_soc_dapm_widget_for_each_sink_path(w, path) {
sink = path->sink->priv;