2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 04:34:11 +08:00
linux-next/drivers/media/video/cx88
Trent Piepho 05b2723387 V4L/DVB (6083): cx88-alsa: Rework buffer handling
Rework the way the DMA buffer is handled and IRQs are generated.

ALSA uses a ring-buffer of multiple periods.  Each period is supposed to
corrispond to one IRQ.

The existing driver was generating one interrupt per ring-buffer, as opposed
to per period.  This meant that as soon as the IRQ was generated, the hardware
was already starting to re-write the beginning of the buffer.  Since the DMA
happens on a per-line basis, there was only a narrow window to copy the data
out before the buffer was overwritten.

The cx88 core RISC program generator is modified so that it can set the IRQ
and counter flags to count every X lines of DMA transfer.  This way we can
generate an interrupt every period instead of every full ring-buffer.  Right
now only period of one line are supported, but it should be possible to
support longer periods.  Note that a WRITE instruction generates an IRQ when
it starts, not when the transfer is finished.  Thus to generate an IRQ when
line X is done, one must set the IRQ flag on the instruction that starts line
X+1, not the one that ends line X.

Change the line size so that there are four lines in the SRAM FIFO.  If there
are not four lines, the analog output from the cx88's internal DACs is full of
clicks and pops.

Try to handle FIFO sync errors.  Sometimes the chip generates many of these
errors before audio data starts.  Up to 50 sync errors will be ignored and the
counter reset.

Have the IRQ handler save the RISC counter to the chip struct, and then have
the pointer callback use this to calculate the pointer position.  We could
read the counter from the pointer callback, but sometimes the sync errors on
start up cause the counter to go crazy.  ALSA sees this and thinks there has
been an overrun.  The IRQ hander can avoid saving the counter position on
sync errors.

The chip "opened" flag wasn't necessary.  ALSA won't try to open the same
substream multiple times.  Probably this code was cut&pasted from the bt87x
driver, which has multiple sub-streams for one chip.

Do error checking for the videobuf mapping functions.

snd_card_cx88_runtime_free() is useless and can be deleted.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09 22:06:34 -03:00
..
cx88-alsa.c V4L/DVB (6083): cx88-alsa: Rework buffer handling 2007-10-09 22:06:34 -03:00
cx88-blackbird.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-cards.c V4L/DVB (6064): cx88: Add symbolic names for the PCI interrupt bits 2007-10-09 22:05:54 -03:00
cx88-core.c V4L/DVB (6083): cx88-alsa: Rework buffer handling 2007-10-09 22:06:34 -03:00
cx88-dvb.c V4L/DVB (6023): cx88: Clean up some ugly and inconsistent printk()s 2007-10-09 22:05:17 -03:00
cx88-i2c.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-input.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-mpeg.c V4L/DVB (6083): cx88-alsa: Rework buffer handling 2007-10-09 22:06:34 -03:00
cx88-reg.h V4L/DVB (6066): cx88-alsa: Change order of interrupt enabling, fix spurious IRQs 2007-10-09 22:05:55 -03:00
cx88-tvaudio.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-vbi.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-video.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-vp3054-i2c.c V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files 2007-10-09 22:06:17 -03:00
cx88-vp3054-i2c.h V4L/DVB (5629): Cx88: VP3054 support can't be a module when cx88 is compiled in 2007-07-18 14:23:11 -03:00
cx88.h V4L/DVB (6083): cx88-alsa: Rework buffer handling 2007-10-09 22:06:34 -03:00
Kconfig V4L/DVB (5780): Dvb: Remove static dependencies on dvb-pll 2007-07-18 14:24:16 -03:00
Makefile V4L/DVB (5166): Remove obsolete alias defines of CONFIG_* settings 2007-02-21 13:35:11 -02:00