Commit d1e90c25 authored by Mikhail Rudenko's avatar Mikhail Rudenko Committed by Mauro Carvalho Chehab

media: i2c: ov4689: Refactor ov4689_set_ctrl

Introduce local variable for regmap within the ov4689_set_ctrl
function. This adjustment eliminates repetition within the function.
Signed-off-by: default avatarMikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent d015aaaf
...@@ -580,10 +580,11 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -580,10 +580,11 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct ov4689 *ov4689 = struct ov4689 *ov4689 =
container_of(ctrl->handler, struct ov4689, ctrl_handler); container_of(ctrl->handler, struct ov4689, ctrl_handler);
struct regmap *regmap = ov4689->regmap;
struct device *dev = ov4689->dev; struct device *dev = ov4689->dev;
int sensor_gain = 0; int sensor_gain = 0;
s64 max_expo; s64 max_expo;
int ret; int ret = 0;
/* Propagate change of current control to all related controls */ /* Propagate change of current control to all related controls */
switch (ctrl->id) { switch (ctrl->id) {
...@@ -603,16 +604,15 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -603,16 +604,15 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_EXPOSURE: case V4L2_CID_EXPOSURE:
/* 4 least significant bits of exposure are fractional part */ /* 4 least significant bits of exposure are fractional part */
ret = cci_write(ov4689->regmap, OV4689_REG_EXPOSURE, cci_write(regmap, OV4689_REG_EXPOSURE, ctrl->val << 4, &ret);
ctrl->val << 4, NULL);
break; break;
case V4L2_CID_ANALOGUE_GAIN: case V4L2_CID_ANALOGUE_GAIN:
ret = ov4689_map_gain(ov4689, ctrl->val, &sensor_gain); ret = ov4689_map_gain(ov4689, ctrl->val, &sensor_gain);
cci_write(ov4689->regmap, OV4689_REG_GAIN, sensor_gain, &ret); cci_write(regmap, OV4689_REG_GAIN, sensor_gain, &ret);
break; break;
case V4L2_CID_VBLANK: case V4L2_CID_VBLANK:
ret = cci_write(ov4689->regmap, OV4689_REG_VTS, cci_write(regmap, OV4689_REG_VTS,
ctrl->val + ov4689->cur_mode->height, NULL); ctrl->val + ov4689->cur_mode->height, &ret);
break; break;
case V4L2_CID_TEST_PATTERN: case V4L2_CID_TEST_PATTERN:
ret = ov4689_enable_test_pattern(ov4689, ctrl->val); ret = ov4689_enable_test_pattern(ov4689, ctrl->val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment