summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx18/cx18-mailbox.c
AgeCommit message (Collapse)Author
2009-06-16V4L/DVB (11618): cx18: Convert per stream mutex locks to per queue spin locksAndy Walls
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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16V4L/DVB (11617): cx18: Set up to wait for a one-shot response before sending ↵Andy Walls
a firmware cmd When sending an outgoing firmware command, prepare to wait before we raise the interrupt, so we don't miss the wake_up() on the acknowledgment. When waiting for the acknowledgement, there is no need to loop around schedule(), as there will only be one interrupt, and hence one wake_up(), issued. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16V4L/DVB (11615): cx18: Rename the work queue to "in_work_queue"Andy Walls
Rename the work queue to "in_work_queue" to indicate it is handling incoming mailbox commands. This is preparation for adding a work queue for handling deferrable outgoing mailbox commands. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10278): cx18: Fix bad audio in first analog capture.Andy Walls
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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10275): cx18: Additional debug to display outgoing mailbox parametersAndy Walls
Added debug display of outgoing mailbox arguments. Fixed a minor problem with display of stale incoming mailbox contents, when user was not looking for debug warnings. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9895): cx18: Refine the firmware load and firmware startup processAndy Walls
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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9894): cx18: Use a known open task handle when setting stream ↵Andy Walls
CX2341x parameters 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9804): cx18: Avoid making firmware API calls with the queue lock heldAndy Walls
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. 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 (9776): cx18: Change to per CX23418 device work queues for ↵Andy Walls
deferrable work handling 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9730): cx18: Quiet a sometimes common warning that often has benign ↵Andy Walls
consequences cx18: Quiet a sometimes common warning that often has benign consequences. No one probably cares that the firmware took forever to ack our command, as they always seem to succeed whether or not the firmware acks it in a reasonable amount of time. 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-12-30V4L/DVB (9727): cx18: Adjust outgoing mailbox timeouts and remove statistics ↵Andy Walls
logging 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9726): cx18: Restore buffers that have fallen out of the transfer ↵Andy Walls
rotation Restore buffers that have fallen out of the transfer rotation, and check for coherent mailbox data when processing a stale mailbox. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9725): cx18: Remove unnecessary MMIO accesses in time critical irq ↵Andy Walls
handling path 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9723): cx18: Propagate staleness of mailbox and mdl ack data to ↵Andy Walls
work handler 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9721): cx18: Change to singlethreaded global work queue thread for ↵Andy Walls
deferable work 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9720): cx18: Major rewrite of interrupt handling for incoming ↵Andy Walls
mailbox processing 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9596): cx18: Further changes to improve mailbox protocol integrity ↵Andy Walls
& performnce 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9595): cx18: Improve handling of outgoing mailboxes detected to be busyAndy Walls
cx18: Improve handling of outgoing mailboxes detected to be busy. When encountering a busy mailbox, sleep instead of polling, and wait for interrupt or timeout. If the mailbox is still busy, force it free. When sending commands, make sure we never create a situation where we mark the mailbox busy upon sending, and ensure we always have a method to cleanly recover from a busy mailbox. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9593): cx18: Add outgoing mailbox mutexes and check for ack via ↵Andy Walls
waitq vs poll 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-11V4L/DVB (9511): cx18: Mark CX18_CPU_DE_RELEASE_MDL as a slow API callAndy Walls
cx18: Mark CX18_CPU_DE_RELEASE_MDL as a slow API call. Give the encoder time to complete the MDL release before destroying the encoder internal task. This avoids an encoder lockup on the next digital capture and error messages about buffers being returned for an inactive encoder task handle. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-11V4L/DVB (9510): cx18: Fix write retries for registers that always change - ↵Andy Walls
part 2. cx18: Fix write retries for registers that always change - part 2. Some registers, especially interrupt related ones, will never read back the value just written. Modified interrupt register readback checks to make sure the intended effect was achieved. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-11V4L/DVB (9475): cx18: Disable write retries for registers that always change ↵Andy Walls
- part 1. cx18: Disable write retries for registers that always change - part 1. Interrupt related registers will likely not read back the value we just wrote. Disable retries for these registers for now to avoid accidently discarding interrupts. More intelligent read back verification criteria are needed for these and other registers (e.g. GPIO line registers), which will be addressed in subsequent changes. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8913): cx18: Create cx18_ specific wrappers for all pci mmio ↵Andy Walls
accessesors. 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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8774): cx18: Have CX23418 release buffers at end of capture.Andy Walls
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. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-07-20V4L/DVB (8167): cx18: set correct audio inputs for tuner and line-in 2.Hans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
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-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>