[COMMON] fimc-is2: Add pdaf feature to 12a10 sensor
authorDohyun Kim <dh5.kim@samsung.com>
Wed, 27 Mar 2019 09:18:16 +0000 (18:18 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Wed, 7 Aug 2019 13:00:06 +0000 (22:00 +0900)
Change-Id: Ibe4dc721533e5161e7f3bfd9f9b9361c12ae8541
Signed-off-by: Dohyun Kim <dh5.kim@samsung.com>
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/cis/fimc-is-cis-12a10-setA.h
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/cis/fimc-is-cis-12a10.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/modules/fimc-is-device-module-12a10.c

index 521e2efd1bfe52766bfa19056dec6424aad5d135..4415ea613e01fda4e0cac465d879785e0c47712f 100755 (executable)
@@ -489,6 +489,31 @@ const struct sensor_pll_info_compact sensor_12a10_pllinfo_A_1280x720_120fps = {
        0x0428, /* line_length_pck      (0x380c) */
 };
 
+const struct sensor_crop_info sensor_12a10_crop_info_A_4096x3072_30fps = {
+       0, /*  cal_crop_x */
+       0, /*  cal_crop_y */
+};
+#if 0
+const struct sensor_crop_info sensor_12a10_crop_info_A_2048x1536_60fps = {
+       0, /*  cal_crop_x */
+       0, /*  cal_crop_y */
+};
+
+const struct sensor_crop_info sensor_12a10_crop_info_A_2000x1124_60fps = {
+       24, /*  cal_crop_x */
+       206, /*  cal_crop_y */
+};
+
+const struct sensor_crop_info sensor_12a10_crop_info_A_1920x1080_60fps = {
+       64, /*  cal_crop_x */
+       228, /*  cal_crop_y */
+};
+
+const struct sensor_crop_info sensor_12a10_crop_info_A_1280x720_120fps = {
+       384, /*  cal_crop_x */
+       408, /*  cal_crop_y */
+};
+#endif
 static const u32 *sensor_12a10_setfiles_A[] = {
        sensor_12a10_setfile_A_4096x3072_30fps,
        sensor_12a10_setfile_A_2048x1536_60fps,
@@ -512,4 +537,12 @@ static const struct sensor_pll_info_compact *sensor_12a10_pllinfos_A[] = {
        &sensor_12a10_pllinfo_A_1920x1080_60fps,*/
        &sensor_12a10_pllinfo_A_1280x720_120fps,
 };
+
+static const struct sensor_crop_info *sensor_12a10_crop_infos_A[] = {
+       &sensor_12a10_crop_info_A_4096x3072_30fps,
+       /*&sensor_12a10_crop_info_A_2048x1536_60fps,
+       &sensor_12a10_crop_info_A_2000x1124_60fps,
+       &sensor_12a10_crop_info_A_1920x1080_60fps,
+       &sensor_12a10_crop_info_A_1280x720_120fps,*/
+};
 #endif
index aa8315afccbe605e6ca52df635cf6f82f44c1f7c..4568e5c2f5412bbd2bcbdf1ae2a6b9769cabd340 100755 (executable)
@@ -50,6 +50,7 @@ static u32 sensor_12a10_global_size;
 static const u32 **sensor_12a10_setfiles;
 static const u32 *sensor_12a10_setfile_sizes;
 static const struct sensor_pll_info_compact **sensor_12a10_pllinfos;
+static const struct sensor_crop_info **sensor_12a10_crop_infos;
 static u32 sensor_12a10_max_setfile_num;
 
 static void sensor_12a10_cis_data_calculation(const struct sensor_pll_info_compact *pll_info_compact, cis_shared_data *cis_data)
@@ -366,6 +367,13 @@ int sensor_12a10_cis_mode_change(struct v4l2_subdev *subdev, u32 mode)
 
        sensor_12a10_cis_data_calculation(sensor_12a10_pllinfos[mode], cis->cis_data);
 
+       if (cis->cis_data->is_data.paf_mode) {
+               cis->cis_data->cur_pos_x = 0;
+               cis->cis_data->cur_pos_y = 0;
+               info("get cur_pos_x/y value for MS paf mode x: %d, y: %d\n",
+                       cis->cis_data->cur_pos_x, cis->cis_data->cur_pos_y);
+       }
+
        I2C_MUTEX_LOCK(cis->i2c_lock);
 
        ret = sensor_cis_set_registers(subdev, sensor_12a10_setfiles[mode], sensor_12a10_setfile_sizes[mode]);
@@ -1806,6 +1814,7 @@ static int cis_12a10_probe(struct i2c_client *client,
                sensor_12a10_setfile_sizes = sensor_12a10_setfile_A_sizes;
                sensor_12a10_pllinfos = sensor_12a10_pllinfos_A;
                sensor_12a10_max_setfile_num = ARRAY_SIZE(sensor_12a10_setfiles_A);
+               sensor_12a10_crop_infos = sensor_12a10_crop_infos_A;
        }
 
        cis->use_initial_ae = of_property_read_bool(dnode, "use_initial_ae");
index 94b0cf038e0c303e7a8b47921ffd775a82638313..67990270792f3810aa80b8cdb36f1bb318f45331 100755 (executable)
 
 static struct fimc_is_sensor_cfg config_module_12a10[] = {
                        /* width, height, fps, settle, mode, lane, speed, interleave, pd_mode */
-       FIMC_IS_SENSOR_CFG(4096, 3072, 30, 0, 0, CSI_DATA_LANES_4, 1144, CSI_MODE_VC_DT, PD_NONE,
+       FIMC_IS_SENSOR_CFG(4096, 3072, 30, 0, 0, CSI_DATA_LANES_4, 1144, CSI_MODE_VC_DT, PD_MSPD,
                VC_IN(0, HW_FORMAT_RAW10, 4096, 3072), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 4096, 3072),
-               VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
-               VC_IN(2, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
+               VC_IN(1, HW_FORMAT_RAW10, 256, 384), VC_OUT(HW_FORMAT_USER, VC_PRIVATE, 256, 384),
+               VC_IN(2, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_USER, VC_MIPISTAT, 256, 384),
                VC_IN(0, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0)),
        FIMC_IS_SENSOR_CFG(2048, 1536, 60, 0, 1, CSI_DATA_LANES_4, 1144, CSI_MODE_VC_DT, PD_NONE,
                VC_IN(0, HW_FORMAT_RAW10, 2048, 1536), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 2048, 1536),
@@ -346,19 +346,19 @@ static int __init sensor_module_12a10_probe(struct platform_device *pdev)
                                module->vc_extra_info[t].stat_type
                                        = VC_STAT_TYPE_PAFSTAT_FLOATING;
 
-                               module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_ULTRA_PD_TAIL;
-                               module->vc_extra_info[t].max_width = 4032;
-                               module->vc_extra_info[t].max_height = 1;
-                               module->vc_extra_info[t].max_element = 1;
+                               module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_OV_PDAF;
+                               module->vc_extra_info[t].max_width = 256;
+                               module->vc_extra_info[t].max_height = 768;
+                               module->vc_extra_info[t].max_element = 2;
                                break;
                        case VC_BUF_DATA_TYPE_GENERAL_STAT2:
                                module->vc_extra_info[t].stat_type
                                        = VC_STAT_TYPE_PAFSTAT_STATIC;
 
-                               module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_ULTRA_PD_TAIL;
-                               module->vc_extra_info[t].max_width = 127680;
-                               module->vc_extra_info[t].max_height = 1;
-                               module->vc_extra_info[t].max_element = 1;
+                               module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_OV_PDAF;
+                               module->vc_extra_info[t].max_width = 256;
+                               module->vc_extra_info[t].max_height = 768;
+                               module->vc_extra_info[t].max_element = 2;
                                break;
                        }
                }