summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-driver.h
AgeCommit message (Collapse)Author
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: 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-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-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: 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-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-18cx18: Restore buffers that have fallen out of the transfer rotationAndy Walls
From: Andy Walls <awalls@radix.net> Restore buffers that have fallen out of the transfer rotation, and check for coherent mailbox data when processing a stale mailbox. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-11-17cx18: Remove unnecessary MMIO accesses in time critical irq handling pathAndy Walls
From: Andy Walls <awalls@radix.net> Remove unnecessary MMIO accesses in time critical irq handling path. Also ensured that the mailbox ack field is read in last, so we know for sure if we have a stale mailbox or not on receipt. 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: Propagate staleness of mailbox and mdl ack data to work handlerAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Propagate staleness of mailbox and mdl ack data to work handler to let the work handler know that the data from the encoder may not be coherent. Allows for smarter handling of buffers in future, to deal with MDLs that fall out of rotation due to irq handler being late in collecting mailbox and mdl ack info. 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-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-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-11-02cx18: Reduce number of mmio read retriesAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Reduce number of mmio read retries to improve performance. Experiments have shown 2 things: read retries never improve the result of a suspect mmio read from the CX23418 (the result stays all 0xff's), and that most of the suspected read failures are actually proper reads of values that should be all 0xff's. This change reduces the number of read retries and keeps the count separate from write retries. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-10-18backport commit 1a651a00e20fd4997f0b91258f6f95b7d96edcd9Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Author: Harvey Harrison <harvey.harrison@gmail.com> byteorder: remove direct includes of linux/byteorder/swab[b].h A consolidated implementation will provide this generically through asm/byteorder, remove direct includes to avoid breakage when the changeover to the new implementation occurs. kernel-sync: 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-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: Set mmio throttling delay default to 0 nsec.Andy Walls
From: Andy Walls <awalls@radix.net> cx18: Set mmio throttling delay default to 0 nsec. Not doing so makes analog tuner audio not work on some mahcines. Priority: high Signed-off-by: Andy Walls <awalls@radix.net>
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>
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: Convert cx18_queue buffers member to atomic_tAndy Walls
From: Andy Walls <awalls@radix.net> 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. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
2008-08-22cx18: Remove redundant struct cx18_queue length member.Andy Walls
From: Andy Walls <awalls@radix.net> cx18: Remove redundant struct cx18_queue length member. It can be trivially computed from queue->buffers * stream->buf_size, if ever really needed. 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-20videodev: move some functions from v4l2-dev.h to v4l2-common.h or v4l2-ioctl.hHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The functions in a header should not belong to another module. The prio functions belong to v4l2-common.c, so move them to v4l2-common.h. The ioctl functions belong to v4l2-ioctl.c, so create a new v4l2-ioctl.h header and move those functions to it. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-13cx18: Add locking for struct cx18 GPIO state variablesAndy Walls
From: Andy Walls <awalls@radix.net> cx18: Add locking for struct cx18 GPIO state variables in anticpation of adding IR microcontroller reset support for use by external IR modules. Signed-off-by: Andy Walls <awalls@radix.net>
2008-07-08v4l-dvb: remove support for kernels < 2.6.16Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Phase 4 removes the compatibility support for kernels < 2.6.16. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-06-21cx18: add support for Conexant Raptor PAL/SECAM cardHans Verkuil
From: Sri Deevi <Srinivasa.Deevi@conexant.com> Patch provided courtesy of Conexant http://www.conexant.com. Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-08-30v4l: fix assorted compile warnings/errorsHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> BIT define conflicts on kernels < 2.6.24, byteorder/swab.h doesn't need to be included at all. Priority: normal 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: move gpio_dir/val statics to the cx18 struct.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The gpio_dir/val statics cannot be global, they are card-specific. Thanks to Andy Walls for pointing this out. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
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-05 cx18/: possible cleanupsMauro Carvalho Chehab
From: Adrian Bunk <bunk@kernel.org> 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-05-02backport commit aed6abd662c2903733bea7fcd3856c306e650680Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> kernel-sync: Author: Mauro Carvalho Chehab <mchehab@infradead.org> LD drivers/media/video/built-in.o drivers/media/video/cx18/built-in.o: In function `get_service_set': /home/v4l/tokernel/git/drivers/media/video/cx18/cx18-ioctl.c:118: multiple definition of `get_service_set' drivers/media/video/ivtv/built-in.o:/home/v4l/tokernel/git/drivers/media/video/ivtv/ivtv-ioctl.c:119: first defined here drivers/media/video/cx18/built-in.o: In function `expand_service_set': /home/v4l/tokernel/git/drivers/media/video/cx18/cx18-ioctl.c:92: multiple definition of `expand_service_set' drivers/media/video/ivtv/built-in.o:/home/v4l/tokernel/git/drivers/media/video/ivtv/ivtv-ioctl.c:92: first defined here drivers/media/video/cx18/built-in.o: In function `service2vbi': /home/v4l/tokernel/git/drivers/media/video/cx18/cx18-ioctl.c:44: multiple definition of `service2vbi' drivers/media/video/ivtv/built-in.o:/home/v4l/tokernel/git/drivers/media/video/ivtv/ivtv-ioctl.c:42: first defined here make[2]: ** [drivers/media/video/built-in.o] Erro 1 make[1]: ** [drivers/media/video] Erro 2 make: ** [drivers/media/] Erro 2 Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
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>