In order to avoid confusing the applications with msbits bigger than the selected sample size apply the msbits constraint only to sample seze bigger than the requested msbits.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/soc-pcm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8bb1793..e150ede 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -68,13 +68,14 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, * like the DAC/ADC resolution to use but there isn't right now. */ static int sample_sizes[] = { - 8, 16, 24, 32, + 32, 24, 16, 8, };
static void soc_pcm_apply_msb(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - int ret, i, bits; + int i, bits; + int ret = 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) bits = dai->driver->playback.sig_bits; @@ -85,6 +86,8 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream, return;
for (i = 0; i < ARRAY_SIZE(sample_sizes); i++) { + if (sample_sizes[i] <= bits) + break; ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, sample_sizes[i], bits);