[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211175023.1680247-7-mike.rudenko@gmail.com>
Date: Mon, 11 Dec 2023 20:50:09 +0300
From: Mikhail Rudenko <mike.rudenko@...il.com>
To: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Jacopo Mondi <jacopo@...ndi.org>,
Tommaso Merciai <tommaso.merciai@...rulasolutions.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Mikhail Rudenko <mike.rudenko@...il.com>
Subject: [PATCH 06/19] media: i2c: ov4689: Set gain in one 16 bit write
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@...il.com>
---
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,
--
2.43.0
Powered by blists - more mailing lists