Skip to content

Commit 84eae18

Browse files
Peter UjfalusiLiam Girdwood
authored andcommitted
ASoC: tlv320dac33: Use usleep_range for delays
Switch to use the more precise usleep_range instead of msleep(). Replace the udelay with usleep_range to remove the busy loop waiting. Signed-off-by: Peter Ujfalusi <[email protected]> Acked-by: Mark Borwn <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
1 parent 872a64d commit 84eae18

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sound/soc/codecs/tlv320dac33.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
669669
static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
670670
{
671671
struct snd_soc_codec *codec = dac33->codec;
672+
unsigned int delay;
672673

673674
switch (dac33->fifo_mode) {
674675
case DAC33_FIFO_MODE1:
@@ -684,8 +685,9 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
684685
dac33_write16(codec, DAC33_PREFILL_MSB,
685686
DAC33_THRREG(dac33->alarm_threshold));
686687
/* Enable Alarm Threshold IRQ with a delay */
687-
udelay(SAMPLES_TO_US(dac33->burst_rate,
688-
dac33->alarm_threshold));
688+
delay = SAMPLES_TO_US(dac33->burst_rate,
689+
dac33->alarm_threshold) + 1000;
690+
usleep_range(delay, delay + 500);
689691
dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT);
690692
break;
691693
case DAC33_FIFO_MODE7:
@@ -785,11 +787,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
785787

786788
static void dac33_oscwait(struct snd_soc_codec *codec)
787789
{
788-
int timeout = 20;
790+
int timeout = 60;
789791
u8 reg;
790792

791793
do {
792-
msleep(1);
794+
usleep_range(1000, 2000);
793795
dac33_read(codec, DAC33_INT_OSC_STATUS, &reg);
794796
} while (((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) && timeout--);
795797
if ((reg & 0x03) != DAC33_OSCSTATUS_NORMAL)

0 commit comments

Comments
 (0)