ASoC: tlv320dac33: Fix for early interrupt in FIFO Mode1
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Fri, 23 Apr 2010 07:09:57 +0000 (10:09 +0300)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 26 Apr 2010 14:16:18 +0000 (15:16 +0100)
Alarm threshold interrupt is triggered right after the
playback start.
This interrupt is recieved during the first burst period,
and caused the state machine to write additional nSample
command, which has to be avoided.
To fix this issue move the DAC33 interrupt unmasking
after we configured the PREFILL register with a small
delay.

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>
sound/soc/codecs/tlv320dac33.c

index 824bb35..520377b 100644 (file)
@@ -557,9 +557,13 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
        switch (dac33->fifo_mode) {
        case DAC33_FIFO_MODE1:
                dac33_write16(codec, DAC33_NSAMPLE_MSB,
-                               DAC33_THRREG(dac33->nsample));
+                       DAC33_THRREG(dac33->nsample + dac33->alarm_threshold));
                dac33_write16(codec, DAC33_PREFILL_MSB,
                                DAC33_THRREG(dac33->alarm_threshold));
+               /* Enable Alarm Threshold IRQ with a delay */
+               udelay(SAMPLES_TO_US(dac33->burst_rate,
+                                    dac33->alarm_threshold));
+               dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT);
                break;
        case DAC33_FIFO_MODE7:
                dac33_write16(codec, DAC33_PREFILL_MSB,
@@ -782,7 +786,6 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
        case DAC33_FIFO_MODE1:
                dac33_write(codec, DAC33_FIFO_IRQ_MODE_B,
                            DAC33_ATM(DAC33_FIFO_IRQ_MODE_LEVEL));
-               dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT);
                break;
        case DAC33_FIFO_MODE7:
                /* Disable all interrupts */