df353ffc31cf2f3fbff8e92f14855f82c71f0378
[openwrt/staging/jow.git] /
1 From 5e339e1502c9be0f624398cf774e5880a6d1a677 Mon Sep 17 00:00:00 2001
2 From: Lee Jackson <lee.jackson@arducam.com>
3 Date: Wed, 10 Jan 2024 09:06:16 +0800
4 Subject: [PATCH] drivers: media: arducam_64mp: Add V4L2_CID_LINK_FREQ control
5
6 Add V4L2_CID_LINK_FREQ as a read-only control with a value of 456 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: Lee Jackson <lee.jackson@arducam.com>
11 ---
12 drivers/media/i2c/arducam_64mp.c | 16 ++++++++++++++++
13 1 file changed, 16 insertions(+)
14
15 --- a/drivers/media/i2c/arducam_64mp.c
16 +++ b/drivers/media/i2c/arducam_64mp.c
17 @@ -143,6 +143,10 @@ struct arducam_64mp_mode {
18 struct arducam_64mp_reg_list reg_list;
19 };
20
21 +static const s64 arducam_64mp_link_freq_menu[] = {
22 + ARDUCAM_64MP_DEFAULT_LINK_FREQ,
23 +};
24 +
25 static const struct arducam_64mp_reg mode_common_regs[] = {
26 {0x0100, 0x00},
27 {0x0136, 0x18},
28 @@ -2272,9 +2276,11 @@ static int arducam_64mp_init_controls(st
29 struct v4l2_ctrl_handler *ctrl_hdlr;
30 struct i2c_client *client = v4l2_get_subdevdata(&arducam_64mp->sd);
31 struct v4l2_fwnode_device_properties props;
32 + struct v4l2_ctrl *link_freq;
33 unsigned int i;
34 int ret;
35 u8 test_pattern_max;
36 + u8 link_freq_max;
37
38 ctrl_hdlr = &arducam_64mp->ctrl_handler;
39 ret = v4l2_ctrl_handler_init(ctrl_hdlr, 16);
40 @@ -2292,6 +2298,16 @@ static int arducam_64mp_init_controls(st
41 ARDUCAM_64MP_PIXEL_RATE, 1,
42 ARDUCAM_64MP_PIXEL_RATE);
43
44 + /* LINK_FREQ is also read only */
45 + link_freq_max = ARRAY_SIZE(arducam_64mp_link_freq_menu) - 1;
46 + link_freq =
47 + v4l2_ctrl_new_int_menu(ctrl_hdlr, &arducam_64mp_ctrl_ops,
48 + V4L2_CID_LINK_FREQ,
49 + link_freq_max, 0,
50 + arducam_64mp_link_freq_menu);
51 + if (link_freq)
52 + link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
53 +
54 /*
55 * Create the controls here, but mode specific limits are setup
56 * in the arducam_64mp_set_framing_limits() call below.