From patchwork Tue Jul 3 09:30:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Lad X-Patchwork-Id: 1149771 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork1.kernel.org (Postfix) with ESMTP id 37EF640134 for ; Tue, 3 Jul 2012 09:32:29 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q639WRgl021364 for ; Tue, 3 Jul 2012 04:32:27 -0500 Received: from DFLE70.ent.ti.com (dfle70.ent.ti.com [128.247.5.40]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q639WRih031469 for ; Tue, 3 Jul 2012 04:32:27 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle70.ent.ti.com (128.247.5.40) with Microsoft SMTP Server id 14.1.323.3; Tue, 3 Jul 2012 04:32:27 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q639WQl6029664 for ; Tue, 3 Jul 2012 04:32:26 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id E89EC80626 for ; Tue, 3 Jul 2012 04:32:25 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 84F3A80626 for ; Tue, 3 Jul 2012 04:32:17 -0500 (CDT) Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q639WGgX023699; Tue, 3 Jul 2012 15:02:16 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Tue, 3 Jul 2012 15:02:15 +0530 Received: from psplinux051 (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q639WDMX004630; Tue, 3 Jul 2012 15:02:15 +0530 Received: from x0144960 by psplinux051 with local (Exim 4.74) (envelope-from ) id 1SlzSv-0001Qf-TG; Tue, 03 Jul 2012 15:02:13 +0530 From: Prabhakar Lad To: LMML Subject: [PATCH v4 01/14] davinci: vpif: add check for genuine interrupts in the isr Date: Tue, 3 Jul 2012 15:00:43 +0530 Message-ID: <1341307856-5298-2-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1341307856-5298-1-git-send-email-prabhakar.lad@ti.com> References: <1341307856-5298-1-git-send-email-prabhakar.lad@ti.com> MIME-Version: 1.0 CC: dlos X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com From: Manjunath Hadli 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 Signed-off-by: Lad, Prabhakar --- drivers/media/video/davinci/vpif.h | 15 +++++++++++++++ drivers/media/video/davinci/vpif_capture.c | 3 +++ drivers/media/video/davinci/vpif_display.c | 3 +++ 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h index 8bcac65..a4d2141 100644 --- a/drivers/media/video/davinci/vpif.h +++ b/drivers/media/video/davinci/vpif.h @@ -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 */ diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 9604695..e011412 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c @@ -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; diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index e6488ee..a5049a9 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -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++) {