summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx18/cx18-fileops.c
AgeCommit message (Collapse)Author
2012-01-16[media] cx18: remove exclusive open of radio deviceHans Verkuil
For some reason the cx18 driver could open the radio device only once. 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>
2011-09-18[media] cx18: Fix videobuf captureSimon Farnsworth
When we moved to 3.0, we found that the cx18 driver was oopsing on close with: NULL pointer deref at: [ 2290.461009] Call Trace: [ 2290.461009] [<c046007b>] ? pm_qos_add_request+0xc/0x6e [ 2290.461009] [<c082631c>] __mutex_lock_common+0x87/0x125 [ 2290.461009] [<f8970e92>] ? cx18_queue_flush+0x31/0x87 [cx18] [ 2290.461009] [<c0436b85>] ? __might_sleep+0x29/0xe4 [ 2290.461009] [<c0826515>] __mutex_lock_slowpath+0x25/0x27 [ 2290.461009] [<c08264b2>] ? mutex_lock+0x2e/0x3b [ 2290.461009] [<c08264b2>] mutex_lock+0x2e/0x3b [ 2290.461009] [<f88d3137>] videobuf_queue_lock+0x13/0x15 [videobuf_core] [ 2290.461009] [<f88d3f86>] __videobuf_free+0xfc/0x112 [videobuf_core] [ 2290.461009] [<f89741e6>] cx18_v4l2_close+0x158/0x172 [cx18] [ 2290.461009] [<c0507522>] ? cpumask_next+0x1a/0x1d [ 2290.461009] [<f88a319d>] v4l2_release+0x35/0x52 [videodev] [ 2290.461009] [<c04f5717>] fput+0x100/0x1a5 [ 2290.461009] [<c04f2e09>] filp_close+0x5c/0x64 [ 2290.461009] [<c04f2e70>] sys_close+0x5f/0x93 [ 2290.461009] [<c082cd5f>] sysenter_do_call+0x12/0x28 Some digging showed that a merge at some previous point partially added broken mmap() support, causing this trace. Remove the broken code completely. On top of that, the calculation in place for "buffer full" depended on UYUV instead of HM12, while our GStreamer code was picking HM12 in some circumstances. Finally, the V4L2_CAP_STREAMING capability was never exposed. Patch it into the YUV encoder node only. Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] cx18: Move spinlock and vb_type initialisation into stream_initSimon Farnsworth
The initialisation of vb_type in serialized_open was preventing REQBUFS from working reliably. Remove it, and move the spinlock into stream_init for good measure - it's only used when we have a stream that supports videobuf anyway. Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] cx18: Clean up mmap() support for raw YUVSimon Farnsworth
The initial version of this patch (commit d5976931639176bb6777755d96b9f8d959f79e9e) had some issues: * It didn't correctly calculate the size of the YUV buffer for 4:2:2, resulting in capture sometimes being offset by 1/3rd of a picture. * There were a lot of variables duplicating information the driver already knew, which have been removed. * There was an in-kernel format conversion - libv4l can do this one, and is the right place to do format conversions anyway. * Some magic numbers weren't properly explained. Fix all these issues, leaving just the move from videobuf to videobuf2 to do. Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Acked-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] cx18: mmap() support for raw YUV video captureSteven Toth
Add support for mmap method streaming of raw YUV video on cx18-based hardware, in addition to the existing support for read() streaming of raw YUV and MPEG-2 encoded video. [simon.farnsworth@onelan.co.uk: I forward-ported this from Steven's original work, done under contract to ONELAN. The original code is at http://www.kernellabs.com/hg/~stoth/cx18-videobuf] Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22[media] cx18: use core priority handlingHans Verkuil
VIDIOC_S/G_PRIORITY handling is now done by the v4l2 core framework. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22[media] cx18: use v4l2_fh as preparation for adding core priority supportHans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21[media] cx18: Use the control frameworkHans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01V4L/DVB: cx18, cx23885, v4l2 doc, MAINTAINERS: Update Andy Walls' email addressAndy Walls
A trivial change to update my email address from my dead awalls@radix.net address to my current awalls@md.metrocast.net address. Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: v4l2-common: simplify prio utility functionsHans Verkuil
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>
2010-02-26V4L/DVB: cx18: export a couple of symbols so they can be shared with cx18-alsaDevin Heitmueller
Expose a couple of symbols in the cx18 module so that locking of the PCM stream can be shared with the cx18-alsa module. This work was sponsored by ONELAN Limited. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13909): cx18: Clean up dead code from ivtv once used for IDX processingAndy Walls
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13908): cx18: Add initial working VIDIOC_G_ENC_INDEX ioctl() supportAndy Walls
VIDIOC_G_ENC_INDEX support see the light of day. Some notes: 1. With default capture parameters, the CX23418 seems to transfer 192 index entries (4.5 kB worth) at 10 second intervals. 2. Index streams don't seem to be supported for MPEG 2 TS streams 3. The index entries seem to claim every frame is a B-Frame. Possible firmware bug. 4. The cx18 driver does not try to capture an index stream when inserting sliced VBI into the MPEg stream as the offsets would need fixup. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13906): cx18: Start IDX streams automatically as an internal ↵Andy Walls
associated stream This change starts the IDX stream along with the MPG stream as an internal use (only) stream much like the VBI stream can be started as an internal use stream for inserting sliced VBI packets. The IDX stream is not started automatically with an MPEG strem if the IDX stream is disabled (no buffers allocated) or if sliced VBI insertion is being performed by the cx18 driver. The cx18 driver doing sliced VBI insertion makes the offsets in the IDX stream inaccurate for the final MPEG stream presented to user space. Since fixing the IDX offsets ourselves is not easy and we cannot easily do what ivtv does to fix the offsets, we'll make sliced VBI insertion and MPEG Index capture mutually exclusive for now. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16V4L/DVB (13555): v4l: Use video_device_node_name() instead of the minor numberLaurent Pinchart
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>
2009-12-05V4L/DVB (13429): cx18: Add Memory Descriptor List (MDL) layer to buffer handlingAndy Walls
Add a Memory Descriptor List (MDL) layer to buffer handling to implement scatter-gather I/O. Currently there is still only 1 buffer per MDL. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13427): cx18: Rename struct cx18_queue.buffers to struct ↵Andy Walls
cx18_queue.depth Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12V4L/DVB (12196): cx18-fileops.c: Remove unnecessary semicolonsJoe Perches
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Walls <awalls@radix.net> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16V4L/DVB (11622): cx18: Allow IVTV format VBI insertion in MPEG-2 SVCD and ↵Andy Walls
DVD streams Both the MPEG-2 SVCD stream format and the MPEG-2 DVD stream format should use an MPEG-2 PS container. This makes it safe to stuff IVTV Private Stream 1 VBI packets in these stream types using the existing cx18 driver routines. Reported-by: Helen Buus <mythtv@hbuus.com> Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.Hans Verkuil
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>
2009-03-30V4L/DVB (10758): cx18: Convert I2C devices to v4l2_subdevicesAndy Walls
This is a major perturbation to cx18 I2C device handling to convert it to the v4l2_device/subdeivce framework. This change breaks GPIO audio multiplexer control for the time being. It will be fixed in a coming change. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10756): cx18: Slim down instance handling, build names from ↵Andy Walls
v4l2_device.name Convert card instance handling to a lighter weight mechanism like ivtv. Also convert name strings and debug messages to use v4l2_device.name. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10440): cx18: Fix presentation timestamp (PTS) for VBI buffersAndy Walls
The old code from ivtv used a CX23415/6 PTS, which was simply left at 0 in the cx18 driver. Since the CX23418 gives us what I think is a PTS (or some other 90 kHz clock count) with each VBI buffer, this change has the cx18 driver use that as a PTS. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10439): cx18: Clean-up and enable sliced VBI handlingAndy Walls
Removed legacy ivtv state variables, added comments, and cleaned up sliced VBI related code. Enabled sliced VBI. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v4l2dev ↵Andy Walls
to video_dev Renamed structure member name to be more specific to type in anticipation of updating to the v4l2_device/v4l2_subdev framework. Too many objects named "dev" and /v4l2_\{0,1\}dev/ would be to confusing. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10276): cx18, cx2341x, ivtv: Add AC-3 audio encoding control to cx18Andy Walls
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>
2009-01-02V4L/DVB (10135): v4l2: introduce v4l2_file_operations.Hans Verkuil
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>
2008-12-30V4L/DVB (9806): cx18: Enable raw VBI captureAndy Walls
A combined authorship patch from Hans Verkuil and Andy Walls. Raw VBI can now be captured but requires a video capture to be in progress as well. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9805): cx18: Port fix for raw/sliced VBI mixup from ivtv and cx25840Andy Walls
This is a port of the fixes Hans Verkuil made for ivtv/cx25840: The service_set field was used 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 the driver should check on VIDIOC_S_FMT whether the type field matches the raw or sliced VBI type. Updated the cx18 driver accordingly, including an additional check in cx18_start_v4l2_encode_stream() that didn't exist in ivtv. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9801): cx18: Allow more than 63 capture buffers in rotation per streamAndy Walls
cx18: Allow more than 63 capture buffers in rotation per stream. Implement q_busy to hold buffers the firmware has for use. q_free holds truly unused buffers in a pool. New buffers are given to the firmware as soon as the firmware returns one, if there are any to give to the firmware. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9800): cx18: Eliminate q_io from stream buffer handlingAndy Walls
Eliminate q_io from stream buffer handling in anticipation of upcoming changes in buffer handling. q_io was a holdover from ivtv and it's function in cx18 was trivial and not necessary. We just push things back onto the front of q_full now, instead of maintaining a 1 buffer q_io queue. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9728): cx18: Copyright attribution update for files modified by awallsAndy Walls
Add copyright attribution for files modified by awalls in 2008 Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8773): cx18: Fix cx18_find_handle() and add error checkingAndy Walls
cx18: Fix cx18_find_handle() and add error checking. cx18_find_handle() did not find a good task handle and would use the invalid task handle under common conditions. Added a define for the invalid task handle and added error checking as well. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8772): cx18: Convert cx18_queue buffers member to atomic_tAndy Walls
cx18: Convert cx18_queue buffers member to atomic_t. This allows safe concurrent access to check if a queue has data without having to acquire the queue spinlock. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8771): cx18: Remove redundant struct cx18_queue length member.Andy Walls
cx18: Remove redundant struct cx18_queue length member. It can be trivially computed from queue->buffers * stream->buf_size, if ever really needed. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-06-05V4L/DVB (7964): cx18 iomem annotationsAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-06-05V4L/DVB (7931): cx18: allow for simultaneous digital and analog captureHans Verkuil
The HVR-1600 can do both analog and digital capture at the same time. Due to a driver bug -EBUSY would be returned when attempting to setup an analog capture while a digital capture was already in progress. Separate the two internally. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-05-14V4L/DVB (7891): cx18/ivtv: fix open() kernel oopsAndy Walls
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>
2008-05-14V4L/DVB (7856): cx18/: possible cleanupsAdrian Bunk
This patch contains the following possible cleanups: - cx18-i2c.c should #include "cx18-i2c.h" for getting the prototypes of it's global functions - make the following needlessly global functions static: - cx18-fileops.c:cx18_claim_stream() - cx18-fileops.c:cx18_release_stream() - cx18-queue.c:cx18_queue_move() - remove the following unused functions: - cx18-driver.c:cx18_waitq() - cx18-queue.c:cx18_buf_copy_from_user() Signed-off-by: Adrian Bunk <bunk@kernel.org> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-29V4L/DVB (7786): cx18: new driver for the Conexant CX23418 MPEG encoder chipHans Verkuil
Many thanks to Steve Toth from Hauppauge and Nattu Dakshinamurthy from Conexant for their support. I am in particular thankful to Hauppauge since without their help this driver would not exist. It should also be noted that Steve did the work to get the DVB part up and running. Thank you! Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: G. Andrew Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>