diff --git a/drivers/media/platform/rockchip/cif/cif-capture.c b/drivers/media/platform/rockchip/cif/cif-capture.c
index c80a52028a21..b26e6023c2b0 100644
--- a/drivers/media/platform/rockchip/cif/cif-capture.c
+++ b/drivers/media/platform/rockchip/cif/cif-capture.c
@@ -109,154 +109,10 @@ static struct cif_output_fmt out_fmts[] = {
 	}
 };
 
-static const struct cif_input_fmt in_fmts[] = {
-	{
-		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_YUYV,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_YUYV,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_INTERLACED,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_YVYU8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_YVYU,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_YVYU8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_YVYU,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_INTERLACED,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_UYVY8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_UYVY,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_UYVY8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_UYVY,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_INTERLACED,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_VYUY8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_VYUY,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_VYUY8_2X8,
-		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
-				  CIF_FORMAT_YUV_INPUT_ORDER_VYUY,
-		.fmt_type	= CIF_FMT_TYPE_YUV,
-		.field		= V4L2_FIELD_INTERLACED,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_8,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_8,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_8,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_8,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_10,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_10,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_10,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_10,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_12,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_12,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_12,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_12,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_RGB888_1X24,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_Y8_1X8,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_8,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_Y10_1X10,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_10,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}, {
-		.mbus_code	= MEDIA_BUS_FMT_Y12_1X12,
-		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
-				  CIF_FORMAT_RAW_DATA_WIDTH_12,
-		.fmt_type	= CIF_FMT_TYPE_RAW,
-		.field		= V4L2_FIELD_NONE,
-	}
-};
-
-static const struct
-cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd)
+static const struct cif_input_fmt *get_input_fmt(struct cif_device *cif_dev,
+						 struct v4l2_subdev *sd)
 {
+	const struct cif_input_fmt *in_fmts = cif_dev->match_data->in_fmts;
 	struct v4l2_subdev_format fmt;
 	u32 i;
 
@@ -264,7 +120,7 @@ cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd)
 	fmt.pad = 0;
 	v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt);
 
-	for (i = 0; i < ARRAY_SIZE(in_fmts); i++)
+	for (i = 0; i < cif_dev->match_data->in_fmts_num; i++)
 		if (fmt.format.code == in_fmts[i].mbus_code &&
 		    fmt.format.field == in_fmts[i].field)
 			return &in_fmts[i];
@@ -550,7 +406,7 @@ static int cif_start_streaming(struct vb2_queue *queue, unsigned int count)
 
 	sd = cif_dev->remote.sd;
 
-	stream->cif_fmt_in = get_input_fmt(cif_dev->remote.sd);
+	stream->cif_fmt_in = get_input_fmt(cif_dev, sd);
 	if (!stream->cif_fmt_in)
 		goto runtime_put;
 
diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h
index ae8fedeadd1c..84a7545422e1 100644
--- a/drivers/media/platform/rockchip/cif/cif-common.h
+++ b/drivers/media/platform/rockchip/cif/cif-common.h
@@ -97,6 +97,8 @@ static inline struct cif_stream *to_cif_stream(struct video_device *vdev)
 struct cif_match_data {
 	struct clk_bulk_data *clks;
 	int clks_num;
+	const struct cif_input_fmt *in_fmts;
+	int in_fmts_num;
 	void (*grf_dvp_setup)(struct cif_device *cif_dev);
 };
 
diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c
index b75b76508793..fb80e8f8dcab 100644
--- a/drivers/media/platform/rockchip/cif/cif-dev.c
+++ b/drivers/media/platform/rockchip/cif/cif-dev.c
@@ -132,9 +132,156 @@ static struct clk_bulk_data px30_cif_clks[] = {
 	{ .id = "pclk", },
 };
 
+static const struct cif_input_fmt px30_in_fmts[] = {
+	{
+		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_YUYV,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_YUYV,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_INTERLACED,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_YVYU8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_YVYU,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_YVYU8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_YVYU,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_INTERLACED,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_UYVY8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_UYVY,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_UYVY8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_UYVY,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_INTERLACED,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_VYUY8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_VYUY,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_VYUY8_2X8,
+		.dvp_fmt_val	= CIF_FORMAT_YUV_INPUT_422 |
+				  CIF_FORMAT_YUV_INPUT_ORDER_VYUY,
+		.fmt_type	= CIF_FMT_TYPE_YUV,
+		.field		= V4L2_FIELD_INTERLACED,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_8,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_8,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_8,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_8,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_10,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_10,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_10,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_10,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_12,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_12,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_12,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_12,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_RGB888_1X24,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_Y8_1X8,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_8,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_Y10_1X10,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_10,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}, {
+		.mbus_code	= MEDIA_BUS_FMT_Y12_1X12,
+		.dvp_fmt_val	= CIF_FORMAT_INPUT_MODE_RAW |
+				  CIF_FORMAT_RAW_DATA_WIDTH_12,
+		.fmt_type	= CIF_FMT_TYPE_RAW,
+		.field		= V4L2_FIELD_NONE,
+	}
+};
+
 static const struct cif_match_data px30_cif_match_data = {
 	.clks = px30_cif_clks,
 	.clks_num = ARRAY_SIZE(px30_cif_clks),
+	.in_fmts = px30_in_fmts,
+	.in_fmts_num = ARRAY_SIZE(px30_in_fmts),
 };
 
 static const struct of_device_id cif_plat_of_match[] = {
