Commit 16d7ea91 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: Allow PCMs to restrict the supported formats

Some DMA cores might add additional restrictions on which in memory audio
formats can be supported by the compound sound card. If the PCM component
specifies a set of formats it supports (by setting the formats field to non 0)
take these into account when calculating the format set for the compound sound
card.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Tested-by: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 1e9de42f
......@@ -158,7 +158,10 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw,
cpu_stream->channels_min);
hw->channels_max = min(codec_stream->channels_max,
cpu_stream->channels_max);
hw->formats = codec_stream->formats & cpu_stream->formats;
if (hw->formats)
hw->formats &= codec_stream->formats & cpu_stream->formats;
else
hw->formats = codec_stream->formats & cpu_stream->formats;
hw->rates = codec_stream->rates & cpu_stream->rates;
if (codec_stream->rates
& (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment