#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
+/*
+ * Minimum values for the width and height of entities. The maximum values are
+ * model-specific and stored in the rkisp1_info structure.
+ */
 #define RKISP1_ISP_MIN_WIDTH                   32
 #define RKISP1_ISP_MIN_HEIGHT                  32
 
  * @isr_size: number of entries in the @isrs array
  * @isp_ver: ISP version
  * @features: bitmask of rkisp1_feature features implemented by the ISP
+ * @max_width: maximum input frame width
+ * @max_height: maximum input frame height
  *
  * This structure contains information about the ISP specific to a particular
  * ISP model, version, or integration in a particular SoC.
        unsigned int isr_size;
        enum rkisp1_cif_isp_version isp_ver;
        unsigned int features;
+       unsigned int max_width;
+       unsigned int max_height;
 };
 
 /*
 
                              struct v4l2_subdev_state *sd_state,
                              struct v4l2_subdev_format *fmt)
 {
+       struct rkisp1_csi *csi = to_rkisp1_csi(sd);
        const struct rkisp1_mbus_info *mbus_info;
        struct v4l2_mbus_framefmt *sink_fmt, *src_fmt;
 
 
        sink_fmt->width = clamp_t(u32, fmt->format.width,
                                  RKISP1_ISP_MIN_WIDTH,
-                                 RKISP1_ISP_MAX_WIDTH);
+                                 csi->rkisp1->info->max_width);
        sink_fmt->height = clamp_t(u32, fmt->format.height,
                                   RKISP1_ISP_MIN_HEIGHT,
-                                  RKISP1_ISP_MAX_HEIGHT);
+                                  csi->rkisp1->info->max_height);
 
        fmt->format = *sink_fmt;
 
 
        .features = RKISP1_FEATURE_MIPI_CSI2
                  | RKISP1_FEATURE_SELF_PATH
                  | RKISP1_FEATURE_DUAL_CROP,
+       .max_width = 3264,
+       .max_height = 2448,
 };
 
 static const char * const rk3399_isp_clks[] = {
        .features = RKISP1_FEATURE_MIPI_CSI2
                  | RKISP1_FEATURE_SELF_PATH
                  | RKISP1_FEATURE_DUAL_CROP,
+       .max_width = 4416,
+       .max_height = 3312,
 };
 
 static const char * const imx8mp_isp_clks[] = {
        .isp_ver = RKISP1_V_IMX8MP,
        .features = RKISP1_FEATURE_MAIN_STRIDE
                  | RKISP1_FEATURE_DMA_34BIT,
+       .max_width = 4096,
+       .max_height = 3072,
 };
 
 static const struct of_device_id rkisp1_of_match[] = {
 
                                      struct v4l2_subdev_state *sd_state,
                                      struct v4l2_subdev_frame_size_enum *fse)
 {
+       struct rkisp1_isp *isp = to_rkisp1_isp(sd);
        const struct rkisp1_mbus_info *mbus_info;
 
        if (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS ||
                return -EINVAL;
 
        fse->min_width = RKISP1_ISP_MIN_WIDTH;
-       fse->max_width = RKISP1_ISP_MAX_WIDTH;
+       fse->max_width = isp->rkisp1->info->max_width;
        fse->min_height = RKISP1_ISP_MIN_HEIGHT;
-       fse->max_height = RKISP1_ISP_MAX_HEIGHT;
+       fse->max_height = isp->rkisp1->info->max_height;
 
        return 0;
 }
 
        sink_fmt->width = clamp_t(u32, format->width,
                                  RKISP1_ISP_MIN_WIDTH,
-                                 RKISP1_ISP_MAX_WIDTH);
+                                 isp->rkisp1->info->max_width);
        sink_fmt->height = clamp_t(u32, format->height,
                                   RKISP1_ISP_MIN_HEIGHT,
-                                  RKISP1_ISP_MAX_HEIGHT);
+                                  isp->rkisp1->info->max_height);
 
        /*
         * Adjust the color space fields. Accept any color primaries and
 
 
        sink_fmt->width = clamp_t(u32, format->width,
                                  RKISP1_ISP_MIN_WIDTH,
-                                 RKISP1_ISP_MAX_WIDTH);
+                                 rsz->rkisp1->info->max_width);
        sink_fmt->height = clamp_t(u32, format->height,
                                   RKISP1_ISP_MIN_HEIGHT,
-                                  RKISP1_ISP_MAX_HEIGHT);
+                                  rsz->rkisp1->info->max_height);
 
        /*
         * Adjust the color space fields. Accept any color primaries and