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

[media] exynos4-is: Improve the ISP chain parameter count calculation

Instead of incrementing p_region_num field each time we set a bit
in the parameter mask calculate the number of bits set only when
this information is needed.
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 4c8f0629
......@@ -985,13 +985,11 @@ struct sensor_open_extended {
u32 i2c_sclk;
};
#define fimc_is_inc_param_num(is) \
atomic_inc(&(is)->cfg_param[(is)->scenario_id].p_region_num)
struct fimc_is;
int fimc_is_hw_get_sensor_max_framerate(struct fimc_is *is);
void fimc_is_set_initial_params(struct fimc_is *is);
unsigned int __get_pending_param_count(struct fimc_is *is);
int __is_hw_update_params(struct fimc_is *is);
void __is_get_frame_size(struct fimc_is *is, struct v4l2_mbus_framefmt *mf);
......
......@@ -80,6 +80,7 @@ int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is)
int fimc_is_hw_set_param(struct fimc_is *is)
{
struct is_config_param *cfg = &is->cfg_param[is->scenario_id];
unsigned int param_count = __get_pending_param_count(is);
fimc_is_hw_wait_intmsr0_intmsd0(is);
......@@ -87,7 +88,7 @@ int fimc_is_hw_set_param(struct fimc_is *is)
mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1));
mcuctl_write(is->scenario_id, is, MCUCTL_REG_ISSR(2));
mcuctl_write(atomic_read(&cfg->p_region_num), is, MCUCTL_REG_ISSR(3));
mcuctl_write(param_count, is, MCUCTL_REG_ISSR(3));
mcuctl_write(cfg->p_region_index1, is, MCUCTL_REG_ISSR(4));
mcuctl_write(cfg->p_region_index2, is, MCUCTL_REG_ISSR(5));
......
......@@ -532,7 +532,6 @@ static void fimc_is_general_irq_handler(struct fimc_is *is)
case HIC_SET_PARAMETER:
is->cfg_param[is->scenario_id].p_region_index1 = 0;
is->cfg_param[is->scenario_id].p_region_index2 = 0;
atomic_set(&is->cfg_param[is->scenario_id].p_region_num, 0);
set_bit(IS_ST_BLOCK_CMD_CLEARED, &is->state);
pr_debug("HIC_SET_PARAMETER\n");
break;
......@@ -593,7 +592,6 @@ static void fimc_is_general_irq_handler(struct fimc_is *is)
case HIC_SET_PARAMETER:
is->cfg_param[is->scenario_id].p_region_index1 = 0;
is->cfg_param[is->scenario_id].p_region_index2 = 0;
atomic_set(&is->cfg_param[is->scenario_id].p_region_num, 0);
set_bit(IS_ST_BLOCK_CMD_CLEARED, &is->state);
break;
}
......
......@@ -226,7 +226,6 @@ struct is_config_param {
struct drc_param drc;
struct fd_param fd;
atomic_t p_region_num;
unsigned long p_region_index1;
unsigned long p_region_index2;
};
......
......@@ -229,8 +229,11 @@ static int fimc_isp_subdev_s_stream(struct v4l2_subdev *sd, int on)
fimc_is_mem_barrier();
if (on) {
if (atomic_read(&is->cfg_param[is->scenario_id].p_region_num))
if (__get_pending_param_count(is)) {
ret = fimc_is_itf_s_param(is, true);
if (ret < 0)
return ret;
}
v4l2_dbg(1, debug, sd, "changing mode to %d\n",
is->scenario_id);
......@@ -414,7 +417,6 @@ static int __ctrl_set_aewb_lock(struct fimc_is *is,
isp->aa.cmd = cmd;
isp->aa.target = ISP_AA_TARGET_AE;
fimc_is_set_param_bit(is, PARAM_ISP_AA);
fimc_is_inc_param_num(is);
is->af.ae_lock_state = ae_lock;
wmb();
......@@ -426,7 +428,6 @@ static int __ctrl_set_aewb_lock(struct fimc_is *is,
isp->aa.cmd = cmd;
isp->aa.target = ISP_AA_TARGET_AE;
fimc_is_set_param_bit(is, PARAM_ISP_AA);
fimc_is_inc_param_num(is);
is->af.awb_lock_state = awb_lock;
wmb();
......
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