1 From a0b461a669b2e106a8b22dc3e9bd1666128d69a4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 14 Apr 2020 15:51:50 +0100
4 Subject: [PATCH] media: i2c: ov9281: add enum_frame_interval function
5 for iq tool 2.2 and hal3
7 Adds the ov9281 parts of the Rockchip patch adding enum_frame_interval to
8 a large number of drivers.
10 Change-Id: I03344cd6cf278dd7c18fce8e97479089ef185a5c
11 Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
13 drivers/media/i2c/ov9281.c | 31 ++++++++++++++++++++++++++-----
14 1 file changed, 26 insertions(+), 5 deletions(-)
16 --- a/drivers/media/i2c/ov9281.c
17 +++ b/drivers/media/i2c/ov9281.c
20 * Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd.
21 * V0.0X01.0X02 fix mclk issue when probe multiple camera.
22 + * V0.0X01.0X03 add enum_frame_interval function.
25 #include <linux/clk.h>
27 #include <media/v4l2-subdev.h>
28 #include <linux/pinctrl/consumer.h>
30 -#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x2)
31 +#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x3)
33 #ifndef V4L2_CID_DIGITAL_GAIN
34 #define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN
35 @@ -92,7 +93,7 @@ struct regval {
40 + struct v4l2_fract max_fps;
44 @@ -246,7 +247,10 @@ static const struct ov9281_mode supporte
51 + .denominator = 1200000,
54 .hts_def = 0x0b60,//0x2d8*4
56 @@ -483,8 +487,7 @@ static int OV9281_g_frame_interval(struc
57 const struct ov9281_mode *mode = ov9281->cur_mode;
59 mutex_lock(&ov9281->mutex);
60 - fi->interval.numerator = 10000;
61 - fi->interval.denominator = mode->max_fps * 10000;
62 + fi->interval = mode->max_fps;
63 mutex_unlock(&ov9281->mutex);
66 @@ -778,6 +781,23 @@ static int ov9281_open(struct v4l2_subde
71 +ov9281_enum_frame_interval(struct v4l2_subdev *sd,
72 + struct v4l2_subdev_pad_config *cfg,
73 + struct v4l2_subdev_frame_interval_enum *fie)
75 + if (fie->index >= ARRAY_SIZE(supported_modes))
78 + if (fie->code != MEDIA_BUS_FMT_Y10_1X10)
81 + fie->width = supported_modes[fie->index].width;
82 + fie->height = supported_modes[fie->index].height;
83 + fie->interval = supported_modes[fie->index].max_fps;
87 static const struct dev_pm_ops ov9281_pm_ops = {
88 SET_RUNTIME_PM_OPS(ov9281_runtime_suspend,
89 ov9281_runtime_resume, NULL)
90 @@ -805,6 +825,7 @@ static const struct v4l2_subdev_video_op
91 static const struct v4l2_subdev_pad_ops ov9281_pad_ops = {
92 .enum_mbus_code = ov9281_enum_mbus_code,
93 .enum_frame_size = ov9281_enum_frame_sizes,
94 + .enum_frame_interval = ov9281_enum_frame_interval,
95 .get_fmt = ov9281_get_fmt,
96 .set_fmt = ov9281_set_fmt,