From patchwork Mon Jun 25 11:07:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manjunath Hadli X-Patchwork-Id: 1130171 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-davinci@patchwork.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork2.kernel.org (Postfix) with ESMTP id E87A7DFFEA for ; Thu, 28 Jun 2012 23:34:34 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q5PB8ABR013969 for ; Mon, 25 Jun 2012 06:08:10 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5PB8Ad7018095 for ; Mon, 25 Jun 2012 06:08:10 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Mon, 25 Jun 2012 06:08:10 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5PB8A45025148 for ; Mon, 25 Jun 2012 06:08:10 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id EA9918062D for ; Mon, 25 Jun 2012 06:08:09 -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 3158180628 for ; Mon, 25 Jun 2012 06:07:59 -0500 (CDT) Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5PB7vnD025094; Mon, 25 Jun 2012 16:37:57 +0530 (IST) Received: from dbdp33.itg.ti.com (172.24.170.252) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Mon, 25 Jun 2012 16:37:57 +0530 Received: from psplinux051 (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp33.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5PB7tU8012130; Mon, 25 Jun 2012 16:37:56 +0530 Received: from x0144960 by psplinux051 with local (Exim 4.74) (envelope-from ) id 1Sj799-0002jE-82; Mon, 25 Jun 2012 16:37:55 +0530 From: Manjunath Hadli To: LMML Subject: [PATCH v3 01/13] davinci: vpif: add check for genuine interrupts in the isr Date: Mon, 25 Jun 2012 16:37:23 +0530 Message-ID: <1340622455-10419-2-git-send-email-manjunath.hadli@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1340622455-10419-1-git-send-email-manjunath.hadli@ti.com> References: <1340622455-10419-1-git-send-email-manjunath.hadli@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 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++) {