bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0825-media-i2c-imx258-Set-pixel_rate-range-to-the-same-as.patch
1 From 3d314e1c554ea4cc64dcdd5e227767a518b7dcb2 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 1 Apr 2022 18:54:12 +0100
4 Subject: [PATCH] media: i2c: imx258: Set pixel_rate range to the same
5 as the value
6
7 With a read only control there is limited point in advertising
8 a minimum and maximum for the control, so change to set the
9 value, min, and max all to the selected pixel rate.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/media/i2c/imx258.c | 18 +++++++-----------
14 1 file changed, 7 insertions(+), 11 deletions(-)
15
16 --- a/drivers/media/i2c/imx258.c
17 +++ b/drivers/media/i2c/imx258.c
18 @@ -1237,7 +1237,8 @@ static int imx258_set_pad_format(struct
19
20 link_freq = imx258->link_freq_menu_items[mode->link_freq_index];
21 pixel_rate = link_freq_to_pixel_rate(link_freq, imx258->nlanes);
22 - __v4l2_ctrl_s_ctrl_int64(imx258->pixel_rate, pixel_rate);
23 + __v4l2_ctrl_modify_range(imx258->pixel_rate, pixel_rate,
24 + pixel_rate, 1, pixel_rate);
25 /* Update limits and set FPS to default */
26 vblank_def = imx258->cur_mode->vts_def -
27 imx258->cur_mode->height;
28 @@ -1546,8 +1547,7 @@ static int imx258_init_controls(struct i
29 struct v4l2_ctrl_handler *ctrl_hdlr;
30 s64 vblank_def;
31 s64 vblank_min;
32 - s64 pixel_rate_min;
33 - s64 pixel_rate_max;
34 + s64 pixel_rate;
35 int ret;
36
37 ctrl_hdlr = &imx258->ctrl_handler;
38 @@ -1567,17 +1567,13 @@ static int imx258_init_controls(struct i
39 if (imx258->link_freq)
40 imx258->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
41
42 - pixel_rate_max =
43 - link_freq_to_pixel_rate(imx258->link_freq_menu_items[0],
44 - imx258->nlanes);
45 - pixel_rate_min =
46 - link_freq_to_pixel_rate(imx258->link_freq_menu_items[1],
47 - imx258->nlanes);
48 + pixel_rate = link_freq_to_pixel_rate(imx258->link_freq_menu_items[0],
49 + imx258->nlanes);
50 /* By default, PIXEL_RATE is read only */
51 imx258->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx258_ctrl_ops,
52 V4L2_CID_PIXEL_RATE,
53 - pixel_rate_min, pixel_rate_max,
54 - 1, pixel_rate_max);
55 + pixel_rate, pixel_rate,
56 + 1, pixel_rate);
57
58
59 vblank_def = imx258->cur_mode->vts_def - imx258->cur_mode->height;