summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-driver.c
AgeCommit message (Collapse)Author
2009-02-28cx18: Use strlcpy() instead of strncpy() for temp eeprom i2c_client setupAndy Walls
From: Andy Walls <awalls@radix.net> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-21cx18: Disable AC3 controls as the firmware doesn't support AC3Andy Walls
From: Andy Walls <awalls@radix.net> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-21cx18: Get rid of unused variables related to video outputAndy Walls
From: Andy Walls <awalls@radix.net> Remove variables that were holdovers from ivtv for supporting the CX23415 MPEG decoder output. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-21cx18: Change log lines for internal subdevs and fix tveeprom readsAndy Walls
From: Andy Walls <awalls@radix.net> Give messages originating from internal subdevs a header using the subdev's name. Fixed an uninitialized variable problem with reading the EEPROM, noticed from log output. Got rid of the unused cx18_av_exit() function. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-21cx18: Fix a memory leak of buffers used for sliced VBI insertionAndy Walls
From: Andy Walls <awalls@radix.net> We leaked buffers every time a device was removed, if the user had enabled sliced VBI insertion into the MPEG stream. MythTV uses that. 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-20cx18: Convert I2C devices to v4l2_subdevicesAndy Walls
From: Andy Walls <awalls@radix.net> 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. 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-09merge: http://linuxtv.org/hg/~awalls/cx18-sliced-vbiMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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-07cx18: Process Raw VBI on a whole frame basis; fix VBI buffer sizeAndy Walls
From: Andy Walls <awalls@radix.net> The cx23418 appears to send Raw VBI buffers with a PTS on a per frame basis, not per field, so process Raw VBI on a whole frame basis and reduce some complexity. Fix VBI buffer size computation to handle a whole frame of Raw VBI for a 625 line system, which is the worst case and will work for 525 lines systems as well. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-02-01cx18: Remove an unused spinlockAndy Walls
From: Andy Walls <awalls@radix.net> 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-30cx18: Normalize APU after second APU firmware loadAndy Walls
From: Andy Walls <awalls@radix.net> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-19cx18: Add initial entry for a Leadtek DVR3100 H hybrid cardAndy Walls
From: Andy Walls <awalls@radix.net> Card report provided by Patryk on the ivtv-devel list: http://ivtvdriver.org/pipermail/ivtv-devel/2009-January/005922.html Reported-by: Pat <tatyrza@mm.pl> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-17cx18: Call request_module() with proper argument types.Andy Walls
From: Andy Walls <awalls@radix.net> request_module() needs to be called with a string literal for a format string or with 1 or more variable arguments to avoid compiler warnings and possible exploits, if someone could cause us to get a format string with a '%' code in the format string when we make the call. Reported-by: Brandon Jenkins <bcjenkins@tvwhere.com> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-11cx18: Conversion to new V4L2 framework: use v4l2_device objectAndy Walls
From: Andy Walls <awalls@radix.net> First step in conversion to the new V4L2 framework. Added per cx18 device instance of the v4l2_device and its registration. 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>
2009-01-04cx18: Fix bad audio in first analog capture.Andy Walls
From: Andy Walls <awalls@radix.net> Normalize the APU state before the second firmware load so that audio for the first analog capture is correct. Many thanks to Conexant for supporting me in finding a solution for this problem. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-03cx18, cx2341x: Fix bugs in cx18 AC3 control and comply with V4L2 specAndy Walls
From: Andy Walls <awalls@radix.net> Fix bugs in the cx18 AC3 control implementation that would have affected ivtv and other drivers via the cx2341x module. Bring AC3 controls behavior into comliance with V4L2 specification. Thanks to Hans Verkuil for reviewing the previous patch and pointing out the problems. Reported-by: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2009-01-01cx18, cx2341x, ivtv: Add AC-3 audio encoding control to cx18Andy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-14cx18: Refine the firmware load and firmware startup processAndy Walls
From: Andy Walls <awalls@radix.net> Refine the firmware load and firmware startup process. Significant changes are to ensure the SCB and IPC area are correct before starting up the firmware, and letting the CPU firmware start up the APU firmware for us. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-12-14cx18: VBI comment corrections and comments about VBI issuesAndy Walls
From: Andy Walls <awalls@radix.net> VBI comment corrections to avoid future confusion about standards. Comments on cx18 VBI implementation shortcomings that need resolution. 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-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-11-25cx18: Change work_queue teardown to work for kernels earlier than 2.6.22Andy Walls
From: Andy Walls <awalls@radix.net> For kernels earlier than 2.6.22, we can't cancel work, so we have to flush the work queue to completion before destroying it. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-25cx18: Change to per CX23418 device work queues for deferrable work handlingAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Change to per CX23418 device work queues for deferrable work handling. Needed to support 2.6.22 and earlier kernels that can't selectively cancel work orders. Also will provide slightly better performance on SMP systems. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-21cx18: Adjust outgoing mailbox timeouts and remove statistics loggingAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Adjust outgoing mailbox timeouts and remove statistics logging. This saves some wasted storage in struct cx18 for each card. Cutting the outgoing mailbox timeouts in half from the previous value appears to be safe with MythTV. Got rid of interrupted case code path after a wait uninterruptable returns. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-16cx18: Streamline cx18-io[ch] wrappers and enforce MMIO retry strategyAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Streamline cx18-io[ch] wrappers and enforce MMIO retry strategy so that write retries always occur and read retries never occur (as they never help). Remove MMIO statistics logging to speed up MMIO accesses. Deprecate & ignore retry_mmio and mmio_ndelay module parameters, to essentially force retry_mmio=1 and mmio_ndelay=0. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-16cx18: Change to singlethreaded global work queue thread for deferable workAndy Walls
From: Andy Walls <awalls@radix.net> Change to singlethreaded global work queue thread for deferable work, instead of the kernel default multithreaded work queue. This ensures execution of deferable work is always in the proper order, so caputred buffers don't get reordered. 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-12merge: http://linuxtv.org/hg/~awalls/cx18-bugfixMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-08cx18: Further changes to improve mailbox protocol integrity & performnceAndy Walls
From: Andy Walls <awalls@radix.net> All waits for cx18 mailbox API commands are now uninterruptable. Added code to collect mailbox ack statistics. Tweaked timeouts based on collected stats and video vertical frame and field rates. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-05cx18: Add outgoing mailbox mutexes and check for ack via waitq vs pollAndy Walls
From: Andy Walls <awalls@radix.net> Add mutexes to ensure exclusive access for outgoing driver to CX23418 mailboxes. Also wait on a waitq for mailbox acknowledgement from the CX23418 instead of polling. Priority: high 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-11-04cx18: Move DVB buffer transfer handling from irq handler to work_queueAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Move DVB buffer transfer handling from irq handler to work_queue thread. In order to properly lock the epu2cpu mailbox for driver to CX23418 commands, the DVB/TS buffer handling needs to be moved from the IRQ handler and IRQ context to a work queue. This work_queue implmentation is strikingly similar to the ivtv implementation - for better or worse. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-04cx18: Use correct Mailbox IRQ Ack values and misc IRQ handling cleanupAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Use correct Mailbox IRQ Ack values and misc IRQ handling cleanup. The SCB field definitions for Ack IRQ's for mailboxes were inconsistent with the bitmasks being loaded into those SCB fields and the SW2 Ack IRQ handling logic. Renamed fields in SCB to make things consistent and did misc IRQ handling cleanups: removing legacy ivtv dma_reg_lock, HPU IRQ flags, etc. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
2008-10-25cx18: Remove redundant block scope variable in cx18_probe() for sparseAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Remove redundant block scope variable in cx18_probe() to eliminate sparse build warning. Priority: normal 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-18cx18: Fix memory leak on card initialization failureAndy Walls
From: Andy Walls <awalls@radix.net> On error exit, the cx18_probe() function did not use the proper entry in cx18_cards[] with kfree() when card init failed; leaking memory. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-10-11merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-devMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-04cx18: Add entries for the Leadtek PVR2100 and Toshiba Qosmio DVB-T/AnalogAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Add entries for the Leadtek PVR2100 and Toshiba Qosmio DVB-T/Analog capture cards. Both cards are hybrids cards, but no digital capture functionality has been added yet. These entries are a first guess at the card entries to get analog working, given the information available. Terry Wu <terrywu at leadtek.com.tw> provided a pointer to information for the PVR2100. Martin Juhl <mj at casalogic.dk>, an owner of the Toshiba DVB-T/Analog tuner card, provided the DDR timing information from his Windows inf file. 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-09-28cx18: Add default behavior of checking and retrying PCI MMIO accessesAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Add default behavior of checking and retrying PCI MMIO accesses. The concept of checking and retrying PCI MMIO accesses for better reliability in older motherboards was suggested by Steve Toth <stoth@linuxtv.org>. This change implements MMIO retries and the retry_mmio module parameter that is enabled by default. Limited experiments have shown this is more reliable than the mmio_ndelay parameter. mmio_ndelay has insignificant effect with retries enabled. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
2008-09-06cx18: fix sparse warningsHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-09-05merge: http://linuxtv.org/hg/~awalls/v4l-dvbMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Fixed a trivial conflict between a janitor's patch from Hans Verkuil and Andy patch series. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-08-31cx18: Throttle mmio to/from the CX23418 so boards work in older systemsAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Throttle mmio to/from the CX23418 so boards work in older systems. The CX23418 couldn't reliably handle mmio at the rate at which the cx18 driver was attempting to access the chip. The PCI bridge arrangements and settings on modern motherboards still allowed the CX23418 to work OK, but it didn't work well on many older motherboards: mysterious I2C errors, firmware loading errors, etc. This patch adds a throttle to *all* mmio access to the CX23418. It defaults to a delay of 31 ns, but is adjustable by the mmio_ndelay module parm. My HVR-1600 and Raptor PAL/SECAM card now function for analog capture on a motherboard with an Intel 82810E Northbridge and 82801AA Southbridge. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
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>