mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
rhodec flash supplier distinguish[2/4]
details: distinguish flash supplier Change-Id: I8c4692e80dc64cecb34f8d747ca40b44dea3b707 Reviewed-on: https://gerrit.mot.com/2174388 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: <handong@wingtech.com> Reviewed-by: XiaoFeng Wang <wangxf32@lenovo.com> Reviewed-by: Long Cheng <chengl1@motorola.com> Reviewed-by: <liuzy55@motorola.com> Reviewed-by: Zhichao Chen <chenzc2@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
9fb3bd88bd
commit
ca3c46dadd
4 changed files with 76 additions and 10 deletions
|
|
@ -445,12 +445,14 @@ int32_t cam_sensor_update_slave_info(struct cam_cmd_probe *probe_info,
|
|||
s_ctrl->sensor_probe_addr_type = probe_info->addr_type;
|
||||
s_ctrl->sensor_probe_data_type = probe_info->data_type;
|
||||
|
||||
s_ctrl->probe_sub_device = probe_info->probe_sub_device;
|
||||
s_ctrl->sub_device_addr = probe_info->sub_device_addr;
|
||||
s_ctrl->sub_device_data_type = probe_info->sub_device_data_type;
|
||||
s_ctrl->sub_device_addr_type = probe_info->sub_device_addr_type;
|
||||
s_ctrl->sub_device_id_addr = probe_info->sub_device_id_addr;
|
||||
s_ctrl->expected_sub_device_id = probe_info->expected_sub_device_id;
|
||||
s_ctrl->probe_sub_device = probe_info->probe_sub_device;
|
||||
s_ctrl->sub_device_addr = probe_info->sub_device_addr;
|
||||
s_ctrl->sub_device_data_type = probe_info->sub_device_data_type;
|
||||
s_ctrl->sub_device_addr_type = probe_info->sub_device_addr_type;
|
||||
s_ctrl->sub_device_id_addr = probe_info->sub_device_id_addr;
|
||||
s_ctrl->expected_sub_device_id = probe_info->expected_sub_device_id;
|
||||
s_ctrl->sub_device_cci_master = probe_info->sub_device_cci_master;
|
||||
s_ctrl->sub_device_i2c_freq_mode = probe_info->sub_device_i2c_freq_mode;
|
||||
|
||||
CAM_DBG(CAM_SENSOR,
|
||||
"Sensor Addr: 0x%x sensor_id: 0x%x sensor_mask: 0x%x sensor_pipeline_delay:0x%x",
|
||||
|
|
@ -714,8 +716,11 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
int cam_sensor_match_sub_device_id(struct cam_sensor_ctrl_t *s_ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
int ret = 0;
|
||||
uint32_t sub_device_id = 0;
|
||||
uint16_t sensor_address = 0;
|
||||
uint16_t sensor_freq_mode = 0;
|
||||
uint8_t sensor_cci_master = 0;
|
||||
|
||||
/* if hal doesn't config ProbeSubDevice parameter in sensor xml, return success immediately */
|
||||
if (!s_ctrl->probe_sub_device) {
|
||||
|
|
@ -730,6 +735,32 @@ int cam_sensor_match_sub_device_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
s_ctrl->io_master_info.cci_client->sid = s_ctrl->sub_device_addr >> 1;
|
||||
}
|
||||
|
||||
/*if need change cci master*/
|
||||
if (s_ctrl->need_change_cci_master) {
|
||||
sensor_cci_master = s_ctrl->io_master_info.cci_client->cci_i2c_master;
|
||||
sensor_freq_mode = s_ctrl->io_master_info.cci_client->i2c_freq_mode;
|
||||
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
if (ret != 0) {
|
||||
CAM_ERR(CAM_SENSOR, "release sensor cci failed!");
|
||||
}
|
||||
|
||||
s_ctrl->io_master_info.cci_client->cci_i2c_master = s_ctrl->sub_device_cci_master;
|
||||
s_ctrl->io_master_info.cci_client->i2c_freq_mode = s_ctrl->sub_device_i2c_freq_mode;
|
||||
|
||||
rc = camera_io_init(&(s_ctrl->io_master_info));
|
||||
if(rc != 0) {
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
CAM_ERR(CAM_SENSOR, "init sensor cci failed! rc=%d, release ret=%d, try again!", rc, ret);
|
||||
usleep_range(100000, 100000);
|
||||
rc = camera_io_init(&(s_ctrl->io_master_info));
|
||||
if (rc != 0) {
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
CAM_ERR(CAM_SENSOR, "try again init sensor cci failed again! rc=%d, release ret=%d", rc, ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = camera_io_dev_read(
|
||||
&(s_ctrl->io_master_info),
|
||||
s_ctrl->sub_device_id_addr,
|
||||
|
|
@ -740,6 +771,32 @@ int cam_sensor_match_sub_device_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
CAM_INFO(CAM_SENSOR, "Read sub device id: 0x%x expected sub device id 0x%x:",
|
||||
sub_device_id, s_ctrl->expected_sub_device_id);
|
||||
|
||||
/* restore sensor i2c address */
|
||||
s_ctrl->io_master_info.cci_client->sid = sensor_address;
|
||||
|
||||
/* reset cci master */
|
||||
if (s_ctrl->need_change_cci_master) {
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
if (ret != 0) {
|
||||
CAM_ERR(CAM_SENSOR, "release flash cci failed! ");
|
||||
}
|
||||
|
||||
s_ctrl->io_master_info.cci_client->cci_i2c_master = sensor_cci_master;
|
||||
s_ctrl->io_master_info.cci_client->i2c_freq_mode = sensor_freq_mode;
|
||||
|
||||
rc = camera_io_init(&(s_ctrl->io_master_info));
|
||||
if(rc != 0) {
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
CAM_ERR(CAM_SENSOR, "init sensor cci failed! rc=%d, release ret=%d, try again!", rc, ret);
|
||||
usleep_range(100000, 100000);
|
||||
rc = camera_io_init(&(s_ctrl->io_master_info));
|
||||
if (rc != 0) {
|
||||
ret = camera_io_release(&(s_ctrl->io_master_info));
|
||||
CAM_ERR(CAM_SENSOR, "try again init sensor cci failed again! rc=%d, release ret=%d", rc, ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sub_device_id == s_ctrl->expected_sub_device_id) {
|
||||
CAM_INFO(CAM_SENSOR,
|
||||
"Probe sub device success,slot:%d,sub_device_addr:0x%x,sub_device_id:0x%x",
|
||||
|
|
@ -753,9 +810,6 @@ int cam_sensor_match_sub_device_id(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
rc = -EINVAL;
|
||||
}
|
||||
|
||||
/* restore sensor i2c address */
|
||||
s_ctrl->io_master_info.cci_client->sid = sensor_address;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -845,7 +899,7 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
|
|||
rc = cam_sensor_match_sub_device_id(s_ctrl);
|
||||
if (rc < 0) {
|
||||
cam_sensor_power_down(s_ctrl);
|
||||
msleep(20);
|
||||
usleep_range(20000,20000);
|
||||
goto free_power_settings;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ struct cam_sensor_ctrl_t {
|
|||
uint8_t sub_device_addr_type;
|
||||
uint16_t sub_device_id_addr;
|
||||
uint16_t expected_sub_device_id;
|
||||
uint8_t sub_device_cci_master;
|
||||
uint8_t sub_device_i2c_freq_mode;
|
||||
bool need_change_cci_master;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -187,6 +187,13 @@ static int32_t cam_sensor_driver_get_dt_data(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
CAM_DBG(CAM_SENSOR, "cci-index %d", s_ctrl->cci_num);
|
||||
}
|
||||
|
||||
if (of_property_read_bool(of_node, "need-change-cci-master")) {
|
||||
CAM_DBG(CAM_SENSOR, "need-change-cci-master found in this imgsensor");
|
||||
s_ctrl->need_change_cci_master = true;
|
||||
} else {
|
||||
s_ctrl->need_change_cci_master = false;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(of_node, "sensor-position-pitch",
|
||||
&sensordata->pos_pitch) < 0) {
|
||||
CAM_DBG(CAM_SENSOR, "Invalid sensor position");
|
||||
|
|
|
|||
|
|
@ -178,6 +178,8 @@ struct cam_cmd_probe {
|
|||
__u8 sub_device_addr_type;
|
||||
__u32 sub_device_id_addr;
|
||||
__u32 expected_sub_device_id;
|
||||
__u8 sub_device_cci_master;
|
||||
__u8 sub_device_i2c_freq_mode;
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue