Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4444643rdh; Wed, 29 Nov 2023 01:30:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZAMJldwxOmXR1Ybw5K5rXpS/fri6zOJ6ZviO3czhyoN2HZKR3dALa64oG46sFRuk0EdNw X-Received: by 2002:a05:6358:2928:b0:16e:58:908c with SMTP id y40-20020a056358292800b0016e0058908cmr17011668rwb.27.1701250203981; Wed, 29 Nov 2023 01:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701250203; cv=none; d=google.com; s=arc-20160816; b=B5yev5cbVfRmBpgjZwCW3eBqOlzsVLZrGFefJPdUWFYaztPLguHBedTbC2eFFtztga NTGkDwUt5Hn6U2cPX0aDabAfiukyRs4SQIl8KCqUCkB4LFNKJ+EOZCZerqEZQBfNf0R4 /RmyKXS/eYybAhnqGbWsaVA8h7ro93kitfFVIkGSVkeTRfNUOfQFLEBexLPHBIUCYeyz ncK+6M6awuK/aQ35if27gnbxV27PfUgufw6vjvFFEFj2lNb5d64PV78C5cYxdP2/J0xn PfMROi0qVtrDIKMxym/7ALxhRpB3lUYOzSLyaLDPqATLYiHrFTgn0ZdDK/jkZX8kJzK8 Ai/Q== 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=J0B4RFwipNrBdwo5iQYW2Qtv18L4Eerhnpqd4zf9JGo=; fh=9TGZi8GZBh0Z4pe+JUoyBc66OzVUR/Oowb7otIyZbDQ=; b=mVnQ0tJIg/pTgJchtjczwyESS2jr9iPSVuF3kl0z4OnmLd+Q649qQIZ8qn9dqTkkoV UE9YsrrzvDC8LhvCvWFf9QCfemeYRNSFkZlSBf8HL96G58bqz4b2HtWM7GjY9Og6dfAf S29MKNRKHEjqL9RYC5J85QFAjYInHDtRV4L9wqjBj1IJBaOYrtOziaGgAJ5osa484YvY ST70nyKLdeK93diKv4LBLsgvcz1zUDy1nqITa54GXu7KGAiRpT0fIGjKn64rY7b5ehdU BOikE7B3PJTkOf0X/wem0yoRIBMKV9dKLnh+FKSAXdphVscSFOTfCx4xq18lA23SDAAT wbZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=NmLm8C7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y17-20020a634b11000000b005c5e2ac7c3csi3963768pga.732.2023.11.29.01.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 01:30:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=NmLm8C7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id D720D804B2B6; Wed, 29 Nov 2023 01:29:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231414AbjK2J3Q (ORCPT + 99 others); Wed, 29 Nov 2023 04:29:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbjK2J2u (ORCPT ); Wed, 29 Nov 2023 04:28:50 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30CFB1BE3; Wed, 29 Nov 2023 01:28:38 -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 97B1F842; Wed, 29 Nov 2023 10:27:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701250081; bh=oErYFPD5fGFjTo0URqBvE0X1rwYJ+RVgatQIlqvftzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmLm8C7M99aUxA6zKHy5jY6mk6f6wB18be9n3OzDb3ipQecabuFKSAoNkeK2s8wiO 0VoPI7rXRtP++kioEKSHT+/DyY1oKeEaWVrwxGZFpj1p0KZ3BKVy0C+BCdChWrTDVb lspRj6+5VT8no0Xk8R7d7kLprzHA98N11iTwSuJ4= From: Paul Elder 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 , Laurent Pinchart , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 04/11] media: rkisp1: Support devices lacking dual crop Date: Wed, 29 Nov 2023 18:27:52 +0900 Message-Id: <20231129092759.242641-5-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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 29 Nov 2023 01:29:59 -0800 (PST) Some versions of the ISP supported by the rkisp1 driver, such as the ISP in the i.MX8MP, lack the dual crop registers and don't support cropping at the resizer input. They instead rely on cropping in the Image Stabilization module, at the output of the ISP, to modify the resizer input size and implement digital zoom. Support those ISP versions by addind a dual crop feature flag, and mapping the resizer input crop rectangle to either the resizer dual crop module or the image stabilization module. Signed-off-by: Laurent Pinchart Signed-off-by: Paul Elder --- drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 2 ++ drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 6 ++++-- drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h index e54cf14b72b1..20b6134f235a 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h @@ -104,6 +104,7 @@ enum rkisp1_isp_pad { * @RKISP1_FEATURE_MIPI_CSI2: The ISP has an internal MIPI CSI-2 receiver * @RKISP1_FEATURE_MAIN_STRIDE: The ISP supports configurable stride on the main path * @RKISP1_FEATURE_SELF_PATH: The ISP has a self path + * @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input * * The ISP features are stored in a bitmask in &rkisp1_info.features and allow * the driver to implement support for features present in some ISP versions @@ -113,6 +114,7 @@ enum rkisp1_feature { RKISP1_FEATURE_MIPI_CSI2 = BIT(0), RKISP1_FEATURE_MAIN_STRIDE = BIT(1), RKISP1_FEATURE_SELF_PATH = BIT(2), + RKISP1_FEATURE_DUAL_CROP = BIT(3), }; #define rkisp1_has_feature(rkisp1, feature) \ diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 7f5e2c6d1d73..a789a87ec644 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -476,7 +476,8 @@ static const struct rkisp1_info px30_isp_info = { .isr_size = ARRAY_SIZE(px30_isp_isrs), .isp_ver = RKISP1_V12, .features = RKISP1_FEATURE_MIPI_CSI2 - | RKISP1_FEATURE_SELF_PATH, + | RKISP1_FEATURE_SELF_PATH + | RKISP1_FEATURE_DUAL_CROP, }; static const char * const rk3399_isp_clks[] = { @@ -496,7 +497,8 @@ static const struct rkisp1_info rk3399_isp_info = { .isr_size = ARRAY_SIZE(rk3399_isp_isrs), .isp_ver = RKISP1_V10, .features = RKISP1_FEATURE_MIPI_CSI2 - | RKISP1_FEATURE_SELF_PATH, + | RKISP1_FEATURE_SELF_PATH + | RKISP1_FEATURE_DUAL_CROP, }; static const struct of_device_id rkisp1_of_match[] = { diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c index 12e735a8970f..c1aaeed58acc 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c @@ -641,7 +641,8 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable) struct v4l2_subdev_state *sd_state; if (!enable) { - rkisp1_dcrop_disable(rsz, RKISP1_SHADOW_REGS_ASYNC); + if (rkisp1_has_feature(rkisp1, DUAL_CROP)) + rkisp1_dcrop_disable(rsz, RKISP1_SHADOW_REGS_ASYNC); rkisp1_rsz_disable(rsz, RKISP1_SHADOW_REGS_ASYNC); return 0; } @@ -652,7 +653,8 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable) sd_state = v4l2_subdev_lock_and_get_active_state(sd); rkisp1_rsz_config(rsz, sd_state, when); - rkisp1_dcrop_config(rsz, sd_state); + if (rkisp1_has_feature(rkisp1, DUAL_CROP)) + rkisp1_dcrop_config(rsz, sd_state); v4l2_subdev_unlock_state(sd_state); -- 2.39.2