Commit 630caa23 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] m5mols: Remove mode_save field from struct m5mols_info

There is no need to keep this in the drivers' private data structure,
an on the stack variable is enough. Also simplify a bit the ISP state
switching function.
Acked-by: default avatarHeungJun Kim <riverful.kim@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ce808a47
...@@ -180,7 +180,6 @@ struct m5mols_version { ...@@ -180,7 +180,6 @@ struct m5mols_version {
* @lock_awb: true means the Aut WhiteBalance is locked * @lock_awb: true means the Aut WhiteBalance is locked
* @resolution: register value for current resolution * @resolution: register value for current resolution
* @mode: register value for current operation mode * @mode: register value for current operation mode
* @mode_save: register value for current operation mode for saving
* @set_power: optional power callback to the board code * @set_power: optional power callback to the board code
*/ */
struct m5mols_info { struct m5mols_info {
...@@ -211,7 +210,6 @@ struct m5mols_info { ...@@ -211,7 +210,6 @@ struct m5mols_info {
bool lock_awb; bool lock_awb;
u8 resolution; u8 resolution;
u8 mode; u8 mode;
u8 mode_save;
int (*set_power)(struct device *dev, int on); int (*set_power)(struct device *dev, int on);
}; };
......
...@@ -370,13 +370,13 @@ int m5mols_mode(struct m5mols_info *info, u8 mode) ...@@ -370,13 +370,13 @@ int m5mols_mode(struct m5mols_info *info, u8 mode)
return ret; return ret;
ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg); ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg);
if ((!ret && reg == mode) || ret) if (ret || reg == mode)
return ret; return ret;
switch (reg) { switch (reg) {
case REG_PARAMETER: case REG_PARAMETER:
ret = m5mols_reg_mode(sd, REG_MONITOR); ret = m5mols_reg_mode(sd, REG_MONITOR);
if (!ret && mode == REG_MONITOR) if (mode == REG_MONITOR)
break; break;
if (!ret) if (!ret)
ret = m5mols_reg_mode(sd, REG_CAPTURE); ret = m5mols_reg_mode(sd, REG_CAPTURE);
...@@ -393,7 +393,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode) ...@@ -393,7 +393,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode)
case REG_CAPTURE: case REG_CAPTURE:
ret = m5mols_reg_mode(sd, REG_MONITOR); ret = m5mols_reg_mode(sd, REG_MONITOR);
if (!ret && mode == REG_MONITOR) if (mode == REG_MONITOR)
break; break;
if (!ret) if (!ret)
ret = m5mols_reg_mode(sd, REG_PARAMETER); ret = m5mols_reg_mode(sd, REG_PARAMETER);
...@@ -677,15 +677,14 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -677,15 +677,14 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct v4l2_subdev *sd = to_sd(ctrl); struct v4l2_subdev *sd = to_sd(ctrl);
struct m5mols_info *info = to_m5mols(sd); struct m5mols_info *info = to_m5mols(sd);
int ret; int isp_state = info->mode;
int ret = 0;
info->mode_save = info->mode;
ret = m5mols_mode(info, REG_PARAMETER); ret = m5mols_mode(info, REG_PARAMETER);
if (!ret) if (!ret)
ret = m5mols_set_ctrl(ctrl); ret = m5mols_set_ctrl(ctrl);
if (!ret) if (!ret)
ret = m5mols_mode(info, info->mode_save); ret = m5mols_mode(info, isp_state);
return ret; return ret;
} }
......
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