1 From 1fbe6c846412c7c114f599fef881366f1e81ef9c Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Sat, 12 Feb 2022 09:47:38 +0000
4 Subject: [PATCH] media: i2c: ov7251: V4L2_CID_PIXEL_RATE is fixed
6 The pixel rate doesn't actually change based on the mode, and
7 can not be set by userspace.
9 Fix the control. The control is already read only as set by the core.
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 drivers/media/i2c/ov7251.c | 24 +++++-------------------
14 1 file changed, 5 insertions(+), 19 deletions(-)
16 --- a/drivers/media/i2c/ov7251.c
17 +++ b/drivers/media/i2c/ov7251.c
19 #define OV7251_PLL2_SYS_DIV_REG 0x309a
20 #define OV7251_PLL2_ADC_DIV_REG 0x309b
22 +#define OV7251_PIXEL_CLOCK 48000000
27 @@ -64,7 +66,6 @@ struct ov7251_mode_info {
29 const struct reg_value *data;
35 @@ -112,7 +113,6 @@ struct ov7251 {
36 const struct ov7251_mode_info *current_mode;
38 struct v4l2_ctrl_handler ctrls;
39 - struct v4l2_ctrl *pixel_clock;
40 struct v4l2_ctrl *link_freq;
41 struct v4l2_ctrl *exposure;
42 struct v4l2_ctrl *gain;
43 @@ -591,7 +591,6 @@ static const struct ov7251_mode_info ov7
45 .data = ov7251_setting_vga_30fps,
46 .data_size = ARRAY_SIZE(ov7251_setting_vga_30fps),
47 - .pixel_clock = 48000000,
48 .link_freq = 0, /* an index in link_freq[] */
51 @@ -605,7 +604,6 @@ static const struct ov7251_mode_info ov7
53 .data = ov7251_setting_vga_60fps,
54 .data_size = ARRAY_SIZE(ov7251_setting_vga_60fps),
55 - .pixel_clock = 48000000,
56 .link_freq = 0, /* an index in link_freq[] */
59 @@ -619,7 +617,6 @@ static const struct ov7251_mode_info ov7
61 .data = ov7251_setting_vga_90fps,
62 .data_size = ARRAY_SIZE(ov7251_setting_vga_90fps),
63 - .pixel_clock = 48000000,
64 .link_freq = 0, /* an index in link_freq[] */
67 @@ -1155,11 +1152,6 @@ static int ov7251_set_format(struct v4l2
68 __crop->height = new_mode->height;
70 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
71 - ret = __v4l2_ctrl_s_ctrl_int64(ov7251->pixel_clock,
72 - new_mode->pixel_clock);
76 ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
79 @@ -1319,11 +1311,6 @@ static int ov7251_set_frame_interval(str
80 new_mode = ov7251_find_mode_by_ival(ov7251, &fi->interval);
82 if (new_mode != ov7251->current_mode) {
83 - ret = __v4l2_ctrl_s_ctrl_int64(ov7251->pixel_clock,
84 - new_mode->pixel_clock);
88 ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
91 @@ -1571,10 +1558,9 @@ static int ov7251_probe(struct i2c_clien
92 V4L2_CID_TEST_PATTERN,
93 ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
94 0, 0, ov7251_test_pattern_menu);
95 - ov7251->pixel_clock = v4l2_ctrl_new_std(&ov7251->ctrls,
97 - V4L2_CID_PIXEL_RATE,
99 + v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
100 + V4L2_CID_PIXEL_RATE, OV7251_PIXEL_CLOCK,
101 + OV7251_PIXEL_CLOCK, 1, OV7251_PIXEL_CLOCK);
102 ov7251->link_freq = v4l2_ctrl_new_int_menu(&ov7251->ctrls,