Skip to content

Commit

Permalink
ASoC: pcm: Fix rate_max calculation
Browse files Browse the repository at this point in the history
In order to make sure that the sample rate is in the supported range of both
components the maximum rate of the card should be the minimum of the maximum
rate of each components. There is one special case to consider though, if
max_rate is set to 0 this means there is no maximum specified, so use
min_not_zero() macro which will give use the desired result.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Takashi iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 27, 2013
1 parent 6ce4eac commit 17b6c19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw,
struct snd_soc_pcm_stream *cpu_stream)
{
hw->rate_min = max(codec_stream->rate_min, cpu_stream->rate_min);
hw->rate_max = max(codec_stream->rate_max, cpu_stream->rate_max);
hw->rate_max = min_not_zero(codec_stream->rate_max, cpu_stream->rate_max);
hw->channels_min = max(codec_stream->channels_min,
cpu_stream->channels_min);
hw->channels_max = min(codec_stream->channels_max,
Expand Down

0 comments on commit 17b6c19

Please sign in to comment.