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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>
---
 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





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux