diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2020-07-23 20:05:33 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-07-31 20:06:51 +0200 |
commit | 4f8721542f7b75954bfad98c51aa59d683d35b50 (patch) | |
tree | 900e579c077247ceffbce37db68b22e285382de3 /sound/soc/soc-dai.c | |
parent | Merge series "ASoC: meson: tdm fixes" from Jerome Brunet <jbrunet@baylibre.com>: (diff) | |
download | linux-4f8721542f7b75954bfad98c51aa59d683d35b50.tar.xz linux-4f8721542f7b75954bfad98c51aa59d683d35b50.zip |
ASoC: core: use less strict tests for dailink capabilities
Previous updates to set dailink capabilities and check dailink
capabilities were based on a flawed assumption that all dais support
the same capabilities as the dailink. This is true for TDM
configurations but existing configurations use an amplifier and a
capture device on the same dailink, and the tests would prevent the
card from probing.
This patch modifies the snd_soc_dai_link_set_capabilities()
helper so that the dpcm_playback (resp. dpcm_capture) dailink
capabilities are set if at least one dai supports playback (resp. capture).
Likewise the checks are modified so that an error is reported only
when dpcm_playback (resp. dpcm_capture) is set but none of the CPU
DAIs support playback (resp. capture).
Fixes: 25612477d20b5 ('ASoC: soc-dai: set dai_link dpcm_ flags with a helper')
Fixes: b73287f0b0745 ('ASoC: soc-pcm: dpcm: fix playback/capture checks')
Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200723180533.220312-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dai.c')
-rw-r--r-- | sound/soc/soc-dai.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 457159975b01..cecbbed2de9d 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -400,28 +400,30 @@ void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link) struct snd_soc_dai_link_component *codec; struct snd_soc_dai *dai; bool supported[SNDRV_PCM_STREAM_LAST + 1]; + bool supported_cpu; + bool supported_codec; int direction; int i; for_each_pcm_streams(direction) { - supported[direction] = true; + supported_cpu = false; + supported_codec = false; for_each_link_cpus(dai_link, i, cpu) { dai = snd_soc_find_dai(cpu); - if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { - supported[direction] = false; + if (dai && snd_soc_dai_stream_valid(dai, direction)) { + supported_cpu = true; break; } } - if (!supported[direction]) - continue; for_each_link_codecs(dai_link, i, codec) { dai = snd_soc_find_dai(codec); - if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { - supported[direction] = false; + if (dai && snd_soc_dai_stream_valid(dai, direction)) { + supported_codec = true; break; } } + supported[direction] = supported_cpu && supported_codec; } dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK]; |