bcm27xx: update 6.1 patches to latest version
[openwrt/staging/svanheule.git] / target / linux / bcm27xx / patches-6.1 / 950-1065-drivers-media-imx477-Add-V4L2_CID_LINK_FREQ-control.patch
1 From c9a785d57c302d5f1d4de4e67fa57522e66c7882 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Mon, 6 Nov 2023 09:40:50 +0000
4 Subject: [PATCH] drivers: media: imx477: Add V4L2_CID_LINK_FREQ control
5
6 Add V4L2_CID_LINK_FREQ as a read-only control with a value of 450 Mhz.
7 This will be used by the CFE driver to corretly setup the DPHY timing
8 parameters in the CSI-2 block.
9
10 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
11 ---
12 drivers/media/i2c/imx477.c | 14 ++++++++++++++
13 1 file changed, 14 insertions(+)
14
15 --- a/drivers/media/i2c/imx477.c
16 +++ b/drivers/media/i2c/imx477.c
17 @@ -164,6 +164,10 @@ struct imx477_mode {
18 struct imx477_reg_list reg_list;
19 };
20
21 +static const s64 imx477_link_freq_menu[] = {
22 + IMX477_DEFAULT_LINK_FREQ,
23 +};
24 +
25 static const struct imx477_reg mode_common_regs[] = {
26 {0x0136, 0x18},
27 {0x0137, 0x00},
28 @@ -1110,6 +1114,7 @@ struct imx477 {
29 struct v4l2_ctrl_handler ctrl_handler;
30 /* V4L2 Controls */
31 struct v4l2_ctrl *pixel_rate;
32 + struct v4l2_ctrl *link_freq;
33 struct v4l2_ctrl *exposure;
34 struct v4l2_ctrl *vflip;
35 struct v4l2_ctrl *hflip;
36 @@ -1997,6 +2002,15 @@ static int imx477_init_controls(struct i
37 IMX477_PIXEL_RATE, 1,
38 IMX477_PIXEL_RATE);
39
40 + /* LINK_FREQ is also read only */
41 + imx477->link_freq =
42 + v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx477_ctrl_ops,
43 + V4L2_CID_LINK_FREQ,
44 + ARRAY_SIZE(imx477_link_freq_menu) - 1, 0,
45 + imx477_link_freq_menu);
46 + if (imx477->link_freq)
47 + imx477->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
48 +
49 /*
50 * Create the controls here, but mode specific limits are setup
51 * in the imx477_set_framing_limits() call below.