From c102f1144ae7b0ea382b50174244c207db8f41ec Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Thu, 25 Apr 2024 11:07:09 -0500 Subject: [PATCH] [HACK] ASoC: soc-pcm: relax requirement on direction check The patches added a requirement that the cpu and codec dais support the direction set by the dailink. One some Intel platform, we "cheat" when the echo reference is generated. The dailink is marked as supporting capture even though the amplifier cannot generate the echo reference; the echo reference is actually generated in the firmware and the DAI not used for capture proper. Signed-off-by: Pierre-Louis Bossart --- sound/soc/soc-pcm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 4ceca99e266f4b..24d81be131c07f 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2844,9 +2844,21 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, codec_capture_t = 1; } - if (cpu_play_t && codec_play_t) + if (cpu_play_t && !codec_play_t) { + dev_err(rtd->dev, "CPU dai %s supports playback but codec DAI %s does not\n", + cpu_dai->name, + codec_dai->name); + } + + if (cpu_capture_t && !codec_capture_t) { + dev_err(rtd->dev, "CPU dai %s supports capture but codec DAI %s does not\n", + cpu_dai->name, + codec_dai->name); + } + + if (cpu_play_t) has_playback = 1; - if (cpu_capture_t && codec_capture_t) + if (cpu_capture_t) has_capture = 1; }