diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-10-29 02:49:37 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-10-30 12:33:38 -0400 |
commit | 1bc13b2e3518ff7856924d7c2bdf06196f605260 (patch) | |
tree | b9dd84bb34c62cac8bb954bf8b366ad81fb48a59 /sound/soc/codecs/tlv320dac33.c | |
parent | d54e1f4fdf4cf9754b7220ae4cb66dcae0fc1702 (diff) |
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/soc/codecs/tlv320dac33.c')
-rw-r--r-- | 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 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) | |||
1082 | /* Number of samples under i2c latency */ | 1082 | /* Number of samples under i2c latency */ |
1083 | dac33->alarm_threshold = US_TO_SAMPLES(rate, | 1083 | dac33->alarm_threshold = US_TO_SAMPLES(rate, |
1084 | dac33->mode1_latency); | 1084 | dac33->mode1_latency); |
1085 | nsample_limit = DAC33_BUFFER_SIZE_SAMPLES - | ||
1086 | dac33->alarm_threshold; | ||
1087 | |||
1085 | if (dac33->auto_fifo_config) { | 1088 | if (dac33->auto_fifo_config) { |
1086 | if (period_size <= dac33->alarm_threshold) | 1089 | if (period_size <= dac33->alarm_threshold) |
1087 | /* | 1090 | /* |
@@ -1092,6 +1095,8 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream) | |||
1092 | ((dac33->alarm_threshold / period_size) + | 1095 | ((dac33->alarm_threshold / period_size) + |
1093 | (dac33->alarm_threshold % period_size ? | 1096 | (dac33->alarm_threshold % period_size ? |
1094 | 1 : 0)); | 1097 | 1 : 0)); |
1098 | else if (period_size > nsample_limit) | ||
1099 | dac33->nsample = nsample_limit; | ||
1095 | else | 1100 | else |
1096 | dac33->nsample = period_size; | 1101 | dac33->nsample = period_size; |
1097 | } else { | 1102 | } else { |
@@ -1103,8 +1108,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream) | |||
1103 | */ | 1108 | */ |
1104 | dac33->nsample_max = substream->runtime->buffer_size - | 1109 | dac33->nsample_max = substream->runtime->buffer_size - |
1105 | period_size; | 1110 | period_size; |
1106 | nsample_limit = DAC33_BUFFER_SIZE_SAMPLES - | 1111 | |
1107 | dac33->alarm_threshold; | ||
1108 | if (dac33->nsample_max > nsample_limit) | 1112 | if (dac33->nsample_max > nsample_limit) |
1109 | dac33->nsample_max = nsample_limit; | 1113 | dac33->nsample_max = nsample_limit; |
1110 | 1114 | ||