Hans Verkuil [Sun, 26 Aug 2007 09:04:10 +0000 (06:04 -0300)]
V4L/DVB (6119): ivtvfb: renamed ivtv-fb to ivtvfb, move header to include/linux
The convention for framebuffer devices is to call them xxxfb, not xxx-fb.
Conform to this. Also move the ivtvfb.h header to include/linux: it is a
public header. The FBIO_WAITFORVSYNC ioctl is now also defined in the
ivtvfb.h header, no more need to include matroxfb.h for just this ioctl.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sat, 25 Aug 2007 17:11:23 +0000 (14:11 -0300)]
V4L/DVB (6116): ivtv: VBI cleanups and fixes
Besides some VBI cleanups this patch also fixes a subtle problem with the
VBI re-insertion stream where the PIO work handler wasn't called quickly
enough, resulting in occasional corrupt data.
Furthermore the CC output didn't disable CC correctly and at the right time,
causing duplicates to be sent.
An saa7127 fix for VPS output was also added: the wrong data was sent.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sun, 26 Aug 2007 13:53:16 +0000 (10:53 -0300)]
V4L/DVB (6112): cx25840: use a workqueue to load the firmware
Loading the firmware using the i2c bit-banging code blocks the kernel.
Move the firmware load code into a workqueue so that it plays well with
other processes.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sat, 25 Aug 2007 18:16:37 +0000 (15:16 -0300)]
V4L/DVB (6108): videodev2.h: add new pixel formats for the cx23415 OSD
The Conexant cx23415 MPEG encoder/decoder supports some unusual pixelformats
for the On-Screen Display. Add new defines to videodev2.h for these formats.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Thu, 23 Aug 2007 20:51:07 +0000 (17:51 -0300)]
V4L/DVB (6096): ivtv: fix V4L2_ENC_CMD_STOP_AT_GOP_END support
Support for V4L2_ENC_CMD_STOP_AT_GOP_END was broken. While the driver
correctly waited for the card to capture until the GOP was complete,
afterwards the driver buffers were just flushed instead of waiting
for the application to read all the pending data.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Thu, 23 Aug 2007 08:42:59 +0000 (05:42 -0300)]
V4L/DVB (6091): ivtv: header cleanup
- add guards
- remove unused header includes
- move card-specific stuff from ivtv-driver.h to ivtv-cards.h
- move YUV-specific stuff from ivtv-driver.h to ivtv-yuv.h
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Tue, 21 Aug 2007 21:32:42 +0000 (18:32 -0300)]
V4L/DVB (6088): cx2341x: some controls can't be changed while the device is busy
The driver should now pass the 'busy' state of the device to the cx2341x
module whenever controls are set or tried. -EBUSY will be returned if
the device is busy and the user attempts to modify certain 'dangerous'
controls. It concerns controls that change the audio or video
compression mode and bitrates.
The cx88-blackbird and pvrusb2 drivers currently always pass '0' (not busy)
to the cx2341x, effectively keeping the old behavior for now.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Mon, 20 Aug 2007 19:26:40 +0000 (16:26 -0300)]
V4L/DVB (6087): ivtv: prevent changing VBI format while capture is in progress
Changing the VBI format requires a CX2341X_ENC_INITIALIZE_INPUT firmware
call. This can only be done if no capture is in progress. So return
-EBUSY if the encoder is busy.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Trent Piepho [Fri, 24 Aug 2007 04:06:36 +0000 (01:06 -0300)]
V4L/DVB (6085): cx88-alsa: Fix mmap support
The driver has long claimed to support mmap, but it didn't work at all. Some
of the dma buffer parameters weren't set, and since video_buf uses vmalloc to
allocate the buffer, a page callback is needed too.
Trent Piepho [Fri, 24 Aug 2007 04:06:34 +0000 (01:06 -0300)]
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.
Michael Krufky [Tue, 21 Aug 2007 00:04:44 +0000 (21:04 -0300)]
V4L/DVB (6074): tuner: fix ifdef tags to match actual file name
The file, tuner-driver.h was originally named tuner-hw.h, but we decided to
rename it. At the time, I had forgotten to change the #ifdef __TUNER_HW_H__
to #ifdef __TUNER_DRIVER_H__ . This patch corrects that.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Edgar Simo [Mon, 20 Aug 2007 17:14:50 +0000 (14:14 -0300)]
V4L/DVB (6072): saa7134: add DVB-T support for Avermedia Super 007
Add DVB-T support for Avermedia Super 007
Analog television is untested. The device lacks input adapters for radio,
svideo & composite -- seems to be a DVB-T ONLY device.
Signed-off-by: Edgar Simo <bobbens@gmail.com> Acked-by: Hermann Pitton <hermann-pitton@arcor.de> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Edgar Simo [Mon, 20 Aug 2007 17:06:00 +0000 (14:06 -0300)]
V4L/DVB (6071): saa7134-dvb: add missing newline
This is a simple whitespace cleanup.
Signed-off-by: Edgar Simo <bobbens@gmail.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Trent Piepho [Sun, 19 Aug 2007 01:09:42 +0000 (22:09 -0300)]
V4L/DVB (6066): cx88-alsa: Change order of interrupt enabling, fix spurious IRQs
Currently the driver turns on audio interrupts, then sets the audio interrupt
mask to select which interrupts to get. One could received unwanted
interrupts since the mask is set _after_ interrupts have already been turned
on. Change the order of the operations, and clear any audio interrupt status
bits that are already set for good measure.
Before changing the SRAM FIFO parameters, make sure the FIFO isn't being used.
This shouldn't happen with just the ALSA driver, as it should never try to
turn on FIFO/RISC/DMA while they are already on. However, the V4L driver
needs to turn the audio FIFO on for analog audio output to work (undocumented
cx88 bug). The FIFO parameters are in an inconsistent state while they are
updated, and this results in many FIFO sync error IRQs if the FIFO is in use
while it's in this inconsistent state.
Also create and use a bunch of symbolic constants for audio interrupt mask
bits.
Trent Piepho [Sat, 18 Aug 2007 10:02:26 +0000 (07:02 -0300)]
V4L/DVB (6065): cx88-alsa: Call core irq handler when needed
When an irq handled by the cx88 core driver (currently IR and errors) occurs
and the cx88-alsa irq handler is the first called, it will claim to have
handled the irq but it doesn't call cx88_core_irq() to handle it.
The means loading cx88-alsa can disable the IR remote.
Hans Verkuil [Sun, 19 Aug 2007 15:25:39 +0000 (12:25 -0300)]
V4L/DVB (6058): ivtv: add support for highmem udma
When trying to DMA userspace buffers to the cx23415 you need to check
whether the page is in highmem. If this is the case, then bounce buffers
have to be used to allow DMA.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sun, 19 Aug 2007 08:32:33 +0000 (05:32 -0300)]
V4L/DVB (6054): ivtv: specify some stream sizes in kB instead of MB
Some streams (PCM, VBI decoding) do not need that much memory, so specify
the allocated memory in kB instead of MB to limit memory usage. E.g. 1 MB
is overkill for the VBI decoding stream, 64 kB is enough.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
- Invalid VBI packets should result in an empty VBI frame, not
in an zero-sized frame that causes the reader to incorrectly
return a 0 (EOF) value.
- PIO completion should not reset the sg_pending_size field.
- The DMA offset detection code should be ignored for PIO transfers:
it somehow messes up the data on the card and is not needed anyway
for PIO.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
It turns out that the cx23415/6 DMA engine cannot do scatter/gather DMA
reliably. Every so often depending on the phase of the moon and your
hardware configuration the cx2341x DMA engine simply chokes on it and
you have to reboot to get it working again.
This change replaced the scatter/gather DMA by single transfers at a time,
where the driver is now responsible for DMA-ing each buffer.
UDMA is still done using scatter/gather DMA, that will be fixed soon.
Many thanks to Mark Bryars <mark.bryars@etvinteractive.com> for discovering
the link between scatter/gather and the DMA timeouts.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sat, 28 Jul 2007 15:07:12 +0000 (12:07 -0300)]
V4L/DVB (6046): ivtv: always steal full frames if out of buffers.
When there are no more free buffers, then buffers are stolen from the
predma queue. Buffers should be stolen from the head of that queue (which
is where the most recently added buffers are) and all buffers belonging
to a frame should be stolen. Otherwise 'half-frames' would remain in the
queue, which leads to ugly playback and complete sync failure for YUV
buffers.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sat, 18 Aug 2007 14:46:05 +0000 (11:46 -0300)]
V4L/DVB (6045): ivtv: fix handling of INITIALIZE_INPUT fw call
The CX2341X_ENC_INITIALIZE_INPUT firmware call requires careful handling,
otherwise the computer can freeze or the top-third of the screen can start
flickering. This patch ensures that CX2341X_ENC_INITIALIZE_INPUT is called
at the right time and in the right way.
In addition the stop capture handling was improved so that the last pending
DMA transfer is also processed. Otherwise this would be the first data that
arrived when a new capture was started which is not what you want.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Darren Salt [Sat, 18 Aug 2007 21:05:31 +0000 (18:05 -0300)]
V4L/DVB (6040): Add IR support for Nova-T Stick
Working with Nova-T Stick (70001) with remote control model A415.
Untested with other dib0700m/dib0700p devices.
Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Darren Salt [Sat, 18 Aug 2007 21:04:00 +0000 (18:04 -0300)]
V4L/DVB (6039): Typo fix in Nova-TD description
Typo fix in Nova-TD description
Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Alan Nisota [Sat, 18 Aug 2007 20:52:35 +0000 (17:52 -0300)]
V4L/DVB (6037): Updated GenPix USB driver
There are now 4 different versions of the GENPIX USB adapter. The
newest 'Skywalker' models are fully self-contained, and need no
additional hardware to be used. A very reliable DVB-S card even without
using any of the alternate modulatations (which this kernel module does
not currently support)
The following patch adds support for all 4 versions of the genpix
adapter (www.genpix-electronics.com).
Signed-off-by: Alan Nisota alannisota@gmail.com Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Trent Piepho [Fri, 17 Aug 2007 08:50:22 +0000 (05:50 -0300)]
V4L/DVB (6034): cx88: Add parameter to control radio deemphasis time constant
FM radio transmission use a preemphasis/deemphasis scheme to reduce
high-frequency noise. The cx88 audio decoder is supposedly set to no
deemphasis by the current driver.
However, the "no deemphasis" setting doesn't work. On my chip, cx23883, it
produces the same result as the 75 us time constant. Maybe the default
settings on the cx23881 are for 50 us?
Since the deemphasis time constant varies by country, allow setting it via a
module parameter.
Trent Piepho [Fri, 17 Aug 2007 20:49:41 +0000 (17:49 -0300)]
V4L/DVB (6031): Fix for bug 7819: fixed hotplugging for dvbnet
The first part of dvb_net_close() is just a cut&paste from
dvb_generic_release(), so maybe it would be better to just call
dvb_generic_release() instead?
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Acked-by: Markus Rechberger <mrechberger@gmail.com> Acked-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Adrian Bunk [Thu, 16 Aug 2007 13:03:18 +0000 (10:03 -0300)]
V4L/DVB (6025): Net_ule(): fix check-after-use
The Coverity checker spotted that we'd have already oops'ed if "dev"
was NULL.
Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Trent Piepho [Wed, 15 Aug 2007 17:41:59 +0000 (14:41 -0300)]
V4L/DVB (6023): cx88: Clean up some ugly and inconsistent printk()s
Get rid of the "CORE" prefix from cx88 printks. It was only used a few times,
and it makes it look like they're coming from the kernel core or something.
Fix the message, "TV tuner 60 at 0x1fe, Radio tuner -1 at 0x1fe", by adding a
"cx88[0]" prefix to be consistent, and to keep people who grep their dmesg
output for cx88 from missing it. Get rid of the addresses, which are always
wrong. The addresses are always set to -1, but because it's an unsigned 8-bit
value, the left shift converts it to the nonsense address 0x1fe.
In the cx8802 driver, some cut and pasted code prefixed lines with "CORE
cx88[0]:", which has been changed to "cx88[0]/2:" like the other printks from
the cx8802 driver.
Also fix some ugly printks in the cx8802 driver that used __FUNCTION__ for
KERN_INFO and KERN_ERR messages.
The changed printks in cx88-mpeg.c also needed lots of whitespace and
80-column fixes.
A bunch of misc changes in cx88-dvb.c and cx88-video.c to add message levels
or a consistent "cx88[?]/2" or "cx88[?]/0" prefix.
Trent Piepho [Wed, 15 Aug 2007 17:41:58 +0000 (14:41 -0300)]
V4L/DVB (6022): cx88: Move card core creation from cx88-core.c to cx88-cards.c
A lot of code in cx88-cards.c was only used by cx88-core.c when the core state
is first allocated and initialized. Moving that task to cx88-cards makes the
driver simpler and the files more self contained.
- Module parameters tuner, radio, card, and latency move to cx88-cards.c
- cx88_boards is made static
- cx88_subids is made static and const
- cx88_bcount is eliminated
- cx88_idcount is eliminated
- cx88_card_list() is made static
- cx88_card_setup_pre_i2c() is made static
- cx88_card_setup() is made static
- cx88_pci_quirks() is moved from cx88-core to cx88-cards
The function argument "char *name" is made const too
- get_ressources() is moved from cx88-core to cx88-cards, and renamed to
cx88_get_resources()
- The code to allocate and initialize the core state struct and the chip is
moved out of cx88-core.c:cx88_get_core() and into a new function in
cx88-cards.c, cx88_core_create(). This makes both functions simpler.
Trent Piepho [Wed, 15 Aug 2007 17:41:57 +0000 (14:41 -0300)]
V4L/DVB (6021): cx88: Copy board information into card state
The cx88 driver state stored the ID of the board type in core->board. Every
time the driver need to get some information about the board configuration, it
uses the board number as an index into board configuration array.
This patch changes it so that the board number is in core->boardnr, and
core->board is a copy of the board configuration information. This allows
access to board information without the extra indirection. e.g.
cx88_boards[core->board].mpeg becomes core->board.mpeg.
This has a number of advantages:
- The code is simpler to write.
- It compiles to be smaller and faster, without needing the extra array lookup
to get at the board information.
- The cx88_boards array no longer needs to be exported to all cx88 modules.
- The boards array can be made const
- It should be possible to avoid keeping the (large) cx88_boards array around
after the module is loaded.
- If module parameters or eeprom info override some board configuration
setting, it's not necessary to modify the boards array, which would
affect all boards of the same type.
Trent Piepho [Mon, 13 Aug 2007 15:21:58 +0000 (12:21 -0300)]
V4L/DVB (6020): cx88: Fix use of uninitialized variable
An error message for PCI resource allocation failure used the board type
before it was set. Just get rid of the error message, as get_ressources()
[sic] already prints one. Format that error message better, and add the pci
function and subsystem information to better associate the error with what
caused it.
Trent Piepho [Mon, 13 Aug 2007 15:21:57 +0000 (12:21 -0300)]
V4L/DVB (6019): cx88: Make card database more memory efficient
The vmux setting is only two bits, but was taking up a whole 32
in the input description struct. By changing it to a two-bit
bitfield, it can fit in what was padding space before and drop
the input size by 4 bytes, from 28 to 24. This drops the board
description struct, which has 9 inputs, from 280 to 244 bytes.
Total driver size decreases by 2108 bytes.
"extern inline" will have different semantics with gcc 4.3.
Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Michael Krufky [Sat, 11 Aug 2007 18:42:12 +0000 (15:42 -0300)]
V4L/DVB (6006): tuner: move last_div to tuner-simple private data
tuner-simple is the only sub-driver that uses last_div, so we
can free up two bytes of memory for all other tuners, by moving
this into tuner-simple's private data area.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sun, 5 Aug 2007 11:02:45 +0000 (08:02 -0300)]
V4L/DVB (5998): ivtv: no need to mute the audio input
When changing channels the audio has to be muted. This is done
by calling CX2341X_ENC_MUTE_AUDIO and by muted the audio input.
The latter is not necessary and is now removed.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Sun, 5 Aug 2007 11:00:36 +0000 (08:00 -0300)]
V4L/DVB (5997): cx25840: fix audio mute handling and reporting
Audio muting for the tuner input was implemented by stopping the
audio microcontroller and restarting it on unmute. However, it
appears that this method can actually crash the audio firmware.
It's rare and seems to happen with NTSC only.
It has been reimplemented by setting to volume to 0. In addition, the
reporting of the mute state has been improved as well: it used to be
impossible to detect whether the audio was muted by the user or if it
was muted due to the microcontroller trying to detect the audio
standard. This is now clearly stated.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Hans Verkuil [Tue, 11 Sep 2007 14:59:15 +0000 (11:59 -0300)]
V4L/DVB (5995): ivtv: add AverMedia M116
- Split Club3D card from Yuan PG600-2, GotView PCI DVD Lite
(different composite input)
- Add AVerTV MCE 116 Plus (M116) card
- Allow Xceive cards to be used without Xceive support
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Simon Arlott [Thu, 9 Aug 2007 14:29:33 +0000 (11:29 -0300)]
V4L/DVB (5988): Fix OOP on videobuf-dvb when hibernating
Since videobuf_waiton is called with intr=1, it can return -EINTR and therefore
err may be non-zero. This happens when the system goes into the standby state.
Without the BUG() occurring, there's no problem with standby mode while DVB
is being used.
Oliver Endriss [Thu, 9 Aug 2007 05:41:16 +0000 (02:41 -0300)]
V4L/DVB (5987): saa7146: clean-up irq processing
Interrupt processing fixed: First handle interrupt, then acknowledge it.
Otherwise the same interrupt might occur twice.
Cleaned-up i2c interrupt handler and i2c error messages.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>