All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: soc_pcm_init_runtime_hw: Fix rate_max calculation
@ 2013-11-27  8:58 Lars-Peter Clausen
  2013-11-27  8:58 ` [PATCH 2/2] ASoC: pcm: Always honor DAI min and max sample rate constraints Lars-Peter Clausen
  2013-11-27 16:42 ` [PATCH 1/2] ASoC: soc_pcm_init_runtime_hw: Fix rate_max calculation Mark Brown
  0 siblings, 2 replies; 11+ messages in thread
From: Lars-Peter Clausen @ 2013-11-27  8:58 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Takashi Iwai
  Cc: Jean-Francois Moine, alsa-devel, Lars-Peter Clausen

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>
---
 sound/soc/soc-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 170ff96..c4ef880 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -220,7 +220,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,
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-27 16:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27  8:58 [PATCH 1/2] ASoC: soc_pcm_init_runtime_hw: Fix rate_max calculation Lars-Peter Clausen
2013-11-27  8:58 ` [PATCH 2/2] ASoC: pcm: Always honor DAI min and max sample rate constraints Lars-Peter Clausen
2013-11-27 10:31   ` Takashi Iwai
2013-11-27 11:18     ` Lars-Peter Clausen
2013-11-27 11:26       ` Takashi Iwai
2013-11-27 12:21         ` Mark Brown
2013-11-27 13:13           ` Takashi Iwai
2013-11-27 14:49             ` Mark Brown
2013-11-27 15:01               ` Lars-Peter Clausen
2013-11-27 16:43   ` Mark Brown
2013-11-27 16:42 ` [PATCH 1/2] ASoC: soc_pcm_init_runtime_hw: Fix rate_max calculation Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.