The patch number 9598 was added via Andy Walls <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Andy Walls  <[EMAIL PROTECTED]>
cx18: Prevent CX23418 from clearing it's outgoing ack interrupts to driver


When the CX23418 CPU unit sent out an ack interrupt to the linux driver, it
also received that interrupt and cleared the flag before the linux driver could
see what the interrupt was for.  This fix prevents the CPU from receiving an
IRQ for it's own outgoing ack's to the linux driver.  This fix is critical now
that the linux driver doesn't poll but relies on these ack interrupts.

Priority: high

Signed-off-by: Andy Walls <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/cx18/cx18-firmware.c |   11 +++++++++++
 linux/drivers/media/video/cx18/cx18-io.c       |    7 +++++++
 linux/drivers/media/video/cx18/cx18-io.h       |    1 +
 linux/drivers/media/video/cx18/cx18-irq.h      |    1 +
 4 files changed, 20 insertions(+)

diff -r 467df2de8c0f -r 67278296c717 
linux/drivers/media/video/cx18/cx18-firmware.c
--- a/linux/drivers/media/video/cx18/cx18-firmware.c    Sat Nov 08 15:14:22 
2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-firmware.c    Sun Nov 09 16:14:07 
2008 -0500
@@ -380,6 +380,17 @@ int cx18_firmware_init(struct cx18 *cx)
                if (sz <= 0)
                        return -EIO;
        }
+
+       /*
+        * The CPU firmware apparently sets up to receive an interrupt for it's
+        * outgoing IRQ_CPU_TO_EPU_ACK to us (*boggle*).  We get an interrupt
+        * when it sends us an ack, but by the time we process it, that flag in
+        * the SW2 status register has been cleared by the CPU firmware.
+        * We'll prevent that not so useful behavior by clearing the CPU's
+        * interrupt enables for Ack IRQ's we want to process.
+        */
+       cx18_sw2_irq_disable_cpu(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);
+
        /* initialize GPIO */
        cx18_write_reg_expect(cx, 0x14001400, 0xc78110, 0x00001400, 0x14001400);
        return 0;
diff -r 467df2de8c0f -r 67278296c717 linux/drivers/media/video/cx18/cx18-io.c
--- a/linux/drivers/media/video/cx18/cx18-io.c  Sat Nov 08 15:14:22 2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-io.c  Sun Nov 09 16:14:07 2008 -0500
@@ -262,6 +262,13 @@ void cx18_sw2_irq_disable(struct cx18 *c
        cx18_write_reg(cx, r & ~val, SW2_INT_ENABLE_PCI);
 }
 
+void cx18_sw2_irq_disable_cpu(struct cx18 *cx, u32 val)
+{
+       u32 r;
+       r = cx18_read_reg(cx, SW2_INT_ENABLE_CPU);
+       cx18_write_reg(cx, r & ~val, SW2_INT_ENABLE_CPU);
+}
+
 void cx18_setup_page(struct cx18 *cx, u32 addr)
 {
        u32 val;
diff -r 467df2de8c0f -r 67278296c717 linux/drivers/media/video/cx18/cx18-io.h
--- a/linux/drivers/media/video/cx18/cx18-io.h  Sat Nov 08 15:14:22 2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-io.h  Sun Nov 09 16:14:07 2008 -0500
@@ -390,6 +390,7 @@ void cx18_sw1_irq_disable(struct cx18 *c
 void cx18_sw1_irq_disable(struct cx18 *cx, u32 val);
 void cx18_sw2_irq_enable(struct cx18 *cx, u32 val);
 void cx18_sw2_irq_disable(struct cx18 *cx, u32 val);
+void cx18_sw2_irq_disable_cpu(struct cx18 *cx, u32 val);
 void cx18_setup_page(struct cx18 *cx, u32 addr);
 
 #endif /* CX18_IO_H */
diff -r 467df2de8c0f -r 67278296c717 linux/drivers/media/video/cx18/cx18-irq.h
--- a/linux/drivers/media/video/cx18/cx18-irq.h Sat Nov 08 15:14:22 2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-irq.h Sun Nov 09 16:14:07 2008 -0500
@@ -28,6 +28,7 @@
 #define SW1_INT_ENABLE_PCI              0xc7311c
 #define SW2_INT_SET                     0xc73140
 #define SW2_INT_STATUS                  0xc73144
+#define SW2_INT_ENABLE_CPU              0xc73158
 #define SW2_INT_ENABLE_PCI              0xc7315c
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/67278296c717b68cbfa1c18cc093a0698532a08a

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to