media: i2c: gc5035 fix vb & gain set issues

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: I7cf1e61c574a4d31ee06da9d8eea7b6dbd32ae50
This commit is contained in:
Wang Panzhenzhuan
2020-10-21 10:15:52 +08:00
committed by Tao Huang
parent b252096154
commit f5767ec5fa

View File

@@ -8,6 +8,7 @@
* TODO: add OTP function.
* V0.0X01.0X02 fix mclk issue when probe multiple camera.
* V0.0X01.0X03 add enum_frame_interval function.
* V0.0X01.0X04 fix vb and gain set issues.
*/
#include <linux/clk.h>
@@ -32,7 +33,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/slab.h>
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x03)
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x04)
#ifndef V4L2_CID_DIGITAL_GAIN
#define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN
@@ -1031,7 +1032,7 @@ static int gc5035_set_exposure_reg(struct gc5035 *gc5035, u32 exposure)
caltime = exposure / 2;
caltime = caltime * 2;
gc5035->Dgain_ratio = 256 * exposure / caltime;
gc5035->Dgain_ratio = 64 * exposure / caltime;
ret = gc5035_write_reg(gc5035->client,
GC5035_REG_SET_PAGE,
GC5035_SET_PAGE_ONE);
@@ -1133,16 +1134,15 @@ static int gc5035_set_ctrl(struct v4l2_ctrl *ctrl)
ret = gc5035_set_gain_reg(gc5035, ctrl->val);
break;
case V4L2_CID_VBLANK:
ctrl->val = ctrl->val + gc5035->cur_mode->height;
ret = gc5035_write_reg(gc5035->client,
GC5035_REG_SET_PAGE,
GC5035_SET_PAGE_ONE);
ret |= gc5035_write_reg(gc5035->client,
GC5035_REG_VTS_H,
((ctrl->val) >> 8) & 0xff);
((ctrl->val + gc5035->cur_mode->height) >> 8) & 0xff);
ret |= gc5035_write_reg(gc5035->client,
GC5035_REG_VTS_L,
(ctrl->val) & 0xff);
(ctrl->val + gc5035->cur_mode->height) & 0xff);
break;
case V4L2_CID_TEST_PATTERN:
ret = gc5035_set_test_pattern(gc5035, ctrl->val);