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

Commit a7cf31ce authored by Vasko Kalanoski's avatar Vasko Kalanoski
Browse files

msm: camera: kernel driver for OIS



Add support to driver OIS in kernel.

Change-Id: I059b077d5d8873d516015134324e655a93ddfe55
Signed-off-by: default avatarVasko Kalanoski <vaskok@codeaurora.org>
parent b91baddb
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -162,6 +162,8 @@ Optional properties:
- qcom,vdd-cx-name : should contain names of cx regulator
- qcom,eeprom-src : if eeprom memory is supported by this sensor, this
   property should contain phandle of respective eeprom nodes
- qcom,ois-src : if optical image stabilization is supported by this sensor,
   this property should contain phandle of respective ois node

* Qualcomm MSM ACTUATOR

@@ -190,6 +192,33 @@ Optional properties:
   (in the same order).
- cam_vaf-supply : should contain regulator from which AF voltage is supplied

* Qualcomm MSM OIS

Required properties:
- cell-index : should contain unique identifier to differentiate
    between multiple ois drivers
- reg : should contain i2c slave address of the ois and length of
    data field which is 0x0
- compatible :
    - "qcom,ois"
- qcom,cci-master : should contain i2c master id to be used for this camera
    sensor
    - 0 -> MASTER 0
    - 1 -> MASTER 1

Optional properties:
- qcom,cam-vreg-name : should contain names of all regulators needed by this
    ois
    - "cam_vaf"
- qcom,cam-vreg-min-voltage : should contain minimum voltage level in mcrovolts
   for regulators mentioned in qcom,cam-vreg-name property (in the same order)
- qcom,cam-vreg-max-voltage : should contain maximum voltage level in mcrovolts
   for regulators mentioned in qcom,cam-vreg-name property (in the same order)
- qcom,cam-vreg-op-mode : should contain the maximum current in microamps
   required from the regulators mentioned in the qcom,cam-vreg-name property
   (in the same order).
- cam_vaf-supply : should contain regulator from which ois voltage is supplied

Example:

   qcom,cci@0xfda0c000 {
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ ccflags-y += -Idrivers/media/platform/msm/camera_v2/msm_vb2
ccflags-y += -Idrivers/media/platform/msm/camera_v2/camera
ccflags-y += -Idrivers/media/platform/msm/camera_v2/sensor/io
ccflags-y += -Idrivers/media/platform/msm/camera_v2/sensor/cci
obj-$(CONFIG_MSMB_CAMERA) += cci/ io/ csiphy/ csid/ actuator/ flash/ eeprom/
obj-$(CONFIG_MSMB_CAMERA) += cci/ io/ csiphy/ csid/ actuator/ flash/ eeprom/ ois/
obj-$(CONFIG_MSM_CAMERA_SENSOR) += msm_sensor_init.o msm_sensor_driver.o msm_sensor.o
obj-$(CONFIG_IMX132) += imx132.o
obj-$(CONFIG_IMX134) += imx134.o
+16 −0
Original line number Diff line number Diff line
@@ -134,6 +134,22 @@ int msm_sensor_get_sub_module_index(struct device_node *of_node,
		src_node = NULL;
	}

	src_node = of_parse_phandle(of_node, "qcom,ois-src", 0);
	if (!src_node) {
		CDBG("%s:%d src_node NULL\n", __func__, __LINE__);
	} else {
		rc = of_property_read_u32(src_node, "cell-index", &val);
		CDBG("%s qcom,ois cell index %d, rc %d\n", __func__,
			val, rc);
		if (rc < 0) {
			pr_err("%s failed %d\n", __func__, __LINE__);
			goto ERROR;
		}
		sensor_info->subdev_id[SUB_MODULE_OIS] = val;
		of_node_put(src_node);
		src_node = NULL;
	}

	src_node = of_parse_phandle(of_node, "qcom,eeprom-src", 0);
	if (!src_node) {
		CDBG("%s:%d eeprom src_node NULL\n", __func__, __LINE__);
+46 −1
Original line number Diff line number Diff line
@@ -267,6 +267,46 @@ static int32_t msm_sensor_fill_actuator_subdevid_by_name(
	return rc;
}

static int32_t msm_sensor_fill_ois_subdevid_by_name(
				struct msm_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;
	struct device_node *src_node = NULL;
	uint32_t val = 0;
	int32_t *ois_subdev_id;
	struct  msm_sensor_info_t *sensor_info;
	struct device_node *of_node = s_ctrl->of_node;

	if (!of_node)
		return -EINVAL;

	sensor_info = s_ctrl->sensordata->sensor_info;
	ois_subdev_id = &sensor_info->subdev_id[SUB_MODULE_OIS];
	/*
	 * string for ois name is valid, set sudev id to -1
	 * and try to found new id
	 */
	*ois_subdev_id = -1;

	src_node = of_parse_phandle(of_node, "qcom,ois-src", 0);
	if (!src_node) {
		CDBG("%s:%d src_node NULL\n", __func__, __LINE__);
	} else {
		rc = of_property_read_u32(src_node, "cell-index", &val);
		CDBG("%s qcom,ois cell index %d, rc %d\n", __func__,
			val, rc);
		if (rc < 0) {
			pr_err("%s failed %d\n", __func__, __LINE__);
			return -EINVAL;
		}
		*ois_subdev_id = val;
		of_node_put(src_node);
		src_node = NULL;
	}

	return rc;
}

static int32_t msm_sensor_fill_slave_info_init_params(
	struct msm_camera_sensor_slave_info *slave_info,
	struct msm_sensor_info_t *sensor_info)
@@ -698,7 +738,6 @@ int32_t msm_sensor_driver_probe(void *setting)
	s_ctrl->sensordata->sensor_name = slave_info->sensor_name;
	s_ctrl->sensordata->eeprom_name = slave_info->eeprom_name;
	s_ctrl->sensordata->actuator_name = slave_info->actuator_name;

	/*
	 * Update eeporm subdevice Id by input eeprom name
	 */
@@ -716,6 +755,12 @@ int32_t msm_sensor_driver_probe(void *setting)
		goto FREE_CAMERA_INFO;
	}

	rc = msm_sensor_fill_ois_subdevid_by_name(s_ctrl);
	if (rc < 0) {
		pr_err("%s failed %d\n", __func__, __LINE__);
		goto FREE_CAMERA_INFO;
	}

	/* Power up and probe sensor */
	rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
	if (rc < 0) {
+4 −0
Original line number Diff line number Diff line
ccflags-y += -Idrivers/media/platform/msm/camera_v2
ccflags-y += -Idrivers/media/platform/msm/camera_v2/sensor/io
ccflags-y += -Idrivers/media/platform/msm/camera_v2/sensor/cci
obj-$(CONFIG_MSMB_CAMERA) += msm_ois.o
Loading