mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
Merge "msm: camera: flash: Add support for qup i2c flash" into camera-kernel.lnx.4.0
This commit is contained in:
commit
30da00d21b
4 changed files with 73 additions and 14 deletions
|
|
@ -429,6 +429,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;
|
||||
|
|
@ -600,13 +601,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);
|
||||
|
|
@ -618,9 +624,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;
|
||||
|
|
@ -631,6 +637,40 @@ 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;
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_FLASH, "regulator power up for flash failed %d",
|
||||
rc);
|
||||
goto free_ctrl;
|
||||
}
|
||||
|
||||
if (!soc_info->gpio_data) {
|
||||
CAM_DBG(CAM_FLASH, "No GPIO found");
|
||||
rc = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!soc_info->gpio_data->cam_gpio_common_tbl_size) {
|
||||
CAM_DBG(CAM_FLASH, "No GPIO found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
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");
|
||||
goto free_ctrl;
|
||||
}
|
||||
|
||||
rc = cam_flash_init_subdev(fctrl);
|
||||
if (rc)
|
||||
goto free_ctrl;
|
||||
|
|
@ -699,6 +739,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,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -713,8 +754,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,7 +293,14 @@ int cam_flash_get_dt_data(struct cam_flash_ctrl *fctrl,
|
|||
rc = -ENOMEM;
|
||||
goto release_soc_res;
|
||||
}
|
||||
of_node = fctrl->pdev->dev.of_node;
|
||||
|
||||
if (fctrl->of_node == NULL) {
|
||||
CAM_ERR(CAM_FLASH, "device node is NULL");
|
||||
rc = -EINVAL;
|
||||
goto free_soc_private;
|
||||
}
|
||||
|
||||
of_node = fctrl->of_node;
|
||||
|
||||
rc = cam_soc_util_get_dt_properties(soc_info);
|
||||
if (rc) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "cam_sensor_cmn_header.h"
|
||||
|
|
@ -31,9 +31,14 @@ static int32_t cam_qup_i2c_rxdata(
|
|||
},
|
||||
};
|
||||
rc = i2c_transfer(dev_client->adapter, msgs, 2);
|
||||
if (rc < 0)
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR, "failed 0x%x", saddr);
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
/* Returns negative errno */
|
||||
/* else the number of messages executed. */
|
||||
/* So positive values are not errors. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -52,9 +57,14 @@ static int32_t cam_qup_i2c_txdata(
|
|||
},
|
||||
};
|
||||
rc = i2c_transfer(dev_client->client->adapter, msg, 1);
|
||||
if (rc < 0)
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR, "failed 0x%x", saddr);
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
/* Returns negative errno, */
|
||||
/* else the number of messages executed. */
|
||||
/* So positive values are not errors. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t cam_qup_i2c_read(struct i2c_client *client,
|
||||
|
|
|
|||
|
|
@ -74,11 +74,11 @@ int32_t cam_sensor_util_regulator_powerup(struct cam_hw_soc_info *soc_info)
|
|||
if (IS_ERR_OR_NULL(soc_info->rgltr[i])) {
|
||||
rc = PTR_ERR(soc_info->rgltr[i]);
|
||||
rc = rc ? rc : -EINVAL;
|
||||
CAM_ERR(CAM_ACTUATOR, "get failed for regulator %s %d",
|
||||
CAM_ERR(CAM_SENSOR, "get failed for regulator %s %d",
|
||||
soc_info->rgltr_name[i], rc);
|
||||
return rc;
|
||||
}
|
||||
CAM_DBG(CAM_ACTUATOR, "get for regulator %s",
|
||||
CAM_DBG(CAM_SENSOR, "get for regulator %s",
|
||||
soc_info->rgltr_name[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue