[ALSA] Reduce interrupt latency in sound/pci/via82xx.c
authorKarsten Wiese <annabellesgarden@yahoo.de>
Tue, 18 Oct 2005 12:31:07 +0000 (14:31 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 4 Nov 2005 12:19:00 +0000 (13:19 +0100)
commit4f550df58f4758ea023704b409830ad9c3b47771
tree83f935c11032a2a4099e0996717482ddcce945ca
parentf0597a416dc44e3afe25090e9af9d42bad62547d
[ALSA] Reduce interrupt latency in sound/pci/via82xx.c

Modules: VIA82xx driver

The change only affects the via823x kind of chips.
Here the  via8233_pcm_pointer_hw() function
(named snd_via8233_pcm_pointer() before)
needed to loop until a non zero position is red from the chip.

Measurements have shown that more than 200 loops are typically needed on
an Athlon64.
As io-reads cost many cycles, those loops sum up huge.
via8233_pcm_pointer_hw() runs either in interrupt or with interrupts
disabled. So it introduces significant interrupt latency.

The patch introduces a calculated position value hwptr_done,
that is updated by the interrupt routine when a period is completed.
It is only used, if the 823x chip returns a zero position, which can't
be interpreted reliably.

Further optimisation is applied on the 8233 chip's interrupt routine:
Only the SGD_SHADOW is read, as it contains all infos needed.
We ommit ~5 more register reads that way.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/via82xx.c