From: Wooyeon Kim Date: Wed, 29 May 2019 01:26:06 +0000 (+0900) Subject: [COMMON] fimc-is2: do update sensor dm when flash capture X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=040e81d9c37f9a472b1b9e8a0c5731b248b742bc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] fimc-is2: do update sensor dm when flash capture PR JIRA ID: CPR-1136 Change-Id: Ib465e0dcbcbad706ac4cd41230aeab38dfc28c55 Signed-off-by: Wooyeon Kim --- diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.c index f74ee60d769f..941d8dae78a9 100644 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.c @@ -49,6 +49,12 @@ u32 fimc_is_sensor_calculate_tgain(u32 dgain, u32 again) return tgain; } +u32 fimc_is_sensor_calculate_sensitivity_by_tgain(u32 tgain) +{ + /* ISO(sensitivity) 40 = gain 1x */ + return (tgain * 40) / 1000; +} + u32 fimc_is_sensor_ctl_get_csi_vsync_cnt(struct fimc_is_device_sensor *device) { struct fimc_is_device_csi *csi = NULL; @@ -409,7 +415,7 @@ p_err: return ret; } -static int fimc_is_sensor_ctl_update_gains(struct fimc_is_device_sensor *device, +int fimc_is_sensor_ctl_update_gains(struct fimc_is_device_sensor *device, struct fimc_is_sensor_ctl *module_ctl, u32 *dm_index, struct ae_param adj_again, @@ -558,7 +564,7 @@ static int fimc_is_sensor_ctl_set_exposure(struct fimc_is_device_sensor *device, return ret; } -static int fimc_is_sensor_ctl_update_exposure(struct fimc_is_device_sensor *device, +int fimc_is_sensor_ctl_update_exposure(struct fimc_is_device_sensor *device, u32 *dm_index, struct ae_param expo) { diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.h b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.h index 5c572dbc2ff0..03052ab9ea6a 100644 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.h +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.h @@ -28,6 +28,7 @@ u64 fimc_is_sensor_convert_us_to_ns(u32 usec); u32 fimc_is_sensor_convert_ns_to_us(u64 nsec); u32 fimc_is_sensor_calculate_tgain(u32 dgain, u32 again); +u32 fimc_is_sensor_calculate_sensitivity_by_tgain(u32 tgain); struct fimc_is_device_sensor; void fimc_is_sensor_ctl_frame_evt(struct fimc_is_device_sensor *device); @@ -45,6 +46,14 @@ void fimc_is_sensor_ctl_update_exposure_to_uctl(camera2_sensor_uctl_t *sensor_uc void fimc_is_sensor_ctl_update_gain_to_uctl(camera2_sensor_uctl_t *sensor_uctl, enum fimc_is_exposure_gain_count num_data, u32 *analog_gain, u32 *digital_gain); +int fimc_is_sensor_ctl_update_gains(struct fimc_is_device_sensor *device, + struct fimc_is_sensor_ctl *module_ctl, + u32 *dm_index, + struct ae_param adj_again, + struct ae_param adj_dgain); +int fimc_is_sensor_ctl_update_exposure(struct fimc_is_device_sensor *device, + u32 *dm_index, + struct ae_param expo); /* Actuator funtion */ int fimc_is_actuator_ctl_set_position(struct fimc_is_device_sensor *device, u32 position); diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-device-sensor-peri.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-device-sensor-peri.c index b269b8b0e6e8..a406e642eaf5 100755 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-device-sensor-peri.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-device-sensor-peri.c @@ -653,6 +653,8 @@ void fimc_is_sensor_flash_fire_work(struct work_struct *data) struct fimc_is_device_sensor_peri *sensor_peri; struct v4l2_subdev *subdev_flash; struct ae_param expo, dgain, again; + struct fimc_is_sensor_ctl module_ctl; + u32 m_fcount[2]; u32 tgain[EXPOSURE_GAIN_MAX]; u32 step = 0; FIMC_BUG_VOID(!data); @@ -753,6 +755,14 @@ void fimc_is_sensor_flash_fire_work(struct work_struct *data) &dgain.val); } + /* update exp/gain/sensitivity meta for apply flash capture frame */ + m_fcount[0] = m_fcount[1] = (device->fcount + 1) % EXPECT_DM_NUM; + module_ctl.cur_cam20_sensor_udctrl.sensitivity = + fimc_is_sensor_calculate_sensitivity_by_tgain(tgain[0]); + module_ctl.valid_sensor_ctrl = false; + fimc_is_sensor_ctl_update_gains(device, &module_ctl, m_fcount, again, dgain); + fimc_is_sensor_ctl_update_exposure(device, m_fcount, expo); + dbg_flash("[%s][FLASH] mode %d, intensity %d, firing time %d us, step %d\n", __func__, flash->flash_data.mode, flash->flash_data.intensity,