Skip to content

Commit

Permalink
ALSA: AACI: no need to call snd_pcm_period_elapsed() for each period
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King committed Jan 26, 2011
1 parent c0dea82 commit ea51d0b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sound/arm/aaci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit ea51d0b

Please sign in to comment.