diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-01-11 04:24:40 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-14 15:41:57 -0500 |
commit | 817873f4b155b22a24c48d6a38ee32007e2d856e (patch) | |
tree | b1dd52e13d803783dd37d713d9433f45bde1ed4c | |
parent | 64a9aa9cf57dd551a9ae9bf48f5e63be608aae72 (diff) |
ASoC: pcm: Properly initialize hw->rate_max
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>
-rw-r--r-- | sound/soc/soc-pcm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 1a617fde46e6..2b8949647e32 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -170,6 +170,9 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_runtime *runtime, | |||
170 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) | 170 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) |
171 | hw->rates |= codec_stream->rates; | 171 | hw->rates |= codec_stream->rates; |
172 | 172 | ||
173 | hw->rate_min = 0; | ||
174 | hw->rate_max = UINT_MAX; | ||
175 | |||
173 | snd_pcm_limit_hw_rates(runtime); | 176 | snd_pcm_limit_hw_rates(runtime); |
174 | 177 | ||
175 | hw->rate_min = max(hw->rate_min, cpu_stream->rate_min); | 178 | hw->rate_min = max(hw->rate_min, cpu_stream->rate_min); |