Skip to content

Commit d54e1f4

Browse files
Peter UjfalusiLiam Girdwood
authored andcommitted
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 <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
1 parent 911a0f0 commit d54e1f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/codecs/tlv320dac33.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
(1000000000 / ((rate * 1000) / samples))
5959

6060
#define US_TO_SAMPLES(rate, us) \
61-
(rate / (1000000 / us))
61+
(rate / (1000000 / (us < 1000000 ? us : 1000000)))
6262

6363
#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \
6464
((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate)))

0 commit comments

Comments
 (0)