Skip to content

Commit

Permalink
ASoC: tlv320dac33: Limit the US_TO_SAMPLES macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Liam Girdwood committed Oct 30, 2010
1 parent 911a0f0 commit d54e1f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/codecs/tlv320dac33.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit d54e1f4

Please sign in to comment.