From cdedcb7c7f67760b66a4ffa15b23264a9f2c8bcd Mon Sep 17 00:00:00 2001 From: Comma Device Date: Tue, 15 Mar 2022 20:26:51 -0700 Subject: [PATCH] fix all cameras --- selfdrive/camerad/cameras/camera_qcom2.cc | 12 +++++++----- selfdrive/camerad/cameras/sensor2_i2c.h | 9 +++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_qcom2.cc b/selfdrive/camerad/cameras/camera_qcom2.cc index 2387e5e8b5be77..bcf22a33051552 100644 --- a/selfdrive/camerad/cameras/camera_qcom2.cc +++ b/selfdrive/camerad/cameras/camera_qcom2.cc @@ -243,12 +243,14 @@ void CameraState::sensors_init() { switch (camera_num) { case 0: // port 0 - i2c_info->slave_addr = 0x20; + //i2c_info->slave_addr = 0x20; + i2c_info->slave_addr = 0x34; probe->camera_id = 0; break; case 1: // port 1 - i2c_info->slave_addr = 0x30; + //i2c_info->slave_addr = 0x30; + i2c_info->slave_addr = 0x36; probe->camera_id = 1; break; case 2: @@ -1024,9 +1026,9 @@ void CameraState::set_camera_exposure(float grey_frac) { {0x3366, analog_gain_reg}, {0x3362, (uint16_t)(dc_gain_enabled ? 0x1 : 0x0)}, {0x3012, (uint16_t)exposure_time}, - }; - sensors_i2c(exp_reg_array, sizeof(exp_reg_array)/sizeof(struct i2c_random_wr_payload), - CAM_SENSOR_PACKET_OPCODE_SENSOR_CONFIG);*/ + };*/ + /*struct i2c_random_wr_payload exp_reg_array[] = { + sensors_i2c(exp_reg_array, sizeof(exp_reg_array)/sizeof(struct i2c_random_wr_payload), CAM_SENSOR_PACKET_OPCODE_SENSOR_CONFIG);*/ } void camera_autoexposure(CameraState *s, float grey_frac) { diff --git a/selfdrive/camerad/cameras/sensor2_i2c.h b/selfdrive/camerad/cameras/sensor2_i2c.h index 1d557b8e4b8a23..f989e6043dcd49 100644 --- a/selfdrive/camerad/cameras/sensor2_i2c.h +++ b/selfdrive/camerad/cameras/sensor2_i2c.h @@ -4,7 +4,7 @@ struct i2c_random_wr_payload stop_reg_array[] = {{0x301A, 0x918}};*/ struct i2c_random_wr_payload start_reg_array[] = {{0x0, 0}}; struct i2c_random_wr_payload init_array_imx390[] = { - {0x2008, 0xdd}, {0x2009, 0x04}, {0x200a, 0x00}, // MODE_VMAX + {0x2008, 0xd0}, {0x2009, 0x07}, {0x200a, 0x00}, // MODE_VMAX = time between frames {0x200C, 0xe4}, {0x200D, 0x0c}, // MODE_HMAX // crop @@ -17,8 +17,8 @@ struct i2c_random_wr_payload init_array_imx390[] = { {0x3650, 0}, // CU_MODE // exposure - {0x000c, 0x7f}, {0x000d, 0x02}, - {0x0010, 0x7f}, {0x0011, 0x02}, + {0x000c, 0x0f}, {0x000d, 0x00}, + {0x0010, 0x0f}, {0x0011, 0x00}, // WUXGA mode // not in datasheet, from https://github.com/bogsen/STLinux-Kernel/blob/master/drivers/media/platform/tegra/imx185.c @@ -29,9 +29,6 @@ struct i2c_random_wr_payload init_array_imx390[] = { {0x21ee, 0xc4}, {0x21ef, 0x04}, // image send amount (1220 is the end) {0x21f0, 0xc4}, {0x21f1, 0x04}, // image processing amount - // analog gain - //{0x001a, 0x0c}, {0x001b, 0x00}, - // disable a bunch of errors causing blanking {0x0390, 0x00}, {0x0391, 0x00}, {0x0392, 0x00},