All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: tlv320dac33: Mode1 FIFO auto configuration fix
@ 2010-10-29  6:49 Peter Ujfalusi
  2010-10-29 17:19 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2010-10-29  6:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, Liam Girdwood

Do not allow invalid (too big) nSample value, when FIFO Mode1
and automatic fifo configuration has been selected.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/tlv320dac33.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index fed1458..6778e2e 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -1082,6 +1082,9 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
 		/* Number of samples under i2c latency */
 		dac33->alarm_threshold = US_TO_SAMPLES(rate,
 						dac33->mode1_latency);
+		nsample_limit = DAC33_BUFFER_SIZE_SAMPLES -
+				dac33->alarm_threshold;
+
 		if (dac33->auto_fifo_config) {
 			if (period_size <= dac33->alarm_threshold)
 				/*
@@ -1092,6 +1095,8 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
 				       ((dac33->alarm_threshold / period_size) +
 				       (dac33->alarm_threshold % period_size ?
 				       1 : 0));
+			else if (period_size > nsample_limit)
+				dac33->nsample = nsample_limit;
 			else
 				dac33->nsample = period_size;
 		} else {
@@ -1103,8 +1108,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
 			 */
 			dac33->nsample_max = substream->runtime->buffer_size -
 						period_size;
-			nsample_limit = DAC33_BUFFER_SIZE_SAMPLES -
-					dac33->alarm_threshold;
+
 			if (dac33->nsample_max > nsample_limit)
 				dac33->nsample_max = nsample_limit;
 
-- 
1.7.3.2

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

* Re: [PATCH] ASoC: tlv320dac33: Mode1 FIFO auto configuration fix
  2010-10-29  6:49 [PATCH] ASoC: tlv320dac33: Mode1 FIFO auto configuration fix Peter Ujfalusi
@ 2010-10-29 17:19 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2010-10-29 17:19 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood

On Fri, Oct 29, 2010 at 09:49:37AM +0300, Peter Ujfalusi wrote:
> Do not allow invalid (too big) nSample value, when FIFO Mode1
> and automatic fifo configuration has been selected.

> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

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

end of thread, other threads:[~2010-10-29 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29  6:49 [PATCH] ASoC: tlv320dac33: Mode1 FIFO auto configuration fix Peter Ujfalusi
2010-10-29 17:19 ` 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.