History log of /drivers/media/video/ivtv/ivtv-fileops.c
Revision Date Author Comments
da8ec560e3b4e25d73c64a9e08f9f90ebfbfbf7c 24-Nov-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] ivtv: implement new decoder command ioctls

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
61bb725ef5a646d3fc8a64e41b020a65542cdae1 12-Oct-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] ivtv: remove open_id/id from the filehandle code

Instead of messing around with id's it's much easier to just compare
against a filehandle pointer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cdc037817cc15caf931cd3476970860d62f1985c 11-Oct-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] ivtv: switch to the v4l core lock

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3f3edd7c97d0a5ae355aace36000576acbc2f2cc 11-Oct-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] ivtv: remove exclusive radio open

For some reason the /dev/radio device was implemented as an exclusive open:
you could open it only once and not a second time.

Remove this limitation.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f1e393de382af9b9bd2462a42bfa16b8c501d81b 14-Jun-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-event/ctrls/fh: allocate events per fh and per type instead of just per-fh

The driver had to decide how many events to allocate when the v4l2_fh struct
was created. It was possible to add more events afterwards, but there was no
way to ensure that you wouldn't miss important events if the event queue
would fill up for that filehandle.

In addition, once there were no more free events, any new events were simply
dropped on the floor.

For the control event in particular this made life very difficult since
control status/value changes could just be missed if the number of allocated
events and the speed at which the application read events was too low to keep
up with the number of generated events. The application would have no idea
what the latest state was for a control since it could have missed the latest
control change.

So this patch makes some major changes in how events are allocated. Instead
of allocating events per-filehandle they are now allocated when subscribing an
event. So for that particular event type N events (determined by the driver)
are allocated. Those events are reserved for that particular event type.
This ensures that you will not miss events for a particular type altogether.

In addition, if there are N events in use and a new event is raised, then
the oldest event is dropped and the new one is added. So the latest event
is always available.

This can be further improved by adding the ability to merge the state of
two events together, ensuring that no data is lost at all. This will be
added in the next patch.

This also makes it possible to allow the user to determine the number of
events that will be allocated. This is not implemented at the moment, but
would be trivial.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
523f46d6aba9dcb0a2d0fc474ca884e93a7cf198 13-Jun-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-events/fh: merge v4l2_events into v4l2_fh

Drivers that supported events used to be rare, but now that controls can also
raise events this will become much more common since almost all drivers have
controls.

This means that keeping struct v4l2_events as a separate struct make no more
sense. Merging it into struct v4l2_fh simplifies things substantially as it
is now an integral part of the filehandle struct.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5138870d68ffbf6fcdf019af5b2ce78bc5a1f837 28-Jun-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] ivtv: add control event support

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6aff72f6d511bcadbc71358ed17bc87edbf90716 12-Mar-2011 Hans Verkuil <hverkuil@xs4all.nl> [media] ivtv: add missing v4l2_fh_exit

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cc0a2d411f158c61af34d056191c7b4669913ddc 11-Mar-2011 Hans Verkuil <hverkuil@xs4all.nl> [media] ivtv: convert to core priority handling

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ddda424999817fbc17adf9013feb066903382ede 20-Dec-2010 Andy Walls <awalls@md.metrocast.net> [media] ivtv: Return EFAULT when copy_from_user() fails in ivtv_write_vbi_from_user()

If write() on a VBI device node fails due to a bad buffer pointer from
userspace, we should notify the application properly with EFAULT, per the
V4L2 API spec.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b0c45686c8e8aecc7b0cd04d9b6af48d74418d53 18-Dec-2010 Andy Walls <awalls@md.metrocast.net> [media] ivtv: ivtv_write_vbi() should use copy_from_user() for user data buffers

ivtv_write_vbi() is used for both VBI data that came from the
driver internally and VBI data that came from the user. However,
it did not use copy_from_user() for reading the VBI data from the
user buffers.

