summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-streams.c
AgeCommit message (Collapse)Author
2009-09-06v4l: warn when desired devnodenr is in use & add _no_warn functionHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Warn when the desired device node number is already in use, except when the new video_register_device_no_warn function is called since in some use-cases that warning is not relevant. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2009-06-19ivtv/cx18: replace 'kernel number' with 'device node number'.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2009-05-16cx18: Complete support for Sliced and Raw VBI for 625 line systemsAndy Walls
From: Andy Walls <awalls@radix.net> Finish changes for sliced and raw VBI for 625 line systems. Tested with VPS and WSS being emitted by a PVR-350 in field 1 lines 16 and 23. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-05-10cx18: Initial attempt to get sliced VBI working for 625 line systemsAndy Walls
From: Andy Walls <awalls@radix.net> Initial changes to get sliced VBI for 625 line system working. This is patch is untested. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-04-15cx18: Simplify the work handler for outgoing mailbox commandsAndy Walls
From: Andy Walls <awalls@radix.net> Simplify the way outgoing work handler gets scheduled to send empty buffers back to the firmware for use. Also reduced the memory required for scheduling this outgoing work, by using a single, per stream work object. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-04-13cx18: Convert per stream mutex locks to per queue spin locksAndy Walls
From: Andy Walls <awalls@radix.net> To avoid sleeps in providing buffers to user space and in handling incoming buffers from the capture unit, converted the per stream mutex for locking queues to 3 spin locks. There is now a spin lock per queue to increase concurrency when moving buffers around. Also simplified queue manipulations and buffer handling of incoming buffers of data from the capture unit. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-04-13cx18: Add a work queue for deferring empty buffer handoffs to the firmwareAndy Walls
From: Andy Walls <awalls@radix.net> This change defers sending all CX18_CPU_DE_SET_MDL commands, for a stream with an ongoing capture, by adding a work queue to handle sending such commands when needed. This prevents any sleeps, caused by notifying the firmware of new usable buffers, when a V4L2 application read() is being satisfied or when an incoming buffer is processed by the cx18-NN-in work queue thread. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-28cx18: Correct comments about vertical and horizontal blanking timingsAndy Walls
From: Andy Walls <awalls@radix.net> This change only affects comments. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-21cx18: Convert GPIO connected functions to act as v4l2_subdevicesAndy Walls
From: Andy Walls <awalls@radix.net> Convert GPIO line functions, such a audio routing and device resets, to v4l2_subdevices. This essentially completes the conversion of cx18 to the v4l2_device/v4l2_subdevice framework. No regression testing has taken place as of yet. Also an ivtv legacy bug with GPIO mux routing and going to/from radio mode was commented, but not fixed. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-16cx18, v4l2-chip-ident: Finish conversion of AV decoder core to v4l2_subdevAndy Walls
From: Andy Walls <awalls@radix.net> Added a new chip identifer to v4l2-chip-ident for the integrated A/V broadcast decoder core internal to the CX23418. Completed separation and encapsulation of the A/V decoder core interface as a v4l2_subdevice. The cx18 driver now compiles and links again. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-14cx18: Slim down instance handling, build names from v4l2_device.nameAndy Walls
From: Andy Walls <awalls@radix.net> Convert card instance handling to a lighter weight mechanism like ivtv. Also convert name strings and debug messages to use v4l2_device.name. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-08cx18: Finally get sliced VBI working - for 525 line 60 Hz systems at leastAndy Walls
From: Andy Walls <awalls@radix.net> Sliced VBI, in the manner that ivtv implements it as a separate data stream, now works for 525 line 60 Hz systems like NTSC-M. It may work for 625 line 50 Hz systems, but I have more engineering work to do, to verify it is operating properly. Sliced data insertion into the MPEG PS should be working, but is untested. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-06cx18: Use correct line counts per field in firmware API callAndy Walls
From: Andy Walls <awalls@radix.net> The driver was incorrectly setting 0 line counts in a firmware API call to set the maximum amount of lines per field. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-06cx18: Fixes for enforcing when Encoder Raw VBI params can be setAndy Walls
From: Andy Walls <awalls@radix.net> The Encoder will only allow the Raw VBI parameters, along with a number of other API parameters, to take effect when no analog captures are in progress. These parameters must be set before the first analog capture starts, be it MPEG, VBI, YUV, etc., and cannot be changed until the last one stops. It is not obvious to me what capture channel API parameters are shared and which ones must be set per capture channel, so set them all for every analog capture channel start up. This fixes the driver so that VBI capture can be started up after the MPEG capture is going. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-30cx18: Clean-up and enable sliced VBI handlingAndy Walls
From: Andy Walls <awalls@radix.net> Removed legacy ivtv state variables, added comments, and cleaned up sliced VBI related code. Enabled sliced VBI. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-10cx18: Rename structure members: dev to pci_dev and v4l2dev to video_devAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-30v4l2: introduce v4l2_file_operations.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-11-23cx18: Use a known open task handle when setting stream CX2341x parametersAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Use a known open task handle when setting stream CX2341x parameters Sometimes, we might only have VBI or YUV stream open instead of an MPEG stream. Let's make sure we use a valid task handle to perform the CX2341x control settings. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-14cx18: Convert some list manipulations to emphasize entries not listsAndy Walls
From: Andy Walls <awalls@radix.net> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-14cx18 Replace magic number 63 with CX18_MAX_FW_MDLS_PER_STREAMAndy Walls
From: Andy Walls <awalls@radix.net> Removed magic number that referred to firmware limit on the number of MDLs the firmware can maintain for any stream at any one time. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-12cx18: Enable raw VBI captureAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-12-12cx18: Port fix for raw/sliced VBI mixup from ivtv and cx25840Andy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-12cx18: Avoid making firmware API calls with the queue lock heldAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Avoid making firmware API calls with the queue lock held. The source of MPEG strem corruption when not holding the queue lock was found to be that the MPEG buffer could be retrieved by the user app before it was sync'ed for the host cpu. Incoming buffers are now sync'ed before being put on q_full and releasing the queue lock. We can thus avoid the sometimes lengthy call to the firmware for CPU_DE_SET_MDL while holding the queue lock, so we can get better performance. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-07cx18: Add module parameters for finer control over buffer allocationsAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Add module parameters for finer control over buffer allocations. User now has the option of setting smaller buffers to get lower latency transfers from the encoder. User can also now set the number of buffers used for a stream explicitly. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-08cx18: Allow more than 63 capture buffers in rotation per streamAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-27cx18: Eliminate q_io from stream buffer handlingAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-21cx18: Copyright attribution update for files modified by awallsAndy Walls
From: Andy Walls <awalls@radix.net> Add copyright attribution for files modified by awalls in 2008 Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-16cx18: Convert per stream queue spinlocks into mutexesAndy Walls
From: Andy Walls <awalls@radix.net> Convert the per stream queue spinlocks into mutexes. All queue manipulation happens via the work queue or system calls into the driver, and not in an interrupt context. This reduces the amout of time the cx18 driver keeps interrupts disabled. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-15cx18: Major rewrite of interrupt handling for incoming mailbox processingAndy Walls
From: Andy Walls <awalls@radix.net> A major rewrite of interrupt handling for incoming mailbox processing, to split the timing critical steps from the the deferrable steps as the sending XPU on the CX23418 will time out and overwrite our incoming mailboxes rather quickly. Setup a pool of work "order forms" for the irq handler to send jobs to the new work handler routine which uses the kernel default work queue to do the deferrable work. Started optimizing some of the cx18-io calls as they are now the low hanging fruit for recoving microseconds back from the timeline. Future optimizations will get rid of mmio read retries, mmio stats logging, and combine smaller functions in the irq path into the larger ones to save ~2 us each. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-05cx18: Use default kernel work queue; fix streaming flag for work handlerAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Use default kernel work queue; fix streaming flag for work handler. Eliminate cx18 specific work queue and use the kernel default work queue. Fixed the F_STREAMING_FLAG for the TS stream so cx18_dvb_work_handler() can know when it is not safe to send MDLs to the firmware. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
2008-10-18cx18: Don't mask many real init error codes by mapping them to ENOMEMAndy Walls
From: Andy Walls <awalls@radix.net> Changes to let error return codes bubble up to the user visible error message on card initialization. A number of them were being remapped to ENOMEM when no memory or array resource shortage existed. That hampered diagnosis of user trouble reports. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-10-04v4l: disconnect kernel number from minorHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The v4l core creates four different video devices (video, vbi, radio, vtx) and each has its own range of minor numbers. However, modern devices keep increasing the number of devices that they need so a maximum of 64 video devices will not be enough in the future. In addition this scheme makes it very hard to add new device types. This patch disconnects the kernel number allocation (e.g. video0, video1, etc.) from the actual minor number (just pick the first free minor). This allows for much more flexibility in the future. However, it does require the use of udev. For those who cannot use udev a new CONFIG option was created that changes the allocation scheme back to the old behavior. Thanks to Greg KH for suggesting this approach during the 2008 LPC. In addition, several bugs were fixed in the ivtv and cx18 drivers: these drivers try to allocate specific kernel numbers but that scheme contained a bug which caused what should have been e.g. video17 to appear as e.g. video2. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-08-30cx18: Create cx18_ specific wrappers for all pci mmio accessesors.Andy Walls
From: Andy Walls <awalls@radix.net> cx18: Create cx18_ specific wrappers for all pci mmio accessesors. This is a first step in instrumenting all CX23418 PCI bus IO, to debug problems with accessing the CX23418's PCI memory mapped IO. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-08-23cx18: Have CX23418 release buffers at end of capture.Andy Walls
From: Andy Walls <awalls@radix.net> cx18: Have CX23418 release buffers at end of capture. The CX23418 reuses task handles so we need to have it release the buffers associated with a task handle at the end of a capture. If we don't, buffer ids used for one type of stream in the driver (MPEG, TS, PCM), could be used for another type of stream by the CX23418, if a previously used handle is assigned to a different type of stream. The driver would drop valid buffers when this happened. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-08-23cx18: Fix cx18_find_handle() and add error checkingAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-08-22cx18: get rid of ununsed buffers stolen fieldAndy Walls
From: Andy Walls <awalls@radix.net> cx18: get rid of ununsed buffers stolen field. It's an unused holdover from ivtv. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-07-26v4l2-dev: remove unused type and type2 field from video_deviceHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The type and type2 fields were unused and so could be removed. Instead add a vfl_type field that contains the type of the video device. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-20videodev: rename 'dev' to 'parent'Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The field 'dev' is not the video device, but the parent of the video device. Rename accordingly. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-18videodev/cx18: fix get_index bug and error-handling lock-upsHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Fix a bug in get_index that was introduced earlier. Also fix two error handling lock-ups in videodev and cx18 that where found thanks to that bug. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-08v4l-dvb: remove support for kernels < 2.6.13Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Phase 3 of the compat cleanup. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-06-22cx18/ivtv: ioctl debugging improvementsHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Completely rely on the video_ioctl2 debugging facilities rather than doing it ourselves. Fill in some missing fields in ivtv with VIDIOC_G_FBUF. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-06-21cx18: convert to video_ioctl2()Hans Verkuil
From: Andy Walls <awalls@radix.net> cx18: convert driver to use video_ioctl2(). Pushed down ioctl debug messages and priority checks as well. Still left serialization lock in place for now. #if 0'ed out sliced vbi ioctl code for now. Patch heavily based on similar changes made to ivtv by Hans Verkuil. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-05-21 cx18 iomem annotationsMauro Carvalho Chehab
From: Al Viro <viro@ftp.linux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-05-25cx18: allow for simultaneous digital and analog captureHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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>
2008-05-12ivtv/cx18: add compat_ioctl entriesHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-05-01cx18/ivtv: improve and fix out-of-memory handlingHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> - don't show kernel backtrace when the allocation of the buffers fails: the normal ivtv/cx18 messages are clear enough and the backtrace scares users. - fix cleanup after the buffer allocation fails (caused kernel panic). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-04-28cx18: new driver for the Conexant CX23418 MPEG encoder chipHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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>