hawao: Flash compatible
Distinguish IIC Flash Supplier. 1.dts add distinguish-flash-supplier=<DevAddr,FlashIdRegAddr,FlashId> 2.ioctl query cap,distinguish flash. 3.if cci read FlashIdRegAddr is FlashId,this is sencondary,flash_supplier return 1. 4.if don't find distinguish-flash-supplier,flash_supplier is default Change-Id: Ia3f82971fa12aaf1608f576310a5221474ef21e6 Signed-off-by: kankan17 <kankan17@motorola.com> Reviewed-on: https://gerrit.mot.com/2171912 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: <chenlj26@motorola.com> Reviewed-by: <liuzy55@motorola.com> Reviewed-by: Long Cheng <chengl1@motorola.com> Reviewed-by: Zhichao Chen <chenzc2@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
1 parent
41c6737d79
commit
9dc028b84a
4 files changed
+133
No files matched your search
@@ -2049,3 +2049,91 @@ int cam_flash_apply_request(struct cam_req_mgr_apply_request *apply)
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CAMERA_FLASH_IIC_COMPATIBLE
|
||||
static int cam_flash_construct_power_vio_setting(
|
||||
struct cam_sensor_power_ctrl_t *power_info)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
power_info->power_setting_size = 1;
|
||||
power_info->power_setting =
|
||||
kzalloc(sizeof(struct cam_sensor_power_setting),
|
||||
GFP_KERNEL);
|
||||
if (!power_info->power_setting)
|
||||
return -ENOMEM;
|
||||
|
||||
power_info->power_setting[0].seq_type = SENSOR_VIO;
|
||||
power_info->power_setting[0].seq_val = CAM_VIO;
|
||||
power_info->power_setting[0].config_val = 1;
|
||||
power_info->power_setting[0].delay = 2;
|
||||
|
||||
power_info->power_down_setting_size = 1;
|
||||
power_info->power_down_setting =
|
||||
kzalloc(sizeof(struct cam_sensor_power_setting),
|
||||
GFP_KERNEL);
|
||||
if (!power_info->power_down_setting) {
|
||||
rc = -ENOMEM;
|
||||
goto free_power_settings;
|
||||
}
|
||||
|
||||
power_info->power_down_setting[0].seq_type = SENSOR_VIO;
|
||||
power_info->power_down_setting[0].seq_val = CAM_VIO;
|
||||
power_info->power_down_setting[0].config_val = 0;
|
||||
|
||||
return rc;
|
||||
|
||||
free_power_settings:
|
||||
kfree(power_info->power_setting);
|
||||
power_info->power_setting = NULL;
|
||||
power_info->power_setting_size = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_flash_fill_vreg_setting(struct cam_flash_ctrl *fctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
rc = cam_flash_construct_power_vio_setting(
|
||||
&fctrl->power_info);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_FLASH, "Failed Flash Power VIO Setting: rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
rc = msm_camera_fill_vreg_params(&fctrl->soc_info,
|
||||
fctrl->power_info.power_setting,
|
||||
fctrl->power_info.power_setting_size);
|
||||
if(rc)
|
||||
{
|
||||
CAM_ERR(CAM_FLASH, "Failed Flash Fill Power Up Params: rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
rc = msm_camera_fill_vreg_params(&fctrl->soc_info,
|
||||
fctrl->power_info.power_down_setting,
|
||||
fctrl->power_info.power_down_setting_size);
|
||||
if(rc)
|
||||
{
|
||||
CAM_ERR(CAM_FLASH, "Failed Flash Fill Power Down Params: rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_flash_fill_i2c_default_setting(struct cam_flash_ctrl *fctrl, uint32_t slave_addr)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
struct cam_cmd_i2c_info i2c_info={0};
|
||||
i2c_info.slave_addr = slave_addr;
|
||||
i2c_info.i2c_freq_mode = I2C_STANDARD_MODE;
|
||||
|
||||
rc = cam_flash_slaveInfo_pkt_parser(
|
||||
fctrl, (uint32_t *)&i2c_info, sizeof(struct cam_cmd_i2c_info));
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_FLASH,
|
||||
"Failed parsing slave info: rc: %d",
|
||||
rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -145,6 +145,10 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
||||
}
|
||||
case CAM_QUERY_CAP: {
|
||||
struct cam_flash_query_cap_info flash_cap = {0};
|
||||
#ifdef CONFIG_CAMERA_FLASH_IIC_COMPATIBLE
|
||||
uint32_t flash_iic_supplier[3];
|
||||
uint32_t flashid=0;
|
||||
#endif
|
||||
|
||||
CAM_DBG(CAM_FLASH, "CAM_QUERY_CAP");
|
||||
flash_cap.slot_info = fctrl->soc_info.index;
|
||||
@@ -160,6 +164,40 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
||||
flash_cap.max_current_torch[i] =
|
||||
soc_private->torch_max_current[i];
|
||||
|
||||
#ifdef CONFIG_CAMERA_FLASH_IIC_COMPATIBLE
|
||||
rc = of_property_read_u32_array(fctrl->of_node, "distinguish-flash-supplier",
|
||||
flash_iic_supplier, 3);
|
||||
if (!rc) {
|
||||
CAM_DBG(CAM_FLASH, "Distinguish IIC Flash Supplier dev:0x%x addr:0x%x data:0x%x",
|
||||
flash_iic_supplier[0],flash_iic_supplier[1],flash_iic_supplier[2]);
|
||||
if (cam_flash_fill_vreg_setting(fctrl)){
|
||||
CAM_ERR(CAM_FLASH, "Flash Fill Vreg Failed");
|
||||
goto release_mutex;
|
||||
}
|
||||
if (fctrl->func_tbl.power_ops(fctrl, true)){
|
||||
CAM_ERR(CAM_FLASH, "Power Up Failed");
|
||||
goto release_mutex;
|
||||
}
|
||||
if (cam_flash_fill_i2c_default_setting(fctrl, flash_iic_supplier[0])){
|
||||
CAM_ERR(CAM_FLASH, "Failed Flash Fill I2C Setting rc =%d",rc);
|
||||
goto release_mutex;
|
||||
}
|
||||
rc = camera_io_dev_read(&(fctrl->io_master_info),
|
||||
flash_iic_supplier[1],&flashid,
|
||||
CAMERA_SENSOR_I2C_TYPE_BYTE,
|
||||
CAMERA_SENSOR_I2C_TYPE_BYTE);
|
||||
CAM_DBG(CAM_FLASH, "flashid=%d",flashid);
|
||||
if ((!rc) && (flashid == flash_iic_supplier[2]))
|
||||
flash_cap.flash_supplier = 1;
|
||||
else
|
||||
flash_cap.flash_supplier = 0;
|
||||
if (fctrl->func_tbl.power_ops(fctrl, false)){
|
||||
CAM_ERR(CAM_FLASH, "Power Down Failed");
|
||||
goto release_mutex;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (copy_to_user(u64_to_user_ptr(cmd->handle),
|
||||
&flash_cap, sizeof(struct cam_flash_query_cap_info))) {
|
||||
CAM_ERR(CAM_FLASH, "Failed Copy to User");
|
||||
|
||||
@@ -235,5 +235,9 @@ int cam_flash_pmic_flush_request(struct cam_flash_ctrl *fctrl,
|
||||
enum cam_flash_flush_type, uint64_t req_id);
|
||||
void cam_flash_shutdown(struct cam_flash_ctrl *fctrl);
|
||||
int cam_flash_release_dev(struct cam_flash_ctrl *fctrl);
|
||||
#ifdef CONFIG_CAMERA_FLASH_IIC_COMPATIBLE
|
||||
int cam_flash_fill_i2c_default_setting(struct cam_flash_ctrl *fctrl, uint32_t slave_addr);
|
||||
int cam_flash_fill_vreg_setting(struct cam_flash_ctrl *fctrl);
|
||||
#endif
|
||||
|
||||
#endif /*_CAM_FLASH_DEV_H_*/
|
||||
@@ -483,6 +483,9 @@ struct cam_flash_query_cap_info {
|
||||
uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS];
|
||||
uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS];
|
||||
uint32_t flash_type;
|
||||
#ifdef CONFIG_CAMERA_FLASH_IIC_COMPATIBLE
|
||||
uint32_t flash_supplier;
|
||||
#endif
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user