This change adds a new version of the function,
ivtv_write_vbi_from_user(), that uses copy_from_user() to read the VBI
data provided via user buffers.

This should resolve a sparse build warning reported by Dave Gilbert.

Reported-by: Dr. David Alan Gilbert <linux at treblig.org>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f7b80e6919df812b4bed99a927325312a904111b 27-Jun-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: ivtv: convert to the new control framework

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
215659d14f9dbc849ccda1655c94d710f8cc6384 12-Jun-2010 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB: ivtv: Automatic firmware reload

If the firmware has failed, this patch will automatically reload &
restart the card. The previous card state will be restored on a
successful restart. Firmware reload will only happen if neither the
encoder or decoder is active. If the card is busy then behaviour is as
before, returning -EIO on device access until the reload can occur. On
cards that support video output, coloured bars will be displayed during
the reload.

Andy Walls (ivtv maintainer and patch committer) made minor tweaks to
comments and the logged messages, but nothing substantial otherwise.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
914610e8c508224a6fb9fb501ed4bda25b340ba6 12-Jun-2010 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB: ivtv: Add firmare monitoring and debug mode to ignore firmware problems

>From Ian's e-mail:
When a device is opened the firmware state will be checked. If it isn't
responding then the open will fail with -EIO. Due to the nature of the
hardware, a single failed check will block everything since we don't know
exactly what has failed. A side effect of this is the blocking of debug
access, so an additional debug level has been created which allows the block
to be bypassed.

Andy Walls' modifications:
I modified Ian's patch to add a separate fw_debug module parameter to change
the driver's behavior, as opposed to using the normal debug module parameter.
The fw_debug module parameter is only available when CONFIG_VIDEO_ADV_DEBUG
is set.
I also made some minor whitespace adjustments and changed some warning
messages to be a bit more specific. s/happy/glad/g

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
666092c679f7d9eb9f5230087f960a487fda721c 24-May-2010 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB: ivtv: Timing tweaks and code re-order to try and improve stability

Added small delay on device open & close to allow hardware to settle. Move yuv
register restore to before the decoder firmware call to stop playback.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ffb4877ba013f94322083f77cbb05b35c2a218aa 01-May-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l2-common: simplify prio utility functions

v4l2_prio_init/open/close returned an int when in fact they would
always return 0. Make these void functions.

v4l2_prio_close and v4l2_prio_check pass an enum v4l2_priority as a
pointer for no good reason. Replace with a normal enum v4l2_priority
argument.

These changes will simplify the work of moving priority handling into
the v4l core.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
092501936fc128992456a086193746cf34642815 27-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: ivtv: support the new events API

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
50462eb065e12f45851a9959a90d46b758944552 10-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13555): v4l: Use video_device_node_name() instead of the minor number

Instead of using the minor number in kernel log messages, use the device
node name as returned by the video_device_node_name() function. This
makes debug, informational and error messages easier to understand for
end users.

[mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3ff4ad815c5824ab35375d72ea8fe14fb3230daa 01-Apr-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (11377): v4l: increase version numbers of drivers converted to v4l2_subdev.

With all the v4l2_subdev changes that were made to these drivers it is a
good idea to increase the version number of each driver.

It's just the patch level that is increased, except for the zoran and saa7146
drivers where the minor number was increased due to the more substantial
changes that were made to those two drivers.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f41737ece472cd803ffb24ac9f5d6fdd1d871341 01-Apr-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.

s_std didn't belong in the tuner ops. Stricly speaking it should be part of
the video ops, but it is used by audio and tuner devices as well, so it is
more efficient to make it part of the core ops.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8ac05ae3192ce8a71fc84e4a88772cce0c09173c 07-Feb-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (10488): ivtv: cleanup naming conventions

Use consistent naming for pci_dev, v4l2_device and video_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
0d82fe801d7c6d8cb8987e66b570f6decde9e235 01-Jan-2009 Andy Walls <awalls@radix.net> V4L/DVB (10276): cx18, cx2341x, ivtv: Add AC-3 audio encoding control to cx18

Initial addition of controls to set AC-3 audio encoding for the CX23418 - it
does not work yet due to firmware or cx18 driver issues. This change affects
the common cx2341x and ivtv modules due to shared structures and
common functions.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bec43661b1dc0075b7445223ba775674133b164d 30-Dec-2008 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (10135): v4l2: introduce v4l2_file_operations.

Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
67ec09fdf5e05d4670b617256c696348b5df080b 29-Nov-2008 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (9835): ivtv/ivtvfb: convert to v4l2_device/v4l2_subdev.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2e668962a54b64f3daffb8eef3ca538e25324d1a 11-Oct-2008 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB (9190): ivtv: yuv write() error handling tweak

Modifies behaviour of a failed dma write() operation for the yuv device.
If the dma transfer for the yuv device fails, the write() operation will now
exit immediately.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a8b864354e060dda1000e62d1fea7c1274581caf 04-Oct-2008 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (9162): ivtv: fix raw/sliced VBI mixup

The service_set field was used in saa7115 and cx25840 to determine
whether raw or sliced VBI was desired. This is incorrect since it is
perfectly valid to select sliced VBI with a service_set of 0.

Instead these drivers should checked on VIDIOC_S_FMT whether the type
field matches the raw or sliced VBI type.

Updated ivtv accordingly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
95f73c5b57990c97047c200b8746ab62a360c5bc 22-Jul-2008 Adrian Bunk <bunk@kernel.org> V4L/DVB (8561): make ivtv_claim_stream() static

ivtv_claim_stream() can now become static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
464e9f3a0cabce9a7cf51f382f129d464483b0d0 21-Jun-2008 Ian Armstrong <ian@iarmst.co.uk> V4L/DVB (8088): ivtv: yuv decoder lock fix

write() operations to the yuv device may not always 'start' the decoder.
Although yuv output will be correct, some functions which should be disabled
while the decoder is in use remain enabled. This can result in hardware
registers being corrupted, causing problems with the mpeg decoder. This patch
simply moves the existing decoder 'start' sequence to earlier in the write()
handler.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
b0510f8dc73dce56f35337487c6374ae84b15446 21-May-2008 Al Viro <viro@ftp.linux.org.uk> V4L/DVB (7963): ivtv: trivial annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
07c87a833e9ef92280ed24ab85cd4eb49cbca9c0 12-May-2008 Andy Walls <awalls@radix.net> V4L/DVB (7891): cx18/ivtv: fix open() kernel oops

Upon error conditions in cx18/ivtv_probe(), the code at the 'err:' label
leaves a NULL entry in cx18/ivtv_cards[]. This can cause a NULL pointer
de-reference in cx18/ivtv_v4l2_open() which is fixed by this patch.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
16928be301b0881f7b7afcf95e0ee7dc3214de8d 28-Apr-2008 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (7791): ivtv: POLLHUP must be returned on eof

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
168c626cb8f85df17585af99e14403904641c7ac 16-Apr-2008 Julia Lawall <julia@diku.dk> V4L/DVB (7591): drivers/media/video: use time_before, time_before_eq, etc

The functions time_before, time_before_eq, time_after, and time_after_eq
are more robust for comparing jiffies against other values.

A simplified version of the semantic patch making this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@ change_compare_np @
expression E;
@@

(
- jiffies <= E
+ time_before_eq(jiffies,E)
|
- jiffies >= E
+ time_after_eq(jiffies,E)
|
- jiffies < E
+ time_before(jiffies,E)
|
- jiffies > E
+ time_after(jiffies,E)
)

@ include depends on change_compare_np @
@@

@ no_include depends on !include && change_compare_np @
@@

#include <linux/...>
+ #include <linux/jiffies.h>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
0358d7c580370c5eaf081ac42a41c6e347709051 22-Apr-2008 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (7337): ivtv: fix polling bug

The q_io queue was never taken into account by the poll function. Thanks to
Andy Walls for finding this bug.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
77aded6ba51f01335840ce8e18b413067810b68e 05-Nov-2007 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB (6717): ivtv: Initial merge of video48 yuv handling into the IVTV_IOC_DMA_FRAME framework

Previously, all yuv data written to /dev/video48 had only basic support with
no double buffering to avoid display tearing.

With this patch, yuv frames written to video48 are now handled by the existing
IVTV_IOC_DMA_FRAME framework. As such, the frames are hardware buffered to
avoid tearing, and honour scaling mode & field order options. Unlike the
proprietary IVTV_IOC_DMA_FRAME ioctl, all parameters are controlled by the
V4L2 API.

Due to mpeg & yuv output restrictions being different, their V4L2 output
controls have been separated. To control the yuv output, the V4L2 calls must
be done via video48.

If the ivtvfb module is loaded, there will be one side effect to this merge.
The yuv output window will be constrained to the visible framebuffer area. In
the event that a virtual framebuffer size is being used, the limit to the
output size will be the virtual dimensions, but only the portion that falls
within the currently visible area of the framebuffer will be shown.

Like the IVTV_IOC_DMA_FRAME ioctl, the supplied frames must be padded to 720
pixels wide. However the height must only be padded up the nearest multiple
of 32. This would mean an image of 102 lines must be padded to 128. As long
as the true source image size is given, the padding will not be visible in
the final output.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
c240ad00af78228726e6301ad6ffc54d3adce2a0 16-Oct-2007 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB (6712): ivtv: ivtv yuv stream handling change

Currently the yuv output stream buffer is divided into blocks whose size
depend on the broadcast standard selected during the driver init phase.
However, the standard can be changed after the init phase. This effectively
breaks the yuv output stream handler, since it relies on the different yuv
planes being block aligned.

This patch changes the setup, so that the block size is always the same. The
decoder dma function has been modified to cope with the fact that the second
yuv plane may no longer be block aligned. The start of the yuv frame must
still be at the beginning of a block, so the stream write function has also
been modified to ensure this is always true.

Also, the stream write function will now initiate a yuv dma transfer as soon
as a full frame is ready. It will not wait until the current write request
has completed, or the stream buffer becomes full.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2f7362ef9bc9c41436c7f44212a2dcf12dddffbf 14-Oct-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6348): ivtv: undo video mute when closing the radio

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
af3420b4495914a1a889ae7de0220c793461ba1f 12-Oct-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6338): ivtv: fix incorrect EBUSY return

