mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
Dubai: Add retries for sensor id matching
details: Add retries in the sensor id matching during kernel camera probe to handle any transient failures Change-Id: I71e43566e4d9f8f27cac1f2a96470bfb76fc9663 Signed-off-by: huqian4 <[email protected]> Reviewed-on: https://gerrit.mot.com/2228991 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: <[email protected]> Reviewed-by: Long Cheng <[email protected]> Reviewed-by: Zhichao Chen <[email protected]> Submit-Approved: Jira Key
This commit is contained in:
parent
a1daf6ff57
commit
b26a4c2545
1 changed files with 27 additions and 0 deletions
|
|
@ -749,6 +749,10 @@ void cam_sensor_shutdown(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
#ifdef CONFIG_CAM_SENSOR_PROBE_RETRY
|
||||
int retries = 5;
|
||||
bool matched = false;
|
||||
#endif
|
||||
uint32_t chipid = 0;
|
||||
struct cam_camera_slave_info *slave_info;
|
||||
|
||||
|
|
@ -760,6 +764,28 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CAM_SENSOR_PROBE_RETRY
|
||||
while (retries-- && !matched) {
|
||||
rc = camera_io_dev_read(
|
||||
&(s_ctrl->io_master_info),
|
||||
slave_info->sensor_id_reg_addr,
|
||||
&chipid,
|
||||
s_ctrl->sensor_probe_addr_type,
|
||||
s_ctrl->sensor_probe_data_type);
|
||||
|
||||
CAM_INFO(CAM_SENSOR, "read id: 0x%x expected id 0x%x:",
|
||||
chipid, slave_info->sensor_id);
|
||||
|
||||
if (cam_sensor_id_by_mask(s_ctrl, chipid) == slave_info->sensor_id)
|
||||
matched = true;
|
||||
|
||||
if (!matched && !retries) {
|
||||
CAM_ERR(CAM_SENSOR, "Failed read id: 0x%x expected id 0x%x:",
|
||||
chipid, slave_info->sensor_id);
|
||||
|
||||
}
|
||||
}
|
||||
#else
|
||||
rc = camera_io_dev_read(
|
||||
&(s_ctrl->io_master_info),
|
||||
slave_info->sensor_id_reg_addr,
|
||||
|
|
@ -775,6 +801,7 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
chipid, slave_info->sensor_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue