1 From 2df16ebeea66a589195944bd2b501783c3cab60f Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 15 Jun 2021 18:56:33 +0100
4 Subject: [PATCH] media: i2c: imx258: Make V4L2_CID_VBLANK
7 The values and ranges of V4L2_CID_VBLANK are all computed,
8 so there is no reason for it to be a read only control.
9 Remove the register values from the mode lists, add the
10 handler, and remove the read only flag.
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 drivers/media/i2c/imx258.c | 16 +++++++---------
15 1 file changed, 7 insertions(+), 9 deletions(-)
17 --- a/drivers/media/i2c/imx258.c
18 +++ b/drivers/media/i2c/imx258.c
20 #define IMX258_VTS_30FPS_VGA 0x034c
21 #define IMX258_VTS_MAX 0xffff
23 +#define IMX258_REG_VTS 0x0340
25 /* HBLANK control - read only */
26 #define IMX258_PPL_DEFAULT 5352
28 @@ -203,8 +205,6 @@ static const struct imx258_reg mode_4208
37 @@ -320,8 +320,6 @@ static const struct imx258_reg mode_2104
46 @@ -437,8 +435,6 @@ static const struct imx258_reg mode_1048
55 @@ -831,6 +827,11 @@ static int imx258_set_ctrl(struct v4l2_c
56 BIT(IMX258_HDR_RATIO_MAX));
59 + case V4L2_CID_VBLANK:
60 + ret = imx258_write_reg(imx258, IMX258_REG_VTS,
61 + IMX258_REG_VALUE_16BIT,
62 + imx258->cur_mode->height + ctrl->val);
66 ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
67 @@ -1233,9 +1234,6 @@ static int imx258_init_controls(struct i
68 IMX258_VTS_MAX - imx258->cur_mode->height, 1,
72 - imx258->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
74 imx258->hblank = v4l2_ctrl_new_std(
75 ctrl_hdlr, &imx258_ctrl_ops, V4L2_CID_HBLANK,
76 IMX258_PPL_DEFAULT - imx258->cur_mode->width,