1 From f8c8c6aed54e064f3ec36eeee0595ec4e2206d66 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Sat, 12 Feb 2022 09:53:47 +0000
4 Subject: [PATCH] media: i2c: ov7251: V4L2_CID_LINK_FREQUENCY is fixed
6 The link frequency does not change with the mode, so remove
7 the special handling for it.
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 drivers/media/i2c/ov7251.c | 29 +++++++----------------------
12 1 file changed, 7 insertions(+), 22 deletions(-)
14 --- a/drivers/media/i2c/ov7251.c
15 +++ b/drivers/media/i2c/ov7251.c
16 @@ -66,7 +66,6 @@ struct ov7251_mode_info {
18 const struct reg_value *data;
23 struct v4l2_fract timeperframe;
24 @@ -113,7 +112,6 @@ struct ov7251 {
25 const struct ov7251_mode_info *current_mode;
27 struct v4l2_ctrl_handler ctrls;
28 - struct v4l2_ctrl *link_freq;
29 struct v4l2_ctrl *exposure;
30 struct v4l2_ctrl *gain;
32 @@ -591,7 +589,6 @@ static const struct ov7251_mode_info ov7
34 .data = ov7251_setting_vga_30fps,
35 .data_size = ARRAY_SIZE(ov7251_setting_vga_30fps),
36 - .link_freq = 0, /* an index in link_freq[] */
40 @@ -604,7 +601,6 @@ static const struct ov7251_mode_info ov7
42 .data = ov7251_setting_vga_60fps,
43 .data_size = ARRAY_SIZE(ov7251_setting_vga_60fps),
44 - .link_freq = 0, /* an index in link_freq[] */
48 @@ -617,7 +613,6 @@ static const struct ov7251_mode_info ov7
50 .data = ov7251_setting_vga_90fps,
51 .data_size = ARRAY_SIZE(ov7251_setting_vga_90fps),
52 - .link_freq = 0, /* an index in link_freq[] */
56 @@ -1152,11 +1147,6 @@ static int ov7251_set_format(struct v4l2
57 __crop->height = new_mode->height;
59 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
60 - ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
61 - new_mode->link_freq);
65 ret = __v4l2_ctrl_modify_range(ov7251->exposure,
66 1, new_mode->exposure_max,
67 1, new_mode->exposure_def);
68 @@ -1311,11 +1301,6 @@ static int ov7251_set_frame_interval(str
69 new_mode = ov7251_find_mode_by_ival(ov7251, &fi->interval);
71 if (new_mode != ov7251->current_mode) {
72 - ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
73 - new_mode->link_freq);
77 ret = __v4l2_ctrl_modify_range(ov7251->exposure,
78 1, new_mode->exposure_max,
79 1, new_mode->exposure_def);
80 @@ -1464,6 +1449,7 @@ static int ov7251_probe(struct i2c_clien
82 struct v4l2_fwnode_device_properties props;
83 struct device *dev = &client->dev;
84 + struct v4l2_ctrl *ctrl;
85 struct ov7251 *ov7251;
86 unsigned int rate = 0;
88 @@ -1561,13 +1547,12 @@ static int ov7251_probe(struct i2c_clien
89 v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
90 V4L2_CID_PIXEL_RATE, OV7251_PIXEL_CLOCK,
91 OV7251_PIXEL_CLOCK, 1, OV7251_PIXEL_CLOCK);
92 - ov7251->link_freq = v4l2_ctrl_new_int_menu(&ov7251->ctrls,
95 - ARRAY_SIZE(link_freq) - 1,
97 - if (ov7251->link_freq)
98 - ov7251->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
99 + ctrl = v4l2_ctrl_new_int_menu(&ov7251->ctrls, &ov7251_ctrl_ops,
100 + V4L2_CID_LINK_FREQ,
101 + ARRAY_SIZE(link_freq) - 1,
104 + ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
106 ov7251->sd.ctrl_handler = &ov7251->ctrls;