Trying to open the radio when a capture is in progress will make it
impossible to open the radio again since the radio stream wasn't released.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
7e7f05ca156d34b80e53105e4ef9bc1497a68439 14-Oct-2007 Adrian Bunk <bunk@kernel.org> V4L/DVB (6328): ivtv: fix NULL dereference

We shouldn't dereference "itv" when we know it's NULL...

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2f3a98931f51be6093df7c6cc2633bf238778b7d 25-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
559e196a56a5d518181efc1d2fefe0892f4689b4 23-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
33c0fcad2160bc211272295e862c6f708118d006 23-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6092): ivtv: more cleanups, merged ivtv-audio.c and ivtv-video.c into ivtv-routing.c

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
612570f2c4794bbf4e5bfa8648b61fbfc9cd8501 23-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
ad8ff0f10b489562012e433acdac92498fe8bdc9 20-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6086): ivtv: fix output mode processing: UDMA_YUV wasn't cleared

- Always clear when stopping the decoder
- Clear if the filehandle that is being close was used for UDMA_YUV output.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
baa4072d84e7a2e9954121c826d7bb8f1fb66b38 19-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6056): ivtv: move serialization to the fileops level

Serialization is now done on the open/close/ioctl level and also when the
read/write/poll start an encoder/decoder stream.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1aa32c2ffd146dddd76babf842e998502f1b993a 19-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6055): ivtv: improve debug messages

