Skip to content

Commit

Permalink
ASoC: pcm: Properly initialize hw->rate_max
Browse files Browse the repository at this point in the history
If none of the components (CODEC or CPU DAI) sets a maximum sample rate we'll
end up with the rate_max field of the runtime hardware set to 0.  (Note that it
is still possible for the components to constrain the supported sample rates
using other methods, e.g. setting a list constraint) If rate_max is 0 this means
that the sound card doesn't support any rates at all, which is not the desired
result. So initialize rate_max to UINT_MAX. For symmetry reasons also set
rate_min to 0.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Jan 14, 2014
1 parent 64a9aa9 commit 817873f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
& (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
hw->rates |= codec_stream->rates;

hw->rate_min = 0;
hw->rate_max = UINT_MAX;

snd_pcm_limit_hw_rates(runtime);

hw->rate_min = max(hw->rate_min, cpu_stream->rate_min);
Expand Down

0 comments on commit 817873f

Please sign in to comment.