[media] davinci: vpif: add check for genuine interrupts in the isr
authorManjunath Hadli <manjunath.hadli@ti.com>
Fri, 13 Apr 2012 07:43:10 +0000 (04:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Jul 2012 21:59:50 +0000 (18:59 -0300)
As the same interrupt is shared between capture and display devices,
sometimes we get isr calls where the interrupt might not genuinely belong
to capture or display. Hence, add a condition in the isr to check for
interrupt ownership and channel number to make sure we do not
service wrong interrupts.

Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/davinci/vpif.h
drivers/media/video/davinci/vpif_capture.c
drivers/media/video/davinci/vpif_display.c

index 8bcac65f9294e4abc4c886441e887fe0f3b35453..a4d2141d1ef34b1d0281464fd4015f8ea96a00b2 100644 (file)
@@ -569,6 +569,21 @@ static inline void ch3_set_vbi_addr(unsigned long top_strt_luma,
        regw(btm_strt_luma, VPIF_CH3_BTM_STRT_ADD_VANC);
 }
 
+static inline int vpif_intr_status(int channel)
+{
+       int status = 0;
+       int mask;
+
+       if (channel < 0 || channel > 3)
+               return 0;
+
+       mask = 1 << channel;
+       status = regr(VPIF_STATUS) & mask;
+       regw(status, VPIF_STATUS_CLR);
+
+       return status;
+}
+
 #define VPIF_MAX_NAME  (30)
 
 /* This structure will store size parameters as per the mode selected by user */
index 96046957bf21cb3832375215bd8dc13a4cb70ca9..e0114123484691a275c985b6504f377794dbc8b1 100644 (file)
@@ -341,6 +341,9 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
        int fid = -1, i;
 
        channel_id = *(int *)(dev_id);
+       if (!vpif_intr_status(channel_id))
+               return IRQ_NONE;
+
        ch = dev->dev[channel_id];
 
        field = ch->common[VPIF_VIDEO_INDEX].fmt.fmt.pix.field;
index e6488ee7db1877510a490724c7311f5f98f16e78..a5049a92f8515f84c3a4734533b3e3352a0631fc 100644 (file)
@@ -307,6 +307,9 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
        int channel_id = 0;
 
        channel_id = *(int *)(dev_id);
+       if (!vpif_intr_status(channel_id + 2))
+               return IRQ_NONE;
+
        ch = dev->dev[channel_id];
        field = ch->common[VPIF_VIDEO_INDEX].fmt.fmt.pix.field;
        for (i = 0; i < VPIF_NUMOBJECTS; i++) {
This page took 0.055538 seconds and 5 git commands to generate.