Skip to content

Commit e436d43

Browse files
xdarklightbroonie
authored andcommitted
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 <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Reviewed-by: Jerome Brunet <[email protected]> Signed-off-by: Martin Blumenstingl <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d4e91ad commit e436d43

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sound/soc/soc-dapm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4013,6 +4013,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
40134013
break;
40144014

40154015
case SND_SOC_DAPM_POST_PMU:
4016+
snd_soc_dapm_widget_for_each_source_path(w, path) {
4017+
source = path->source->priv;
4018+
4019+
snd_soc_dai_prepare(source, substream);
4020+
}
4021+
4022+
snd_soc_dapm_widget_for_each_sink_path(w, path) {
4023+
sink = path->sink->priv;
4024+
4025+
snd_soc_dai_prepare(sink, substream);
4026+
}
4027+
40164028
snd_soc_dapm_widget_for_each_sink_path(w, path) {
40174029
sink = path->sink->priv;
40184030

0 commit comments

Comments
 (0)