|
@@ -428,6 +428,7 @@ static int cam_flash_component_bind(struct device *dev,
|
|
|
return -ENOMEM;
|
|
|
|
|
|
fctrl->pdev = pdev;
|
|
|
+ fctrl->of_node = pdev->dev.of_node;
|
|
|
fctrl->soc_info.pdev = pdev;
|
|
|
fctrl->soc_info.dev = &pdev->dev;
|
|
|
fctrl->soc_info.dev_name = pdev->name;
|
|
@@ -585,13 +586,18 @@ static int32_t cam_flash_i2c_driver_probe(struct i2c_client *client,
|
|
|
{
|
|
|
int32_t rc = 0, i = 0;
|
|
|
struct cam_flash_ctrl *fctrl;
|
|
|
+ struct cam_hw_soc_info *soc_info = NULL;
|
|
|
|
|
|
- if (client == NULL || id == NULL) {
|
|
|
- CAM_ERR(CAM_FLASH, "Invalid Args client: %pK id: %pK",
|
|
|
- client, id);
|
|
|
+ if (client == NULL) {
|
|
|
+ CAM_ERR(CAM_FLASH, "Invalid Args client: %pK",
|
|
|
+ client);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
+ if (id == NULL) {
|
|
|
+ CAM_DBG(CAM_FLASH, "device id is Null");
|
|
|
+ }
|
|
|
+
|
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
|
|
|
CAM_ERR(CAM_FLASH, "%s :: i2c_check_functionality failed",
|
|
|
client->name);
|
|
@@ -603,9 +609,9 @@ static int32_t cam_flash_i2c_driver_probe(struct i2c_client *client,
|
|
|
if (!fctrl)
|
|
|
return -ENOMEM;
|
|
|
|
|
|
- i2c_set_clientdata(client, fctrl);
|
|
|
-
|
|
|
+ client->dev.driver_data = fctrl;
|
|
|
fctrl->io_master_info.client = client;
|
|
|
+ fctrl->of_node = client->dev.of_node;
|
|
|
fctrl->soc_info.dev = &client->dev;
|
|
|
fctrl->soc_info.dev_name = client->name;
|
|
|
fctrl->io_master_info.master_type = I2C_MASTER;
|
|
@@ -616,6 +622,49 @@ static int32_t cam_flash_i2c_driver_probe(struct i2c_client *client,
|
|
|
goto free_ctrl;
|
|
|
}
|
|
|
|
|
|
+ rc = cam_flash_init_default_params(fctrl);
|
|
|
+ if (rc) {
|
|
|
+ CAM_ERR(CAM_FLASH,
|
|
|
+ "failed: cam_flash_init_default_params rc %d",
|
|
|
+ rc);
|
|
|
+ goto free_ctrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ soc_info = &fctrl->soc_info;
|
|
|
+
|
|
|
+ /* Initalize regulators to default parameters */
|
|
|
+ for (i = 0; i < soc_info->num_rgltr; i++) {
|
|
|
+ soc_info->rgltr[i] = devm_regulator_get(soc_info->dev,
|
|
|
+ soc_info->rgltr_name[i]);
|
|
|
+ if (IS_ERR_OR_NULL(soc_info->rgltr[i])) {
|
|
|
+ rc = PTR_ERR(soc_info->rgltr[i]);
|
|
|
+ rc = rc ? rc : -EINVAL;
|
|
|
+ CAM_ERR(CAM_FLASH, "get failed for regulator %s %d",
|
|
|
+ soc_info->rgltr_name[i], rc);
|
|
|
+ goto free_ctrl;
|
|
|
+ }
|
|
|
+ CAM_DBG(CAM_FLASH, "get for regulator %s",
|
|
|
+ soc_info->rgltr_name[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!soc_info->gpio_data) {
|
|
|
+ CAM_DBG(CAM_FLASH, "No GPIO found");
|
|
|
+ } else {
|
|
|
+ if (!soc_info->gpio_data->cam_gpio_common_tbl_size) {
|
|
|
+ CAM_DBG(CAM_FLASH, "No GPIO found");
|
|
|
+ rc = -EINVAL;
|
|
|
+ goto free_ctrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ rc = cam_sensor_util_init_gpio_pin_tbl(soc_info,
|
|
|
+ &fctrl->power_info.gpio_num_info);
|
|
|
+ if ((rc < 0) || (!fctrl->power_info.gpio_num_info)) {
|
|
|
+ CAM_ERR(CAM_FLASH, "No/Error Flash GPIOs");
|
|
|
+ rc = -EINVAL;
|
|
|
+ goto free_ctrl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
rc = cam_flash_init_subdev(fctrl);
|
|
|
if (rc)
|
|
|
goto free_ctrl;
|
|
@@ -683,6 +732,7 @@ static struct i2c_driver cam_flash_i2c_driver = {
|
|
|
.remove = cam_flash_i2c_driver_remove,
|
|
|
.driver = {
|
|
|
.name = FLASH_DRIVER_I2C,
|
|
|
+ .of_match_table = cam_flash_dt_match,
|
|
|
},
|
|
|
};
|
|
|
|
|
@@ -697,8 +747,9 @@ int32_t cam_flash_init_module(void)
|
|
|
}
|
|
|
|
|
|
rc = i2c_add_driver(&cam_flash_i2c_driver);
|
|
|
- if (rc)
|
|
|
+ if (rc < 0)
|
|
|
CAM_ERR(CAM_FLASH, "i2c_add_driver failed rc: %d", rc);
|
|
|
+
|
|
|
return rc;
|
|
|
}
|
|
|
|