summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320dac33.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-10-29 13:07:25 +0200
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-10-30 18:33:38 +0200
commitd54e1f4fdf4cf9754b7220ae4cb66dcae0fc1702 (patch)
treedef420c853f160f65c2200ba612f3a05cf69ee15 /sound/soc/codecs/tlv320dac33.c
parentASoC: tlv320dac33: Error handling for broken chip (diff)
downloadlinux-d54e1f4fdf4cf9754b7220ae4cb66dcae0fc1702.tar.xz
linux-d54e1f4fdf4cf9754b7220ae4cb66dcae0fc1702.zip
ASoC: tlv320dac33: Limit the US_TO_SAMPLES macro
Limit the time window to maximum 1s in the macro. The driver deals with much shorter times (<200ms). This will fix a rare division by zero bug in Mode1. This could happen, when the work is not executed in time (within mode1_latency) after the interrupt. In this case the DAC33 will not receive the needed nSample command in time, and enters to an unknown state, and won't recover. In such event the time window will increase, and eventually going to be bigger than 1s, resulting devision by zero. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index fed14582b498..c47c20d21ea5 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -58,7 +58,7 @@
(1000000000 / ((rate * 1000) / samples))
#define US_TO_SAMPLES(rate, us) \
- (rate / (1000000 / us))
+ (rate / (1000000 / (us < 1000000 ? us : 1000000)))
#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \
((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate)))