@@ -29,11 +29,19 @@
#define RKISP1_ISP_SD_SRC BIT(0)
#define RKISP1_ISP_SD_SINK BIT(1)
-/* min and max values for the widths and heights of the entities */
-#define RKISP1_ISP_MAX_WIDTH 4032
-#define RKISP1_ISP_MAX_HEIGHT 3024
-#define RKISP1_ISP_MIN_WIDTH 32
-#define RKISP1_ISP_MIN_HEIGHT 32
+/*
+ * min and max values for the widths and heights of the entities
+ * The ISP device accepts input resolutions of up to 4416x3312, but
+ * it can only process resolutions of 4032x3024 internally.
+ * Therefore the crop resolution is limited to 4032x3024, the
+ * sink pad crop is applied automatically when the format is set.
+ */
+#define RKISP1_ISP_MAX_WIDTH 4416
+#define RKISP1_ISP_MAX_HEIGHT 3312
+#define RKISP1_ISP_MAX_WIDTH_CROP 4032
+#define RKISP1_ISP_MAX_HEIGHT_CROP 3024
+#define RKISP1_ISP_MIN_WIDTH 32
+#define RKISP1_ISP_MIN_HEIGHT 32
#define RKISP1_RSZ_MP_SRC_MAX_WIDTH 4416
#define RKISP1_RSZ_MP_SRC_MAX_HEIGHT 3312
@@ -758,9 +758,13 @@ static void rkisp1_isp_set_sink_crop(struct rkisp1_isp *isp,
which);
sink_crop->left = ALIGN(r->left, 2);
- sink_crop->width = ALIGN(r->width, 2);
+ sink_crop->width = clamp_t(u32, ALIGN(r->width, 2),
+ RKISP1_ISP_MIN_WIDTH,
+ RKISP1_ISP_MAX_WIDTH_CROP);
sink_crop->top = r->top;
- sink_crop->height = r->height;
+ sink_crop->height = clamp_t(u32, r->height,
+ RKISP1_ISP_MIN_HEIGHT,
+ RKISP1_ISP_MAX_HEIGHT_CROP);
rkisp1_sd_adjust_crop(sink_crop, sink_fmt);
*r = *sink_crop;