diff options
author | Jacob Chen <jacob2.chen@rock-chips.com> | 2018-01-10 12:44:02 +0800 |
---|---|---|
committer | Jacob Chen <jacob2.chen@rock-chips.com> | 2018-01-11 14:30:48 +0800 |
commit | fbe1b71c32afd319a481e627d185405356984bf7 (patch) | |
tree | b941933dbe9771a542ac80374985f35191d4c331 /drivers/media/i2c/imx219.c | |
parent | e9b2399061a941109da39ec6d80a9d746b7525b3 (diff) |
media: i2c: imx219: apply gain/exposure immediately
or it's too slow for AEC algorithm
Change-Id: I646a31b026a1e753e8bee681d088c7b2944ed147
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Diffstat (limited to 'drivers/media/i2c/imx219.c')
-rw-r--r-- | drivers/media/i2c/imx219.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 85fda3ff90f1..59e68086187c 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -338,23 +338,6 @@ static int imx219_s_stream(struct v4l2_subdev *sd, int enable) if (ret) return ret; - /* Handle analogue gain */ - ret = reg_write(client, 0x0157, priv->analogue_gain); - if (ret) - return ret; - - /* Handle digital gain */ - ret = reg_write(client, 0x0158, priv->digital_gain >> 8); - ret |= reg_write(client, 0x0159, priv->digital_gain & 0xff); - if (ret) - return ret; - - /* Handle exposure time */ - ret = reg_write(client, 0x015a, priv->exposure_time >> 8); - ret |= reg_write(client, 0x015b, priv->exposure_time & 0xff); - if (ret) - return ret; - /* Handle test pattern */ if (priv->test_pattern) { ret = reg_write(client, 0x0600, priv->test_pattern >> 8); @@ -493,6 +476,7 @@ static int imx219_s_ctrl(struct v4l2_ctrl *ctrl) container_of(ctrl->handler, struct imx219, ctrl_handler); struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev); u8 reg; + int ret; switch (ctrl->id) { case V4L2_CID_HFLIP: @@ -511,7 +495,9 @@ static int imx219_s_ctrl(struct v4l2_ctrl *ctrl) */ priv->analogue_gain = 256 - ((256 * IMX219_ANALOGUE_GAIN_MULTIPLIER) / ctrl->val); - break; + ret = reg_write(client, 0x0157, priv->analogue_gain); + + return ret; case V4L2_CID_GAIN: /* * Register value goes from 256 to 4095, and the digital gain @@ -519,10 +505,16 @@ static int imx219_s_ctrl(struct v4l2_ctrl *ctrl) * to 24dB. */ priv->digital_gain = ctrl->val; - break; + ret = reg_write(client, 0x0158, priv->digital_gain >> 8); + ret |= reg_write(client, 0x0159, priv->digital_gain & 0xff); + + return ret; case V4L2_CID_EXPOSURE: priv->exposure_time = ctrl->val; - break; + ret = reg_write(client, 0x015a, priv->exposure_time >> 8); + ret |= reg_write(client, 0x015b, priv->exposure_time & 0xff); + + return ret; case V4L2_CID_TEST_PATTERN: return imx219_s_ctrl_test_pattern(ctrl); default: |