[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221118093931.1284465-12-paul.elder@ideasonboard.com>
Date: Fri, 18 Nov 2022 18:39:28 +0900
From: Paul Elder <paul.elder@...asonboard.com>
To: linux-media@...r.kernel.org
Cc: Paul Elder <paul.elder@...asonboard.com>,
Dafna Hirschfeld <dafna@...tmail.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Heiko Stuebner <heiko@...ech.de>,
Helen Koike <helen.koike@...labora.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
linux-rockchip@...ts.infradead.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3 11/14] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
The ISP that is integrated in the i.MX8MP supports cropping, which
results in a different RSZ_CTRL register layout compared to the RK3399.
Add new definitions for these bits, and use them when the
RKISP1_FEATURE_RSZ_CROP feature is set.
Signed-off-by: Paul Elder <paul.elder@...asonboard.com>
---
Changes since v2:
- Condition on RKISP1_FEATURE_RSZ_CROP feature
- Rename bits
- Use the rkisp1_has_feature() macro
---
drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++
.../media/platform/rockchip/rkisp1/rkisp1-resizer.c | 10 ++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
index 3dd1bfec288f..39b2ac58196e 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)
+
/* RSZ_CROP_[XY]_DIR */
#define RKISP1_CIF_RSZ_CROP_XY_DIR(start, end) ((end) << 16 | (start) << 0)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index cefc3cfb733c..7ff7b608fc3f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -209,9 +209,15 @@ 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;
+ if (rkisp1_has_feature(rsz->rkisp1, RSZ_CROP))
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO;
+ else
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
else
- ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
+ if (rkisp1_has_feature(rsz->rkisp1, RSZ_CROP))
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD;
+ else
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg);
}
--
2.35.1
Powered by blists - more mailing lists