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@xxxxxxxxxxxxxxxx> --- 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