Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1282912rdb; Wed, 6 Dec 2023 14:06:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFotdifGpoHZ89B6D+7oxYaEuu44Lix2sADM93pFWcMkci0UHboOMTT37R0FXzRm0N3CZqX X-Received: by 2002:a05:6a00:4189:b0:6ce:2732:27d with SMTP id ca9-20020a056a00418900b006ce2732027dmr1685418pfb.44.1701900396094; Wed, 06 Dec 2023 14:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701900396; cv=none; d=google.com; s=arc-20160816; b=uR2NU+/bcBI+9zdQdvihkb7Ymr2XXroFZYS2Vr4pbNMqsPsYgqH7EneIDAyJ9x2WWQ XS5IWJ14ZIDDGLrEW1uoM2mSndN58ze9EmJ3wahZcgSZs7HDD/l3u7UbnyGQ909+5lKN 9x+p2+niJxYOnsQCCNck8W8K+pBo2jGfTgh7Fm/+KSdF/fc6ntZJpxhPdthlViR1eiZc o7rrtY3qIt8xQKel+Xi6x3Ja+1Zl4Dy2WoiR4q/MLFgIF74G5gcAOhUQvSrVLnEnXIV+ QDRVaY17gZB/5G8bs41GKRu4QcSgI6gcAEdlatXaCBRfCi0n/SLyJysh5slQLd7nTLY3 4bRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YduQrgXTrt5yt+MYuXxmRCCE96xPBNGCZF72BxMh93g=; fh=R21zpjKbl9YWrtu/YTsLnY0FeiDryfrWDIu5g6GjEVY=; b=t0Oc5dxnIaXbW7oYte6ELNIz/NZlgEc+X5cH0AFIfU0wc81PpFOV9Hc/5LKQ37HxX9 bPEWYb8Vh+t7T27lXQzfgmgaQkEXhN+DCUX99lWcwBypwOgIdSsCaBLKmK1NSvUODue/ 67iFFcV81VNyrHftM0rqejyCRtxTwxEuyXXb6Ag7InNE1S1LLJMWtdnQAfy4pP/Ir3XG 3lC0WkJVGqvddsujer4IxkRuCDRBqIFjzBc8splya/+YwPWca8gejcDaxUsKwv3BOxZ5 G3KzniLzCx1YUrU+EHzyWQTWFwLSOTkDY7vrpf5e2St2A7sn0G9qODSczFFmw7+bAh6/ BJeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=KT5ng6A2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h9-20020a056a00170900b006cb75e0f91bsi14622pfc.45.2023.12.06.14.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 14:06:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=KT5ng6A2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 71022808A435; Wed, 6 Dec 2023 14:06:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377453AbjLFWFt (ORCPT + 99 others); Wed, 6 Dec 2023 17:05:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377421AbjLFWFq (ORCPT ); Wed, 6 Dec 2023 17:05:46 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB64DE; Wed, 6 Dec 2023 14:05:52 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D31F9556; Wed, 6 Dec 2023 23:05:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701900309; bh=keu6mZ1cZpht5aJTt3UURktqyYiTT3jXahRG3j0hD+g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KT5ng6A2iGFV5ef2agWZKkPeDA9NB7ofdMpJB2Iihwf+WTQ36ISkHAZTeYNxBL7s5 mTQFjlpxeyyv4YOCGBpTAD2TixR2lV0T9BLPMjAHAArucOCjBpmB82AZwTt/PIfCt0 hbOictZr2XBlzRqGwUlunC9QdnrLDJSgXR2ihWqk= Date: Thu, 7 Dec 2023 00:05:56 +0200 From: Laurent Pinchart To: Tomi Valkeinen Cc: Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , Paul Elder , Alexander Stein , kieran.bingham@ideasonboard.com, umang.jain@ideasonboard.com, aford173@gmail.com, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] media: rkisp1: Store IRQ lines Message-ID: <20231206220556.GC29417@pendragon.ideasonboard.com> References: <20231206-rkisp-irq-fix-v2-0-6ba4185eeb1f@ideasonboard.com> <20231206-rkisp-irq-fix-v2-3-6ba4185eeb1f@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231206-rkisp-irq-fix-v2-3-6ba4185eeb1f@ideasonboard.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 06 Dec 2023 14:06:04 -0800 (PST) Hi Tomi, Thank you for the patch. On Wed, Dec 06, 2023 at 12:12:30PM +0200, Tomi Valkeinen wrote: > Store the IRQ lines used by the driver for easy access. These are needed > in future patches which fix IRQ race issues. > > Signed-off-by: Tomi Valkeinen > --- > .../media/platform/rockchip/rkisp1/rkisp1-common.h | 11 ++++++++++- > drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 19 ++++++++++++++----- > 2 files changed, 24 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > index 960ab89c659b..ec28907d978e 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h > @@ -62,6 +62,14 @@ struct regmap; > RKISP1_CIF_ISP_EXP_END | \ > RKISP1_CIF_ISP_HIST_MEASURE_RDY) > > +/* IRQ lines */ > +enum rkisp1_irq_line { > + RKISP1_IRQ_ISP = 0, > + RKISP1_IRQ_MI, > + RKISP1_IRQ_MIPI, > + RKISP1_NUM_IRQS, > +}; > + > /* enum for the resizer pads */ > enum rkisp1_rsz_pad { > RKISP1_RSZ_PAD_SINK, > @@ -437,7 +445,6 @@ struct rkisp1_debug { > * struct rkisp1_device - ISP platform device > * > * @base_addr: base register address > - * @irq: the irq number > * @dev: a pointer to the struct device > * @clk_size: number of clocks > * @clks: array of clocks > @@ -457,6 +464,7 @@ struct rkisp1_debug { > * @stream_lock: serializes {start/stop}_streaming callbacks between the capture devices. > * @debug: debug params to be exposed on debugfs > * @info: version-specific ISP information > + * @irqs: IRQ line numbers > */ > struct rkisp1_device { > void __iomem *base_addr; > @@ -479,6 +487,7 @@ struct rkisp1_device { > struct mutex stream_lock; /* serialize {start/stop}_streaming cb between capture devices */ > struct rkisp1_debug debug; > const struct rkisp1_info *info; > + int irqs[RKISP1_NUM_IRQS]; > }; > > /* > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > index 030eb8c79546..492ff5e6770d 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > @@ -115,6 +115,7 @@ > struct rkisp1_isr_data { > const char *name; > irqreturn_t (*isr)(int irq, void *ctx); > + u32 line_mask; > }; > > /* ---------------------------------------------------------------------------- > @@ -473,9 +474,9 @@ static const char * const px30_isp_clks[] = { > }; > > static const struct rkisp1_isr_data px30_isp_isrs[] = { > - { "isp", rkisp1_isp_isr }, > - { "mi", rkisp1_capture_isr }, > - { "mipi", rkisp1_csi_isr }, > + { "isp", rkisp1_isp_isr, BIT(RKISP1_IRQ_ISP) }, > + { "mi", rkisp1_capture_isr, BIT(RKISP1_IRQ_MI) }, > + { "mipi", rkisp1_csi_isr, BIT(RKISP1_IRQ_MIPI) }, > }; > > static const struct rkisp1_info px30_isp_info = { > @@ -496,7 +497,7 @@ static const char * const rk3399_isp_clks[] = { > }; > > static const struct rkisp1_isr_data rk3399_isp_isrs[] = { > - { NULL, rkisp1_isr }, > + { NULL, rkisp1_isr, BIT(RKISP1_IRQ_ISP) | BIT(RKISP1_IRQ_MI) | BIT(RKISP1_IRQ_MIPI) }, > }; > > static const struct rkisp1_info rk3399_isp_info = { > @@ -517,7 +518,7 @@ static const char * const imx8mp_isp_clks[] = { > }; > > static const struct rkisp1_isr_data imx8mp_isp_isrs[] = { > - { NULL, rkisp1_isr }, > + { NULL, rkisp1_isr, BIT(RKISP1_IRQ_ISP) | BIT(RKISP1_IRQ_MI) | BIT(RKISP1_IRQ_MIPI) }, The i.MX8MP has no CSI-2 RX in the ISP, you can drop RKISP1_IRQ_MIPI. I think we can merge this series before the i.MX8MP support, could you base v3 on top of the master branch of the linux-media stage tree ? > }; > > static const struct rkisp1_info imx8mp_isp_info = { > @@ -574,6 +575,9 @@ static int rkisp1_probe(struct platform_device *pdev) > if (IS_ERR(rkisp1->base_addr)) > return PTR_ERR(rkisp1->base_addr); > > + for (unsigned int il = 0; il < RKISP1_NUM_IRQS; ++il) I would use ARRAY_SIZE(rkisp1->irqs) instead of RKISP1_NUM_IRQS here. > + rkisp1->irqs[il] = -1; > + > for (i = 0; i < info->isr_size; i++) { > irq = info->isrs[i].name > ? platform_get_irq_byname(pdev, info->isrs[i].name) > @@ -581,6 +585,11 @@ static int rkisp1_probe(struct platform_device *pdev) > if (irq < 0) > return irq; > > + for (unsigned int il = 0; il < RKISP1_NUM_IRQS; ++il) { Same here. > + if (info->isrs[i].line_mask & BIT(il)) > + rkisp1->irqs[il] = irq; > + } > + > ret = devm_request_irq(dev, irq, info->isrs[i].isr, 0, > dev_driver_string(dev), dev); > if (ret) { -- Regards, Laurent Pinchart