Message ID | 20221103163113.245462-27-paul.kocialkowski@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638757wru; Thu, 3 Nov 2022 09:35:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cIIXm7qm6NjjkogxHIMyuqTsc6MvWdtG4qw2rEpcxHTXkl4E7Z9qIK4y8b6KrSrPab6Ij X-Received: by 2002:a05:6402:40cc:b0:462:555e:5f73 with SMTP id z12-20020a05640240cc00b00462555e5f73mr32278322edb.259.1667493338357; Thu, 03 Nov 2022 09:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667493338; cv=none; d=google.com; s=arc-20160816; b=bWohWkZe5amnmKWgjfA+w7iIUGmjLQlrdmrwkH/jvTG6FN7lLIBMbdn5yywFYFDlax uq4mRzh4AK4laQqNym+xF2emFQlZOZ2FnzmjAL6PaKNGfG/7PMFgZ7UeZDtVq8T6aIqS cI22nNqCZ6y19B/B97LH8B56SSxgbrKMAXEKNzrON7MwDcEDOPfh69um8hsXrupdzHsE i3j1ZJk5AGEGVfQiO9s9tS0znLYy86eU1/0yfvd0QWuOdHMPd9Q61XQ7USfNfhNO6/Z1 po9V+nOLM32Svw2F+3dT+ZoNQ1pH1zDftDlPUm+TX2BDMqnWkYbbi0ohCpME3EmWwLw1 iN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/ybiF9hMG300Px1O442DTixRO6cyKnlrebYwSIZbK9I=; b=M3LIc9HdsHspkhS7SjMBO30K4KGjkdpcQRdWIF1IQrwMnMXOtLUa1HVq0z7eIM05tm ESvacAG/GgjUbs3zczaa1DrwJ/HWNm+QbvwhFbk22MTFEGiCYaN2PrLfBCXoCbZCkRLS CO3oY+JW449O0/mFBnWLPivDsC9iETqe3TI67mZUGxN5uboz+Gok/pCMY71fIZXd1su5 iIfG67ifXcis0KdODCFjVuOfW7HArHF9zayvqltwiKm1RsxpSX80Gpbss56WYyE8GK7L zvkDc3dVp+XNQT9YWJuPbrmVyk0LLH7E3H9T4hUKG/ajSVYF8t7YpYroUyQfUSgrDNVx s/CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PaCK0ftL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb3-20020a1709076d8300b0078d43ae07e1si1958015ejc.649.2022.11.03.09.35.13; Thu, 03 Nov 2022 09:35:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PaCK0ftL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbiKCQd4 (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 12:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbiKCQci (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 12:32:38 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDAF1D0FC; Thu, 3 Nov 2022 09:32:21 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id E5D1324000A; Thu, 3 Nov 2022 16:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1667493140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ybiF9hMG300Px1O442DTixRO6cyKnlrebYwSIZbK9I=; b=PaCK0ftLWObcmWLmbGfLklGibseApJKFvoR8MLzaaJBR8E2ipkhwavOY4mxHbQAHdV+Z83 el5YxxkrwTWD1b+TZhSCrVVSsdO0PprZsjZdVBx4Eyn2ozKDfcjR9NcDmI+jTivun+Bx2Z yAYDPtwToLfKohFfpJLZV1jL7+IjUHeY5sDP7eSbaV1SsnEmIemzYUduKxw0tOA8Q2D4jX u8kHTPFHHH9tsUl6eekN8TNaZ8HqSlxCmnrmYtSNMRgTwi84Et1Y+UePhZAYsGiQgf6bdQ pAXgSlZuCSfJhAgS1wTAcK43M7okf2cXLUbvScHg6ahj3Z1qhKjYYB1UqnMJWQ== From: Paul Kocialkowski <paul.kocialkowski@bootlin.com> To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Cc: Yong Deng <yong.deng@magewell.com>, Paul Kocialkowski <paul.kocialkowski@bootlin.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Maxime Ripard <mripard@kernel.org>, Thomas Petazzoni <thomas.petazzoni@bootlin.com> Subject: [PATCH v7 26/28] media: sun6i-csi: Add extra checks to the interrupt routine Date: Thu, 3 Nov 2022 17:31:11 +0100 Message-Id: <20221103163113.245462-27-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> References: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748493494893953547?= X-GMAIL-MSGID: =?utf-8?q?1748493494893953547?= |
Series |
Allwinner A31/A83T MIPI CSI-2 and A31 ISP / CSI Rework
|
|
Commit Message
Paul Kocialkowski
Nov. 3, 2022, 4:31 p.m. UTC
Check against the enabled bits and make sure capture is running before serving an interrupt, to add extra safety in the process. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index eaf62cab0b64..46c5f98702e1 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -89,13 +89,17 @@ static void sun6i_csi_v4l2_cleanup(struct sun6i_csi_device *csi_dev) static irqreturn_t sun6i_csi_interrupt(int irq, void *private) { struct sun6i_csi_device *csi_dev = private; + bool capture_streaming = csi_dev->capture.state.streaming; struct regmap *regmap = csi_dev->regmap; - u32 status; + u32 status = 0, enable = 0; regmap_read(regmap, SUN6I_CSI_CH_INT_STA_REG, &status); + regmap_read(regmap, SUN6I_CSI_CH_INT_EN_REG, &enable); - if (!(status & 0xFF)) + if (!status) return IRQ_NONE; + else if (!(status & enable) || !capture_streaming) + goto complete; if ((status & SUN6I_CSI_CH_INT_STA_FIFO0_OF) || (status & SUN6I_CSI_CH_INT_STA_FIFO1_OF) || @@ -116,6 +120,7 @@ static irqreturn_t sun6i_csi_interrupt(int irq, void *private) if (status & SUN6I_CSI_CH_INT_STA_VS) sun6i_csi_capture_sync(csi_dev); +complete: regmap_write(regmap, SUN6I_CSI_CH_INT_STA_REG, status); return IRQ_HANDLED;