mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
Merge "msm: camera: sensor: Change regulator get,put to devres entry" into camera-kernel.lnx.4.0
This commit is contained in:
commit
1ba8783d5d
6 changed files with 44 additions and 22 deletions
|
|
@ -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 <linux/of.h>
|
||||
|
|
@ -56,6 +56,10 @@ int32_t cam_actuator_parse_dt(struct cam_actuator_ctrl_t *a_ctrl,
|
|||
CAM_DBG(CAM_ACTUATOR, "cci-device %d", a_ctrl->cci_num);
|
||||
}
|
||||
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (!soc_info->gpio_data) {
|
||||
CAM_DBG(CAM_ACTUATOR, "No GPIO found");
|
||||
rc = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
|
|
@ -380,5 +380,7 @@ int cam_eeprom_parse_dt(struct cam_eeprom_ctrl_t *e_ctrl)
|
|||
}
|
||||
}
|
||||
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
|
|
@ -41,6 +41,10 @@ static int cam_ois_get_dt_data(struct cam_ois_ctrl_t *o_ctrl)
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (!soc_info->gpio_data) {
|
||||
CAM_INFO(CAM_OIS, "No GPIO found");
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
|
|
@ -268,6 +268,11 @@ int32_t cam_sensor_parse_dt(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = msm_sensor_init_default_params(s_ctrl);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,27 @@ int32_t cam_sensor_util_get_current_qtimer_ns(uint64_t *qtime_ns)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int32_t cam_sensor_util_regulator_powerup(struct cam_hw_soc_info *soc_info)
|
||||
{
|
||||
int32_t i, rc = 0;
|
||||
/* Initialize 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_ACTUATOR, "get failed for regulator %s %d",
|
||||
soc_info->rgltr_name[i], rc);
|
||||
return rc;
|
||||
}
|
||||
CAM_DBG(CAM_ACTUATOR, "get for regulator %s",
|
||||
soc_info->rgltr_name[i]);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int32_t delete_request(struct i2c_settings_array *i2c_array)
|
||||
{
|
||||
struct i2c_settings_list *i2c_list = NULL, *i2c_next = NULL;
|
||||
|
|
@ -1974,10 +1995,6 @@ static int cam_config_mclk_reg(struct cam_sensor_power_ctrl_t *ctrl,
|
|||
|
||||
ps->data[0] =
|
||||
soc_info->rgltr[j];
|
||||
|
||||
regulator_put(
|
||||
soc_info->rgltr[j]);
|
||||
soc_info->rgltr[j] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2057,11 +2074,6 @@ int cam_sensor_core_power_up(struct cam_sensor_power_ctrl_t *ctrl,
|
|||
CAM_DBG(CAM_SENSOR,
|
||||
"Enable cam_clk: %d", j);
|
||||
|
||||
soc_info->rgltr[j] =
|
||||
regulator_get(
|
||||
soc_info->dev,
|
||||
soc_info->rgltr_name[j]);
|
||||
|
||||
if (IS_ERR_OR_NULL(
|
||||
soc_info->rgltr[j])) {
|
||||
rc = PTR_ERR(
|
||||
|
|
@ -2156,9 +2168,6 @@ int cam_sensor_core_power_up(struct cam_sensor_power_ctrl_t *ctrl,
|
|||
CAM_DBG(CAM_SENSOR, "Enable Regulator");
|
||||
vreg_idx = power_setting->seq_val;
|
||||
|
||||
soc_info->rgltr[vreg_idx] =
|
||||
regulator_get(soc_info->dev,
|
||||
soc_info->rgltr_name[vreg_idx]);
|
||||
if (IS_ERR_OR_NULL(
|
||||
soc_info->rgltr[vreg_idx])) {
|
||||
rc = PTR_ERR(soc_info->rgltr[vreg_idx]);
|
||||
|
|
@ -2281,8 +2290,6 @@ power_up_failed:
|
|||
power_setting->data[0] =
|
||||
soc_info->rgltr[vreg_idx];
|
||||
|
||||
regulator_put(soc_info->rgltr[vreg_idx]);
|
||||
soc_info->rgltr[vreg_idx] = NULL;
|
||||
} else {
|
||||
CAM_ERR(CAM_SENSOR, "seq_val:%d > num_vreg: %d",
|
||||
power_setting->seq_val, num_vreg);
|
||||
|
|
@ -2449,9 +2456,6 @@ int cam_sensor_util_power_down(struct cam_sensor_power_ctrl_t *ctrl,
|
|||
}
|
||||
ps->data[0] =
|
||||
soc_info->rgltr[ps->seq_val];
|
||||
regulator_put(
|
||||
soc_info->rgltr[ps->seq_val]);
|
||||
soc_info->rgltr[ps->seq_val] = NULL;
|
||||
} else {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"seq_val:%d > num_vreg: %d",
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_SENSOR_UTIL_H_
|
||||
|
|
@ -41,6 +41,9 @@ int msm_camera_pinctrl_init
|
|||
|
||||
int32_t cam_sensor_util_get_current_qtimer_ns(uint64_t *qtime_ns);
|
||||
|
||||
int32_t cam_sensor_util_regulator_powerup(
|
||||
struct cam_hw_soc_info *soc_info);
|
||||
|
||||
int32_t cam_sensor_util_write_qtimer_to_io_buffer(
|
||||
struct cam_buf_io_cfg *io_cfg);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue