V4L/DVB: V4L: vpfe_capture: Add call back function for interrupt clear for vpfe_cfg
authorVaibhav Hiremath <hvaibhav@ti.com>
Sat, 27 Mar 2010 12:37:07 +0000 (09:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:52:43 +0000 (00:52 -0300)
For the devices like AM3517, it is expected that driver clears the
interrupt in ISR. Since this is device spcific, callback function
added to the platform_data.

Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Muralidharan Karicheri <mkaricheri@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/davinci/vpfe_capture.c
include/media/davinci/vpfe_capture.h

index 398dbe71cb82aa60ca07e104b84c89f4274b959e..caeac199d15b7e71ee4a15bcf026fcf1212948c1 100644 (file)
@@ -475,6 +475,11 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev)
        ret = ccdc_dev->hw_ops.open(vpfe_dev->pdev);
        if (!ret)
                vpfe_dev->initialized = 1;
+
+       /* Clear all VPFE/CCDC interrupts */
+       if (vpfe_dev->cfg->clr_intr)
+               vpfe_dev->cfg->clr_intr(-1);
+
 unlock:
        mutex_unlock(&ccdc_lock);
        return ret;
@@ -562,7 +567,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
 
        /* if streaming not started, don't do anything */
        if (!vpfe_dev->started)
-               return IRQ_HANDLED;
+               goto clear_intr;
 
        /* only for 6446 this will be applicable */
        if (NULL != ccdc_dev->hw_ops.reset)
@@ -574,7 +579,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
                        "frame format is progressive...\n");
                if (vpfe_dev->cur_frm != vpfe_dev->next_frm)
                        vpfe_process_buffer_complete(vpfe_dev);
-               return IRQ_HANDLED;
+               goto clear_intr;
        }
 
        /* interlaced or TB capture check which field we are in hardware */
@@ -604,7 +609,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
                                addr += vpfe_dev->field_off;
                                ccdc_dev->hw_ops.setfbaddr(addr);
                        }
-                       return IRQ_HANDLED;
+                       goto clear_intr;
                }
                /*
                 * if one field is just being captured configure
@@ -624,6 +629,10 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
                 */
                vpfe_dev->field_id = fid;
        }
+clear_intr:
+       if (vpfe_dev->cfg->clr_intr)
+               vpfe_dev->cfg->clr_intr(irq);
+
        return IRQ_HANDLED;
 }
 
@@ -635,8 +644,11 @@ static irqreturn_t vdint1_isr(int irq, void *dev_id)
        v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "\nInside vdint1_isr...\n");
 
        /* if streaming not started, don't do anything */
-       if (!vpfe_dev->started)
+       if (!vpfe_dev->started) {
+               if (vpfe_dev->cfg->clr_intr)
+                       vpfe_dev->cfg->clr_intr(irq);
                return IRQ_HANDLED;
+       }
 
        spin_lock(&vpfe_dev->dma_queue_lock);
        if ((vpfe_dev->fmt.fmt.pix.field == V4L2_FIELD_NONE) &&
@@ -644,6 +656,10 @@ static irqreturn_t vdint1_isr(int irq, void *dev_id)
            vpfe_dev->cur_frm == vpfe_dev->next_frm)
                vpfe_schedule_next_buffer(vpfe_dev);
        spin_unlock(&vpfe_dev->dma_queue_lock);
+
+       if (vpfe_dev->cfg->clr_intr)
+               vpfe_dev->cfg->clr_intr(irq);
+
        return IRQ_HANDLED;
 }
 
index 4314a5f6a0876b176526c9fe0adfe7fa1b012329..cc973ed845a735c28b089befae3807ea13ea10f1 100644 (file)
@@ -94,6 +94,8 @@ struct vpfe_config {
        /* vpfe clock */
        struct clk *vpssclk;
        struct clk *slaveclk;
+       /* Function for Clearing the interrupt */
+       void (*clr_intr)(int vdint);
 };
 
 struct vpfe_device {