Message ID | 20231129092759.242641-6-paul.elder@ideasonboard.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp219784vqn; Wed, 29 Nov 2023 01:29:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfr5V4312OHgT9mNdF9Qi9ao4VnzbAzBUDZ62M1Oxu566mShlOrbJV+gBmascCypHPxAD1 X-Received: by 2002:a17:902:748a:b0:1cf:647a:9fd0 with SMTP id h10-20020a170902748a00b001cf647a9fd0mr15001616pll.6.1701250190843; Wed, 29 Nov 2023 01:29:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701250190; cv=none; d=google.com; s=arc-20160816; b=lGv4D9QqF329WnDbwgSzl/eoCiKPYvXquHbrSZsxArwZjfpaQT1cqFB/kIlTeNZIAb cy912Dhb8mt7Mwjvx8khg5wdYpwS5kyWJTO1W8/aAMTBtGs4fQIqi2KxqCwUxjVG2VEI GGf44iBK5avojz4J+sNAhY/jPqy8QqfGsXnKNXfDvCmu6zWXC41HWGkSublX/BOuB5za m2wd70PDr6onJ6zdcyZOBRw/wK1AahHDfNsYY+UOgiZS9+jzL48Zr/ZCUldZ1stbyMfQ yFjbrtTXhGinNJ/jxjRx27G5AJPpHwHFjiFLRLMQH3B3iKufp6K6BDEeWDP0MrkclZPO zxYg== 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=/BzDvuqROep64WMzf8LmLhRd1hxedkPN87EUWcCx+Rs=; fh=9TGZi8GZBh0Z4pe+JUoyBc66OzVUR/Oowb7otIyZbDQ=; b=ICTroW8TJ+B4QtRVjgWUmDv0ilZLwV4P+UKUDybx4jhw58JHk//4kUF/3gn+C/nEaR ihzYRwCaN6aJ8NnLndjyF2VbiZqZ3TQu0pnHRXYW/CkQTmNxBN7nBGSsqbcV+W+dagJi fFgy16USmRUlx7UJOP5EyNfFbbYfsRu0Eg6Dn4GpvUytoTqyqyX+reLiFgkd4wNj6yHk +BM30WHBEy+lymdsMiSvZpgxZPhYtmwhYtLst0ZWvtpvypgQ2i9ycKuTXVfK2Lqkv1e/ BnBVQHFSVRXgFAz0fL7dv5jUZNcJi8inZkoJqb67Iw+mIg4tqtRoIBnt/nIgEdrVBxN9 Ls7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aDXlrcTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q11-20020a170902dacb00b001cffe1d7499si3063763plx.254.2023.11.29.01.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 01:29:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aDXlrcTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 94CEB80ACFC6; Wed, 29 Nov 2023 01:29:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjK2J3V (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 29 Nov 2023 04:29:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjK2J2x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Nov 2023 04:28:53 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C231FFA; Wed, 29 Nov 2023 01:28:43 -0800 (PST) Received: from pyrite.hamster-moth.ts.net (h175-177-049-135.catv02.itscom.jp [175.177.49.135]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 26B69F02; Wed, 29 Nov 2023 10:28:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701250086; bh=Edrymv5691+fMNHomNnzzNr4DmSpwPe97XaFQm/kkW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aDXlrcTI9ujlwLviFejRx+86njHF7zKPxbHPS3bIt9iAygP67XR5zGuBFoQe1SA9e ZgPxXYj9EnTmQtlN79OzIdjLjKkQd6Mk8icNqxbC93QIk02+bRGHIgU62RWfXvOQyv GbugVP2iLOawbOF5UGjvLr9+d/B4iGThKrlyq7aM= From: Paul Elder <paul.elder@ideasonboard.com> To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org Cc: kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, aford173@gmail.com, Paul Elder <paul.elder@ideasonboard.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Dafna Hirschfeld <dafna@fastmail.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Heiko Stuebner <heiko@sntech.de>, linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Date: Wed, 29 Nov 2023 18:27:53 +0900 Message-Id: <20231129092759.242641-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231129092759.242641-1-paul.elder@ideasonboard.com> References: <20231129092759.242641-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 01:29:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783890120029426293 X-GMAIL-MSGID: 1783890120029426293 |
Series |
[v4,01/11] media: rkisp1: Add and use rkisp1_has_feature() macro
|
|
Commit Message
Paul Elder
Nov. 29, 2023, 9:27 a.m. UTC
The ISP8000Nano, found in the i.MX8MP, has a different architecture to crop at the resizer input. Instead of the "dual crop" block between the ISP and the resizers found in the RK3399, cropping has been moved to the input of the resizer blocks. As a result, the resizer CFG_UPD and CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE bit. Fix the resizer shadow update accordingly, using the DUAL_CROP feature to infer whether or not the resizer implements cropping. Support for resizer cropping itself will be added in a subsequent commit. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- Changes since v3: - Condition on RKISP1_FEATURE_DUAL_CROP feature - Update commit message Changes since v2: - Condition on RKISP1_FEATURE_RSZ_CROP feature - Rename bits - Use the rkisp1_has_feature() macro .../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++ .../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
Comments
Hi Paul, On 29/11/2023 11:27, Paul Elder wrote: > The ISP8000Nano, found in the i.MX8MP, has a different architecture to > crop at the resizer input. Instead of the "dual crop" block between the > ISP and the resizers found in the RK3399, cropping has been moved to the > input of the resizer blocks. As a result, the resizer CFG_UPD and > CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE > bit. > > Fix the resizer shadow update accordingly, using the DUAL_CROP feature > to infer whether or not the resizer implements cropping. Support for > resizer cropping itself will be added in a subsequent commit. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I don't think this one is correct. The above is perhaps true for ISP8000, but ISP8000Nano does not have CROP_ENABLE bit, and the CFG_UPD and CFG_UPD_AUTO are at the same locations as on RK3399. I don't have documentation to prove this, but experimentation shows that this is the case. Tomi > --- > Changes since v3: > > - Condition on RKISP1_FEATURE_DUAL_CROP feature > - Update commit message > > Changes since v2: > > - Condition on RKISP1_FEATURE_RSZ_CROP feature > - Rename bits > - Use the rkisp1_has_feature() macro > > .../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++ > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++---- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > index 3b19c8411360..95646b45f28b 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > @@ -168,6 +168,11 @@ > #define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9) > #define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16) > > +/* For resizer instances that support cropping */ > +#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8) > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9) > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10) > + > /* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */ > #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id) > #define RKISP1_CIF_MI_MBLK_LINE BIT(2) > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > index c1aaeed58acc..6d6ebc53c6e5 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > @@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz, > { > u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL); > > - if (when == RKISP1_SHADOW_REGS_ASYNC) > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; > - else > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; > + if (when == RKISP1_SHADOW_REGS_ASYNC) { > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; > + else > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO; > + } else { > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; > + else > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD; > + } > > rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg); > }
On Mon, Dec 18, 2023 at 05:31:18PM +0200, Tomi Valkeinen wrote: > Hi Paul, > > On 29/11/2023 11:27, Paul Elder wrote: > > The ISP8000Nano, found in the i.MX8MP, has a different architecture to > > crop at the resizer input. Instead of the "dual crop" block between the > > ISP and the resizers found in the RK3399, cropping has been moved to the > > input of the resizer blocks. As a result, the resizer CFG_UPD and > > CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE > > bit. > > > > Fix the resizer shadow update accordingly, using the DUAL_CROP feature > > to infer whether or not the resizer implements cropping. Support for > > resizer cropping itself will be added in a subsequent commit. > > > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > I don't think this one is correct. > > The above is perhaps true for ISP8000, but ISP8000Nano does not have > CROP_ENABLE bit, and the CFG_UPD and CFG_UPD_AUTO are at the same > locations as on RK3399. > > I don't have documentation to prove this, but experimentation shows that > this is the case. I agree with you. The missing CROP_ENABLE bit matches the missing resizer input crop capability in the i.MX8MP. I don't know if that's specific to the i.MX8MP, specific to the ISP8000Nano, or common to all ISP8000 versions when the instance is synthesized with a single path (which may be what ISP8000Nano is). > > --- > > Changes since v3: > > > > - Condition on RKISP1_FEATURE_DUAL_CROP feature > > - Update commit message > > > > Changes since v2: > > > > - Condition on RKISP1_FEATURE_RSZ_CROP feature > > - Rename bits > > - Use the rkisp1_has_feature() macro > > > > .../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++ > > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++---- > > 2 files changed, 16 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > > index 3b19c8411360..95646b45f28b 100644 > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h > > @@ -168,6 +168,11 @@ > > #define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9) > > #define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16) > > > > +/* For resizer instances that support cropping */ > > +#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8) > > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9) > > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10) > > + > > /* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */ > > #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id) > > #define RKISP1_CIF_MI_MBLK_LINE BIT(2) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > > index c1aaeed58acc..6d6ebc53c6e5 100644 > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c > > @@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz, > > { > > u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL); > > > > - if (when == RKISP1_SHADOW_REGS_ASYNC) > > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; > > - else > > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; > > + if (when == RKISP1_SHADOW_REGS_ASYNC) { > > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) > > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; > > + else > > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO; > > + } else { > > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) > > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; > > + else > > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD; > > + } > > > > rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg); > > }
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h index 3b19c8411360..95646b45f28b 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h @@ -168,6 +168,11 @@ #define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9) #define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16) +/* For resizer instances that support cropping */ +#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8) +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9) +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10) + /* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */ #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id) #define RKISP1_CIF_MI_MBLK_LINE BIT(2) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c index c1aaeed58acc..6d6ebc53c6e5 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c @@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz, { u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL); - if (when == RKISP1_SHADOW_REGS_ASYNC) - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; - else - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; + if (when == RKISP1_SHADOW_REGS_ASYNC) { + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO; + else + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO; + } else { + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP)) + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD; + else + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD; + } rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg); }