summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-10-29 09:49:37 +0300
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-10-30 17:33:38 +0100
commit1bc13b2e3518ff7856924d7c2bdf06196f605260 (patch)
treeb9dd84bb34c62cac8bb954bf8b366ad81fb48a59 /sound
parentd54e1f4fdf4cf9754b7220ae4cb66dcae0fc1702 (diff)
downloadlwn-1bc13b2e3518ff7856924d7c2bdf06196f605260.tar.gz
lwn-1bc13b2e3518ff7856924d7c2bdf06196f605260.zip
ASoC: tlv320dac33: Mode1 FIFO auto configuration fix
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> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tlv320dac33.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index c47c20d21ea5..c5ab8c805771 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;