Re: [PATCH 06/19] media: i2c: ov4689: Set gain in one 16 bit write

From: Laurent Pinchart
Date: Mon Dec 11 2023 - 13:11:51 EST


On Mon, Dec 11, 2023 at 08:50:09PM +0300, Mikhail Rudenko wrote:
> According to the datasheet, bits 0-7 of the AEC LONG GAIN
> register (0x3508) map to bits 8-15 of the gain value and no masking is
> required. Thus set analogue gain in a single 16-bit write instead of
> two 8-bit writes.
>
> Signed-off-by: Mikhail Rudenko <mike.rudenko@xxxxxxxxx>

You could squash it with patch 03/19.

Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> ---
> drivers/media/i2c/ov4689.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c
> index 42700ecfbe0e..5392f650960c 100644
> --- a/drivers/media/i2c/ov4689.c
> +++ b/drivers/media/i2c/ov4689.c
> @@ -32,11 +32,7 @@
> #define OV4689_EXPOSURE_STEP 1
> #define OV4689_VTS_MAX 0x7fff
>
> -#define OV4689_REG_GAIN_H CCI_REG8(0x3508)
> -#define OV4689_REG_GAIN_L CCI_REG8(0x3509)
> -#define OV4689_GAIN_H_MASK 0x07
> -#define OV4689_GAIN_H_SHIFT 8
> -#define OV4689_GAIN_L_MASK 0xff
> +#define OV4689_REG_GAIN CCI_REG16(0x3508)
> #define OV4689_GAIN_STEP 1
> #define OV4689_GAIN_DEFAULT 0x80
>
> @@ -613,14 +609,7 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
> break;
> case V4L2_CID_ANALOGUE_GAIN:
> ret = ov4689_map_gain(ov4689, val, &sensor_gain);
> -
> - cci_write(regmap, OV4689_REG_GAIN_H,
> - (sensor_gain >> OV4689_GAIN_H_SHIFT) &
> - OV4689_GAIN_H_MASK, &ret);
> -
> - cci_write(regmap, OV4689_REG_GAIN_L,
> - sensor_gain & OV4689_GAIN_L_MASK,
> - &ret);
> + cci_write(regmap, OV4689_REG_GAIN, sensor_gain, &ret);
> break;
> case V4L2_CID_VBLANK:
> cci_write(regmap, OV4689_REG_VTS,

--
Regards,

Laurent Pinchart