Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ba8783d authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: sensor: Change regulator get,put to devres entry" into camera-kernel.lnx.4.0

parents 29e9e048 21fea546
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
// 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;
+3 −1
Original line number Diff line number Diff line
// 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;
}
+5 −1
Original line number Diff line number Diff line
// 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;
+6 −1
Original line number Diff line number Diff line
// 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,
+21 −17
Original line number Diff line number Diff line
@@ -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 @@ int cam_sensor_core_power_up(struct cam_sensor_power_ctrl_t *ctrl,
				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",
Loading