[COMMON] fimc-is2: do update sensor dm when flash capture
authorWooyeon Kim <wooy88.kim@samsung.com>
Wed, 29 May 2019 01:26:06 +0000 (10:26 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Wed, 7 Aug 2019 13:00:21 +0000 (22:00 +0900)
 PR JIRA ID: CPR-1136

Change-Id: Ib465e0dcbcbad706ac4cd41230aeab38dfc28c55
Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-control-sensor.h
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/fimc-is-device-sensor-peri.c

index f74ee60d769f8da7da1360f9010b35db1aae8a87..941d8dae78a9991dd8f6af3b7609c06dfc1cae4e 100644 (file)
@@ -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)
 {
index 5c572dbc2ff0945bdec5ee87e412f7069bd6008d..03052ab9ea6a7bd40da92c56991b1133068b95ce 100644 (file)
@@ -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);
index b269b8b0e6e829e9b06a805cf10d30c3903c7ccd..a406e642eaf54540075b2edc9bb6baad7d4c50a2 100755 (executable)
@@ -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,