diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-13 09:47:35 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-26 21:24:12 +0100 |
commit | ea51d0b164040ad594c1f9c4c6faf23c19c977b9 (patch) | |
tree | 3729a1a8a15e73ef11f6de51c625d8bbf4d4a3fa /sound/arm/aaci.c | |
parent | ALSA: AACI: use snd_pcm_lib_period_bytes() (diff) | |
download | linux-ea51d0b164040ad594c1f9c4c6faf23c19c977b9.tar.xz linux-ea51d0b164040ad594c1f9c4c6faf23c19c977b9.zip |
ALSA: AACI: no need to call snd_pcm_period_elapsed() for each period
There is no need to call snd_pcm_period_elapsed() each time a period
elapses - we can call it after we're done once loading/unloading the
FIFO with data. ALSA works out how many periods have elapsed by
reading the current pointers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'sound/arm/aaci.c')
-rw-r--r-- | sound/arm/aaci.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index a8f95382a95a..393ce08b0e11 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -206,6 +206,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) if (mask & ISR_RXINTR) { struct aaci_runtime *aacirun = &aaci->capture; + bool period_elapsed = false; void *ptr; if (!aacirun->substream || !aacirun->start) { @@ -223,10 +224,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) if (aacirun->bytes <= 0) { aacirun->bytes += aacirun->period; - aacirun->ptr = ptr; - spin_unlock(&aacirun->lock); - snd_pcm_period_elapsed(aacirun->substream); - spin_lock(&aacirun->lock); + period_elapsed = true; } if (!(aacirun->cr & CR_EN)) break; @@ -256,6 +254,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) aacirun->ptr = ptr; spin_unlock(&aacirun->lock); + + if (period_elapsed) + snd_pcm_period_elapsed(aacirun->substream); } if (mask & ISR_URINTR) { @@ -265,6 +266,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) if (mask & ISR_TXINTR) { struct aaci_runtime *aacirun = &aaci->playback; + bool period_elapsed = false; void *ptr; if (!aacirun->substream || !aacirun->start) { @@ -282,10 +284,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) if (aacirun->bytes <= 0) { aacirun->bytes += aacirun->period; - aacirun->ptr = ptr; - spin_unlock(&aacirun->lock); - snd_pcm_period_elapsed(aacirun->substream); - spin_lock(&aacirun->lock); + period_elapsed = true; } if (!(aacirun->cr & CR_EN)) break; @@ -315,6 +314,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) aacirun->ptr = ptr; spin_unlock(&aacirun->lock); + + if (period_elapsed) + snd_pcm_period_elapsed(aacirun->substream); } } |