ALSA: ctxfi - Work around emu20k1 glitch to prevent buffered sound data loss
authorSarah Bessmer <aotos@fastmail.fm>
Thu, 9 Jan 2014 19:36:31 +0000 (11:36 -0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 10 Jan 2014 09:10:41 +0000 (10:10 +0100)
commite240a46965dd14db6e6bdf8974ebb347f3db860b
treeb8fe7ba7f9956b715e5e4c75285badbb15016842
parent2d82ea2005624a80b18916e37bce921d6e868b59
ALSA: ctxfi - Work around emu20k1 glitch to prevent buffered sound data loss

Occasionally, on playback stream ringbuffer wraparound, the EMU20K1
hardware will momentarily return 0 instead of the proper current(loop)
address. This patch handles that case, fixing the problem of playback
position corruption and subsequent loss of buffered sound data, that
occurs with some common buffering layout patterns(e.g. multiple
simultaneous output streams with differently-sized or
non-power-of-2-sized buffers).

An alternate means of fixing the problem would be to read the ca
register continuously, until two sequential reads return the same
value; however, that would be a more invasive change, has performance
implications, and isn't necessary unless there are also issues with the
value not being updated atomically in regards to individual bits or
something similar(which I have not encountered through light testing).

I have no EMU20K2 hardware to confirm if the issue is present there,
but even if it's not, this change shouldn't break anything that's not
already broken.

Signed-off-by: Sarah Bessmer <aotos@fastmail.fm>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ctxfi/ctatc.c