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

Commit 0e9ddcf5 authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: sensor: Add support to vote for PWM mode" into dev/msm-4.14-camx

parents eb6288b6 a4f98559
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -323,6 +323,11 @@ Image sensor node contains properties of camera image sensor
  Value type: <phandle>
  Definition: should contain regulator from which IO voltage is supplied

- cam_bob-supply
  Usage: optional
  Value type: <phandle>
  Definition: should contain regulator from which BoB voltage is supplied

- regulator-names
  Usage: required
  Value type: <string>
@@ -387,6 +392,11 @@ Image sensor node contains properties of camera image sensor
  Value type: <u32>
  Definition: should contain regulator from which AF voltage is supplied

- pwm-switch
  Usage: optional
  Value type: <boolean>
  Definition: This property is required for regulator to switch into PWM mode.

- gpios
  Usage: required
  Value type: <phandle>
@@ -764,14 +774,18 @@ Example:
         actuator-src = <&actuator0>;
         ois-src = <&ois0>;
         eeprom-src = <&eeprom0>;
         cam_vdig-supply = <&pm845_s3>;
         cam_vio-supply = <&pm845_lvs1>;
         cam_vana-supply = <&pmi8998_bob>;
         regulator-names = "cam_vdig", "cam_vio", "cam_vana";
         cam_vdig-supply = <&pm8009_l2>;
         cam_vio-supply = <&pm8009l_l1>;
         cam_vana-supply = <&pm8009l_l5>;
         cam_bob-supply = <&pm8150l_bob>;
         cam_clk-supply = <&tital_top_gdsc>;
         regulator-names = "cam_vio", "cam_vana", "cam_vdig",
                "cam_clk", "cam_bob";
         rgltr-cntrl-support;
         rgltr-min-voltage = <0 3312000 1352000>;
         rgltr-max-voltage = <0 3312000 1352000>;
         rgltr-load-current = <0 80000 105000>;
         pwm-switch;
         rgltr-min-voltage = <0 2800000 1200000 0 3008000>;
         rgltr-max-voltage = <0 2800000 1200000 0 4000000>;
         rgltr-load-current = <0 80000 1200000 0 2000000>;
         gpio-no-mux = <0>;
         pinctrl-names = "cam_default", "cam_suspend";
         pinctrl-0 = <&cam_sensor_mclk0_active
+20 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#include "cam_soc_util.h"
#include "cam_trace.h"


static void cam_sensor_update_req_mgr(
	struct cam_sensor_ctrl_t *s_ctrl,
	struct cam_packet *csl_packet)
@@ -962,6 +961,16 @@ int cam_sensor_power_up(struct cam_sensor_ctrl_t *s_ctrl)
		return -EINVAL;
	}

	if (s_ctrl->bob_pwm_switch) {
		rc = cam_sensor_bob_pwm_mode_switch(soc_info,
			s_ctrl->bob_reg_index, true);
		if (rc) {
			CAM_WARN(CAM_SENSOR,
			"BoB PWM setup failed rc: %d", rc);
			rc = 0;
		}
	}

	rc = cam_sensor_core_power_up(power_info, soc_info);
	if (rc < 0) {
		CAM_ERR(CAM_SENSOR, "power up the core is failed:%d", rc);
@@ -999,6 +1008,16 @@ int cam_sensor_power_down(struct cam_sensor_ctrl_t *s_ctrl)
		return rc;
	}

	if (s_ctrl->bob_pwm_switch) {
		rc = cam_sensor_bob_pwm_mode_switch(soc_info,
			s_ctrl->bob_reg_index, false);
		if (rc) {
			CAM_WARN(CAM_SENSOR,
				"BoB PWM setup failed rc: %d", rc);
			rc = 0;
		}
	}

	camera_io_release(&(s_ctrl->io_master_info));

	return rc;
+4 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ struct intf_params {
 * @device_name: Sensor device structure
 * @streamon_count: Count to hold the number of times stream on called
 * @streamoff_count: Count to hold the number of times stream off called
 * @bob_reg_index: Hold to BoB regulator index
 * @bob_pwm_switch: Boolean flag to switch into PWM mode for BoB regulator
 */
struct cam_sensor_ctrl_t {
	struct platform_device *pdev;
@@ -114,6 +116,8 @@ struct cam_sensor_ctrl_t {
	char device_name[20];
	uint32_t streamon_count;
	uint32_t streamoff_count;
	int bob_reg_index;
	bool bob_pwm_switch;
};

#endif /* _CAM_SENSOR_DEV_H_ */
+28 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ int32_t cam_sensor_get_sub_module_index(struct device_node *of_node,
static int32_t cam_sensor_driver_get_dt_data(struct cam_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;
	int i = 0;
	struct cam_sensor_board_info *sensordata = NULL;
	struct device_node *of_node = s_ctrl->of_node;
	struct cam_hw_soc_info *soc_info = &s_ctrl->soc_info;
@@ -136,6 +137,33 @@ static int32_t cam_sensor_driver_get_dt_data(struct cam_sensor_ctrl_t *s_ctrl)
		goto FREE_SENSOR_DATA;
	}

	/* Store the index of BoB regulator if it is available */
	for (i = 0; i < soc_info->num_rgltr; i++) {
		if (!strcmp(soc_info->rgltr_name[i],
			"cam_bob")) {
			CAM_DBG(CAM_SENSOR,
				"i: %d cam_bob", i);
			s_ctrl->bob_reg_index = 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])) {
				CAM_WARN(CAM_SENSOR,
					"Regulator: %s get failed",
					soc_info->rgltr_name[i]);
				soc_info->rgltr[i] = NULL;
			} else {
				if (!of_property_read_bool(of_node,
					"pwm-switch")) {
					CAM_DBG(CAM_SENSOR,
					"No BoB PWM switch param defined");
					s_ctrl->bob_pwm_switch = false;
				} else {
					s_ctrl->bob_pwm_switch = true;
				}
			}
		}
	}

	/* Read subdev info */
	rc = cam_sensor_get_sub_module_index(of_node, sensordata);
	if (rc < 0) {
+18 −0
Original line number Diff line number Diff line
@@ -1219,6 +1219,24 @@ int msm_camera_pinctrl_init(
	return 0;
}

int cam_sensor_bob_pwm_mode_switch(struct cam_hw_soc_info *soc_info,
	int bob_reg_idx, bool flag)
{
	int rc = 0;
	uint32_t op_current =
		(flag == true) ? soc_info->rgltr_op_mode[bob_reg_idx] : 0;

	if (soc_info->rgltr[bob_reg_idx] != NULL) {
		rc = regulator_set_load(soc_info->rgltr[bob_reg_idx],
			op_current);
		if (rc)
			CAM_WARN(CAM_SENSOR,
				"BoB PWM SetLoad failed rc: %d", rc);
	}

	return rc;
}

int msm_cam_sensor_handle_reg_gpio(int seq_type,
	struct msm_camera_gpio_num_info *gpio_num_info, int val)
{
Loading