- add FILE debug flag for open/close/read/write/poll.
- show cmd for encoder/decoder command ioctl.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
f4071b85ea0ca3bd06f63c330562b4cfdffa8473 28-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
3562c43be8cfd6e300508d7c33acebf3369eacd3 18-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
9085009683dd46d95105eda14efa8bda403b459f 05-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> 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>
6e5eb59102aa6007d3ea2b382a1d3ca4112c272a 25-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5924): ivtv-fb: initializing the fb should trigger ivtv firmware load


ivtv-fb: initializing the framebuffer should trigger ivtv firmware load

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
c976bc82339437e840f7dbf0b8c89c09d3fcd75e 22-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5922): ivtv, cx25840: postpone fw load until first use

The firmware is now loaded when the driver is actually used for the first
time. This allows the driver to be compiled in-kernel instead of as a module.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
cb50f548c0ee9b2aac39743fc4021a7188825a98 18-Aug-2007 Ian Armstrong <ian@iarmst.demon.co.uk> V4L/DVB (6052): ivtv: fix udma yuv bug

Using udma yuv causes the driver becomes locked into that mode. This prevents
use of the mpeg decoder & non-udma yuv output. This patch clears the
operating mode when the device is closed.

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
5614b02143171a99e0e6eb6c7d1d2f8750d2957f 23-Aug-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (6095): ivtv: fix VIDIOC_G_ENC_INDEX flag handling

Due to a documentation bug (the type mask is 3 bits long, not 2) the wrong
frame types were filled in: the B and P frame types were swapped.

This bug also hid a second bug: when a capture is stopped a last entry is
written into the pgm index buffer with internal type 0, denoting the end
of the program. This entry wasn't ignored, instead it was accidentally
returned to the caller as a P frame.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
5a338c38ced1569a2e67e3c163505cc95429d508 22-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5918): ivtv: fix TV-out VBI handling, only reset on last close.

While decoding (MPEG or YUV) is active or when VBI output is in use, then
do not clear the VBI output of the saa7127. Only after the last user is
gone can we clear it.

This fixes the case where playback was stopped, another channel was chosen
and playback was restarted, while /dev/vbi16 was used to set the WSS
(widescreen) setting. Without this fix the WSS was reset on every stop
instead of just keeping the last value.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
ac4251445d7302697814351f1d9f548f5aa49342 22-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5916): ivtv: fix pause/continue/play handling

Pausing a decoder followed by a Play command would do nothing. Fixed.
Pausing a decoder running at non-standard speed following by a Continue
would reset the speed to 100%. Fixed.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
201700d3544c653d453716a60976efe1987110af 19-Jul-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (5865): Remove usage of HZ on ivtv driver, replacing by msecs_to_jiffies

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
ae38d93bd710d8014925f1cb9b689dc89c13d778 17-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5854): ivtv: cleanup of driver messages

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
bd58df6d522d5a9c791f6a4820e480e9be60650d 10-Jul-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5844): ivtv: add high volume debugging flag

Add support for high volume debug messages, allowing them to be turned
on selectively.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
f2100d82b858815848b661d57d7e166341c02e20 17-May-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5673): Fix audio stuttering for saa711x/ivtv when in radio mode.

Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
b3785596e3964656b9901f4eff73bf40b654d425 02-May-2007 Robert P. J. Day <rpjday@mindspring.com> V4L/DVB (5583): VIDEO4LINUX-2: Replace MINOR() with a call to iminor().

Replace the call to MINOR() with a call to the inline iminor()
routine.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
d46c17d7aa12e30b612acae35535fcd64f2db3d6 10-Mar-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5410): Add VIDIOC_G/S_PRIORITY support to ivtv.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
31ec13561060b748221f4e0404bcc5bf8078ccd0 03-Mar-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5379): If possible make vars/functions static.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1a0adaf37c30e89e44d1470ef604a930999a5826 27-Apr-2007 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder

It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!

Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>