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

Commit e8992e20 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Sensor specific I2C speed implementation."

parents cc29c0f3 966118a1
Loading
Loading
Loading
Loading
+56 −36
Original line number Diff line number Diff line
@@ -22,10 +22,13 @@ Required properties:
- clock-rates: clock rate in Hz

Optional properties:
- master0: qcom,cci-master0 - node should contain clock settings for
    cci master 0 bus
- master1: qcom,cci-master1 - node should contain clock settings for
    cci master 1 bus
- i2c_freq_100Khz: qcom,i2c_standard_mode - node should contain clock settings for
    100Khz
- i2c_freq_400Khz: qcom,i2c_fast_mode - node should contain clock settings for
    400Khz
- i2c_freq_custom: qcom,i2c_custom_mode - node can contain clock settings for
    frequencies other than 100Khz and 400Khz which is specific to usecase.
    Currently it has settings for 375Khz.

[Second level nodes]
* Qualcomm CCI clock settings
@@ -212,10 +215,13 @@ Example:
                             "CCI_I2C_CLK0",
                             "CCI_I2C_DATA1",
                             "CCI_I2C_CLK1";
       master0: qcom,cci-master0 {
		i2c_freq_100Khz: qcom,i2c_standard_mode {
			status = "disabled";
		};
       master1: qcom,cci-master1 {
		i2c_freq_400Khz: qcom,i2c_fast_mode {
			status = "disabled";
		};
		i2c_freq_custom: qcom,i2c_custom_mode {
			status = "disabled";
		};

@@ -276,7 +282,7 @@ Example:
       };
   };

   &master0 {
&i2c_freq_100Khz {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
@@ -290,16 +296,30 @@ Example:
	status = "ok";
};

   &master1 {
           qcom,hw-thigh = <78>;
           qcom,hw-tlow = <114>;
           qcom,hw-tsu-sto = <28>;
           qcom,hw-tsu-sta = <28>;
           qcom,hw-thd-dat = <10>;
           qcom,hw-thd-sta = <77>;
           qcom,hw-tbuf = <118>;
&i2c_freq_400Khz {
	qcom,hw-thigh = <20>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <0>;
	qcom,hw-trdhld = <6>;
           qcom,hw-tsp = <1>;
	qcom,hw-tsp = <3>;
	status = "ok";
};

&i2c_freq_custom {
	qcom,hw-thigh = <15>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <1>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <3>;
	status = "ok";
};
+30 −13
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -201,16 +201,19 @@
				      "CCI_I2C_CLK0",
				      "CCI_I2C_DATA1",
				      "CCI_I2C_CLK1";
		master0: qcom,cci-master0 {
		i2c_freq_100Khz: qcom,i2c_standard_mode {
			status = "disabled";
		};
		master1: qcom,cci-master1 {
		i2c_freq_400Khz: qcom,i2c_fast_mode {
			status = "disabled";
		};
		i2c_freq_custom: qcom,i2c_custom_mode {
			status = "disabled";
		};
	};
};

&master0 {
&i2c_freq_100Khz {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
@@ -224,16 +227,30 @@
	status = "ok";
};

&master1 {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
	qcom,hw-tsu-sta = <28>;
	qcom,hw-thd-dat = <10>;
	qcom,hw-thd-sta = <77>;
	qcom,hw-tbuf = <118>;
&i2c_freq_400Khz {
	qcom,hw-thigh = <20>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <0>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <1>;
	qcom,hw-tsp = <3>;
	status = "ok";
};

&i2c_freq_custom {
	qcom,hw-thigh = <15>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <1>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <3>;
	status = "ok";
};
+30 −13
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -132,16 +132,19 @@
		qcom,gpio-tbl-flags = <1 1>;
		qcom,gpio-tbl-label = "CCI_I2C_DATA0",
				      "CCI_I2C_CLK0";
		master0: qcom,cci-master0 {
		i2c_freq_100Khz: qcom,i2c_standard_mode {
			status = "disabled";
		};
		master1: qcom,cci-master1 {
		i2c_freq_400Khz: qcom,i2c_fast_mode {
			status = "disabled";
		};
		i2c_freq_custom: qcom,i2c_custom_mode {
			status = "disabled";
		};
	};
};

&master0 {
&i2c_freq_100Khz {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
@@ -155,16 +158,30 @@
	status = "ok";
};

&master1 {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
	qcom,hw-tsu-sta = <28>;
	qcom,hw-thd-dat = <10>;
	qcom,hw-thd-sta = <77>;
	qcom,hw-tbuf = <118>;
&i2c_freq_400Khz {
	qcom,hw-thigh = <20>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <0>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <1>;
	qcom,hw-tsp = <3>;
	status = "ok";
};

&i2c_freq_custom {
	qcom,hw-thigh = <15>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <1>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <3>;
	status = "ok";
};
+30 −13
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -200,16 +200,19 @@
				      "CCI_I2C_CLK0",
				      "CCI_I2C_DATA1",
				      "CCI_I2C_CLK1";
		master0: qcom,cci-master0 {
		i2c_freq_100Khz: qcom,i2c_standard_mode {
			status = "disabled";
		};
		master1: qcom,cci-master1 {
		i2c_freq_400Khz: qcom,i2c_fast_mode {
			status = "disabled";
		};
		i2c_freq_custom: qcom,i2c_custom_mode {
			status = "disabled";
		};
	};
};

&master0 {
&i2c_freq_100Khz {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
@@ -223,16 +226,30 @@
	status = "ok";
};

&master1 {
	qcom,hw-thigh = <78>;
	qcom,hw-tlow = <114>;
	qcom,hw-tsu-sto = <28>;
	qcom,hw-tsu-sta = <28>;
	qcom,hw-thd-dat = <10>;
	qcom,hw-thd-sta = <77>;
	qcom,hw-tbuf = <118>;
&i2c_freq_400Khz {
	qcom,hw-thigh = <20>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <0>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <1>;
	qcom,hw-tsp = <3>;
	status = "ok";
};

&i2c_freq_custom {
	qcom,hw-thigh = <15>;
	qcom,hw-tlow = <28>;
	qcom,hw-tsu-sto = <21>;
	qcom,hw-tsu-sta = <21>;
	qcom,hw-thd-dat = <13>;
	qcom,hw-thd-sta = <18>;
	qcom,hw-tbuf = <25>;
	qcom,hw-scl-stretch-en = <1>;
	qcom,hw-trdhld = <6>;
	qcom,hw-tsp = <3>;
	status = "ok";
};
+25 −22
Original line number Diff line number Diff line
@@ -538,7 +538,7 @@ static int32_t msm_actuator_set_position(
	return rc;
}

static int32_t msm_actuator_init(struct msm_actuator_ctrl_t *a_ctrl,
static int32_t msm_actuator_set_param(struct msm_actuator_ctrl_t *a_ctrl,
	struct msm_actuator_set_info_t *set_info) {
	struct reg_settings_t *init_settings = NULL;
	int32_t rc = -EFAULT;
@@ -666,6 +666,24 @@ static int32_t msm_actuator_init(struct msm_actuator_ctrl_t *a_ctrl,
	return rc;
}

static int msm_actuator_init(struct msm_actuator_ctrl_t *a_ctrl)
{
	int rc = 0;
	CDBG("Enter\n");
	if (!a_ctrl) {
		pr_err("failed\n");
		return -EINVAL;
	}
	if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE) {
		rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_util(
			&a_ctrl->i2c_client, MSM_CCI_INIT);
		if (rc < 0)
			pr_err("cci_init failed\n");
	}
	CDBG("Exit\n");
	return rc;
}

static int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
	void __user *argp)
{
@@ -676,13 +694,18 @@ static int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
	CDBG("Enter\n");
	CDBG("%s type %d\n", __func__, cdata->cfgtype);
	switch (cdata->cfgtype) {
	case CFG_ACTUATOR_INIT:
		rc = msm_actuator_init(a_ctrl);
		if (rc < 0)
			pr_err("msm_actuator_init failed %d\n", rc);
		break;
	case CFG_GET_ACTUATOR_INFO:
		cdata->is_af_supported = 1;
		cdata->cfg.cam_name = a_ctrl->cam_name;
		break;

	case CFG_SET_ACTUATOR_INFO:
		rc = msm_actuator_init(a_ctrl, &cdata->cfg.set_info);
		rc = msm_actuator_set_param(a_ctrl, &cdata->cfg.set_info);
		if (rc < 0)
			pr_err("init table failed %d\n", rc);
		break;
@@ -769,25 +792,6 @@ static struct msm_camera_i2c_fn_t msm_sensor_qup_func_tbl = {
	.i2c_poll = msm_camera_qup_i2c_poll,
};

static int msm_actuator_open(struct v4l2_subdev *sd,
	struct v4l2_subdev_fh *fh) {
	int rc = 0;
	struct msm_actuator_ctrl_t *a_ctrl =  v4l2_get_subdevdata(sd);
	CDBG("Enter\n");
	if (!a_ctrl) {
		pr_err("failed\n");
		return -EINVAL;
	}
	if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE) {
		rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_util(
			&a_ctrl->i2c_client, MSM_CCI_INIT);
		if (rc < 0)
			pr_err("cci_init failed\n");
	}
	CDBG("Exit\n");
	return rc;
}

static int msm_actuator_close(struct v4l2_subdev *sd,
	struct v4l2_subdev_fh *fh) {
	int rc = 0;
@@ -811,7 +815,6 @@ static int msm_actuator_close(struct v4l2_subdev *sd,
}

static const struct v4l2_subdev_internal_ops msm_actuator_internal_ops = {
	.open = msm_actuator_open,
	.close = msm_actuator_close,
};

Loading