[COMMON] fimc-is2: Add dual sync settings for 5E9 & OV12A10
authorxff <fangfang.xu@samsung.com>
Mon, 4 Mar 2019 08:17:04 +0000 (16:17 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:58 +0000 (17:36 +0800)
Change-Id: I409119c66fb104caaa71eb256e6262ea72cbf0c1
Signed-off-by: xff <fangfang.xu@samsung.com>
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/cis/fimc-is-cis-12a10.c

index 818004c4c26afa138913e3c2dc75708819a1f7b1..dbb7eacec606587341b21c295619310a2ae12e03 100755 (executable)
@@ -878,6 +878,12 @@ int sensor_12a10_cis_set_frame_duration(struct v4l2_subdev *subdev, u32 frame_du
        }
 
        ret = fimc_is_sensor_write16(client, 0x380e, frame_length_lines);
+       if (ret < 0)
+               goto p_err;
+       ret = fimc_is_sensor_write8(client, 0x3826, ((frame_length_lines * 2 - 4) & 0xFF00) >> 8);
+       if (ret < 0)
+               goto p_err;
+       ret = fimc_is_sensor_write8(client, 0x3827, (frame_length_lines * 2 - 4) & 0xFF);
        if (ret < 0)
                goto p_err;
 
@@ -1756,6 +1762,76 @@ int sensor_12a10_cis_long_term_exposure(struct v4l2_subdev *subdev)
        return ret;
 }
 
+static int sensor_12a10_cis_set_dual_slave_setting(struct fimc_is_cis *cis)
+{
+       int ret = 0;
+       struct i2c_client *client;
+
+       cis_shared_data *cis_data;
+       FIMC_BUG(!cis);
+
+       client = cis->client;
+       if (unlikely(!client)) {
+               err("client is NULL");
+               ret = -EINVAL;
+               goto p_err;
+       }
+
+       dbg_sensor(1, "[MOD:D:%d] %s\n", cis->id, __func__);
+
+       cis_data = cis->cis_data;
+
+       /* Vsync Input Source Select */
+       fimc_is_sensor_write8(client, 0x3002, 0x21);
+       fimc_is_sensor_write8(client, 0x3643, 0x22);
+       fimc_is_sensor_write8(client, 0x3822, 0xa1);
+       fimc_is_sensor_write8(client, 0x3823, 0x78);
+       fimc_is_sensor_write8(client, 0x3824, 0x02);
+       fimc_is_sensor_write8(client, 0x3825, 0x14);
+       fimc_is_sensor_write8(client, 0x3826, 0x1A);// 2 * 0xD40 - 4 = 0x1A7C
+       fimc_is_sensor_write8(client, 0x3827, 0x7C);
+       fimc_is_sensor_write8(client, 0x3c80, 0x08);
+
+p_err:
+       return ret;
+}
+
+int sensor_12a10_cis_set_dual_setting(struct v4l2_subdev *subdev)
+{
+       int ret = 0;
+       struct fimc_is_cis *cis;
+       struct i2c_client *client;
+
+       FIMC_BUG(!subdev);
+
+       cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
+
+       FIMC_BUG(!cis);
+
+       client = cis->client;
+       if (unlikely(!client)) {
+               err("client is NULL");
+               ret = -EINVAL;
+               goto p_err;
+       }
+
+       switch (cis->dual_sync_mode) {
+       case DUAL_SYNC_MASTER:
+               break;
+       case DUAL_SYNC_SLAVE:
+               ret = sensor_12a10_cis_set_dual_slave_setting(cis);
+               if (ret)
+                       err("12a10 dual slave setting fail");
+               break;
+       default:
+               err("invalid cis->dual_sync_mode(%d)\n", cis->dual_sync_mode);
+               ret = -EINVAL;
+       }
+
+p_err:
+       return ret;
+}
+
 static struct fimc_is_cis_ops cis_ops = {
        .cis_init = sensor_12a10_cis_init,
        .cis_log_status = sensor_12a10_cis_log_status,