From 5f3d4a34ac9ba41f80fe9b7acccb345382011c42 Mon Sep 17 00:00:00 2001 From: shiwgupt Date: Tue, 27 Oct 2020 08:49:22 +0530 Subject: [PATCH] msm: camera: cci: Add report id in report command for CCI I2C queue -Report id is a unique 4-bit value associated with the report command. Interrupt is generated on each report command execution. This change helps to know whether interrupt is received for a corresponding report id. Report id can be checked in REPORT_STATUS register. This change adds report id in report command of CCI I2C queue as per HPG. CRs-Fixed: 2857533 Change-Id: I0c3066962e21c7c024e67ae81ecb762ba331e329 Signed-off-by: shiwgupt --- .../cam_sensor_module/cam_cci/cam_cci_core.c | 21 ++++++++++++++++--- .../cam_sensor_module/cam_cci/cam_cci_dev.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/cam_sensor_module/cam_cci/cam_cci_core.c b/drivers/cam_sensor_module/cam_cci/cam_cci_core.c index b1a6c65dd6..bdb19b9978 100644 --- a/drivers/cam_sensor_module/cam_cci/cam_cci_core.c +++ b/drivers/cam_sensor_module/cam_cci/cam_cci_core.c @@ -104,13 +104,20 @@ static int32_t cam_cci_validate_queue(struct cci_device *cci_dev, if ((read_val + len + 1) > cci_dev->cci_i2c_queue_info[master][queue].max_queue_size) { uint32_t reg_val = 0; - uint32_t report_val = CCI_I2C_REPORT_CMD | (1 << 8); + uint32_t report_id = + cci_dev->cci_i2c_queue_info[master][queue].report_id; + uint32_t report_val = CCI_I2C_REPORT_CMD | (1 << 8) | + (1 << 9) | (report_id << 4); CAM_DBG(CAM_CCI, "CCI_I2C_REPORT_CMD"); cam_io_w_mb(report_val, base + CCI_I2C_M0_Q0_LOAD_DATA_ADDR + reg_offset); read_val++; + cci_dev->cci_i2c_queue_info[master][queue].report_id++; + if (cci_dev->cci_i2c_queue_info[master][queue].report_id == REPORT_IDSIZE) + cci_dev->cci_i2c_queue_info[master][queue].report_id = 0; + CAM_DBG(CAM_CCI, "CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR %d, queue: %d", read_val, queue); @@ -305,14 +312,22 @@ static void cam_cci_load_report_cmd(struct cci_device *cci_dev, uint32_t reg_offset = master * 0x200 + queue * 0x100; uint32_t read_val = cam_io_r_mb(base + CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR + reg_offset); - uint32_t report_val = CCI_I2C_REPORT_CMD | (1 << 8); + uint32_t report_id = + cci_dev->cci_i2c_queue_info[master][queue].report_id; + uint32_t report_val = CCI_I2C_REPORT_CMD | (1 << 8) | + (1 << 9) | (report_id << 4); - CAM_DBG(CAM_CCI, "CCI_I2C_REPORT_CMD curr_w_cnt: %d", read_val); + CAM_DBG(CAM_CCI, "CCI_I2C_REPORT_CMD curr_w_cnt: %d report_id %d", + read_val, report_id); cam_io_w_mb(report_val, base + CCI_I2C_M0_Q0_LOAD_DATA_ADDR + reg_offset); read_val++; + cci_dev->cci_i2c_queue_info[master][queue].report_id++; + if (cci_dev->cci_i2c_queue_info[master][queue].report_id == REPORT_IDSIZE) + cci_dev->cci_i2c_queue_info[master][queue].report_id = 0; + CAM_DBG(CAM_CCI, "CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR %d", read_val); cam_io_w_mb(read_val, base + CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR + reg_offset); diff --git a/drivers/cam_sensor_module/cam_cci/cam_cci_dev.h b/drivers/cam_sensor_module/cam_cci/cam_cci_dev.h index a72f4d8366..46cf0315dc 100644 --- a/drivers/cam_sensor_module/cam_cci/cam_cci_dev.h +++ b/drivers/cam_sensor_module/cam_cci/cam_cci_dev.h @@ -65,6 +65,7 @@ #define CAM_CCI_TIMEOUT_DUMP_EN BIT(2) #define CCI_VERSION_1_2_9 0x10020009 +#define REPORT_IDSIZE 16 enum cci_i2c_sync { MSM_SYNC_DISABLE, MSM_SYNC_ENABLE,