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

Commit ad88a13b 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: Add support for multiple CCI devices" into msm-4.14

parents ad4e066b 9719862b
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -286,6 +286,12 @@ Image sensor node contains properties of camera image sensor
	for the device for the cci operating in
	compatible mode.

- cci-device
  Usage: required
  Value type: <u32>
  Definition: should contain i2c device id to be used for this camera
	sensor

- cci-master
  Usage: required
  Value type: <u32>
@@ -568,6 +574,12 @@ ACTUATOR MODULE
	for the device for the cci operating in
	compatible mode.

- cci-device
  Usage: required
  Value type: <u32>
  Definition: should contain i2c device id to be used for this camera
	sensor

- cci-master
  Usage: required
  Value type: <u32>
@@ -633,6 +645,12 @@ OIS MODULE
	for the device for the cci operating in
	compatible mode.

- cci-device
  Usage: required
  Value type: <u32>
  Definition: should contain i2c device id to be used for this camera
	sensor

- cci-master
  Usage: required
  Value type: <u32>
@@ -700,6 +718,7 @@ Example:
         cell-index = <0>;
         reg = <0x0>;
         compatible = "qcom,actuator";
         cci-device = <0>;
         cci-master = <0>;
         cam_vaf-supply = <&pmi8998_bob>;
         regulator-names = "cam_vaf";
@@ -713,6 +732,7 @@ Example:
         cell-index = <0>;
         reg = <0x0>;
         compatible = "qcom,ois";
         cci-device = <0>;
         cci-master = <0>;
         cam_vaf-supply = <&pmi8998_bob>;
         regulator-names = "cam_vaf";
@@ -770,6 +790,7 @@ Example:
                         "CAM_VANA";
         sensor-position = <0>;
         sensor-mode = <0>;
         cci-device = <0>;
         cci-master = <0>;
         status = "ok";
         use-shared-clk;
+14 −0
Original line number Diff line number Diff line
@@ -104,6 +104,12 @@ First Level Node - CAM EEPROM device
  Value type: <u32>
  Definition: should contain the mount angle of the camera sensor.

- cci-device
  Usage: required
  Value type: <u32>
  Definition: should contain i2c device id to be used for this camera
	sensor

- cci-master
  Usage: required
  Value type: <u32>
@@ -161,6 +167,7 @@ Example:
			"CAM_STANDBY";
		sensor-position = <0>;
		sensor-mode = <0>;
		cci-device = <0>;
		cci-master = <0>;
		status = "ok";
		clocks = <&clock_camcc CAM_CC_MCLK0_CLK>;
@@ -388,6 +395,12 @@ First Level Node - CAM EEPROM device
  Value type: <u32>
  Definition: should contain the mount angle of the camera sensor.

- cci-device
  Usage: required
  Value type: <u32>
  Definition: should contain i2c device id to be used for this camera
	sensor

- cci-master
  Usage: required
  Value type: <u32>
@@ -480,6 +493,7 @@ Example:
			"CAM_STANDBY";
		sensor-position = <0>;
		sensor-mode = <0>;
		cci-device = <0>;
		cci-master = <0>;
		status = "ok";
		clocks = <&clock_camcc CAM_CC_MCLK0_CLK>;
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ struct intf_params {
struct cam_actuator_ctrl_t {
	struct i2c_driver *i2c_driver;
	enum cci_i2c_master_t cci_i2c_master;
	enum cci_device_num cci_num;
	struct camera_io_master io_master_info;
	struct cam_hw_soc_info soc_info;
	struct mutex actuator_mutex;
+11 −0
Original line number Diff line number Diff line
@@ -52,6 +52,17 @@ int32_t cam_actuator_parse_dt(struct cam_actuator_ctrl_t *a_ctrl,
			rc = -EFAULT;
			return rc;
		}

		rc = of_property_read_u32(of_node, "cci-device",
			&a_ctrl->cci_num);
		CAM_DBG(CAM_ACTUATOR, "cci-device %d, rc %d",
			a_ctrl->cci_num, rc);
		if (rc < 0) {
			/* Set default master 0 */
			a_ctrl->cci_num = CCI_DEVICE_0;
			rc = 0;
		}
		a_ctrl->io_master_info.cci_client->cci_device = a_ctrl->cci_num;
	}

	if (!soc_info->gpio_data) {
+26 −11
Original line number Diff line number Diff line
@@ -18,11 +18,13 @@
#define CCI_MAX_DELAY 1000000
#define CCI_TIMEOUT msecs_to_jiffies(500)

static struct v4l2_subdev *g_cci_subdev;
static struct v4l2_subdev *g_cci_subdev[MAX_CCI];

struct v4l2_subdev *cam_cci_get_subdev(void)
struct v4l2_subdev *cam_cci_get_subdev(int cci_dev_index)
{
	return g_cci_subdev;
	if (cci_dev_index < MAX_CCI)
		return g_cci_subdev[cci_dev_index];
	return NULL;
}

static long cam_cci_subdev_ioctl(struct v4l2_subdev *sd,
@@ -289,7 +291,14 @@ static int cam_cci_platform_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, &(new_cci_dev->v4l2_dev_str.sd));
	v4l2_set_subdevdata(&new_cci_dev->v4l2_dev_str.sd, new_cci_dev);
	g_cci_subdev = &new_cci_dev->v4l2_dev_str.sd;
	if (soc_info->index >= MAX_CCI) {
		CAM_ERR(CAM_CCI, "Invalid index: %d max supported:%d",
			soc_info->index, MAX_CCI-1);
		goto cci_no_resource;
	}

	g_cci_subdev[soc_info->index] = &new_cci_dev->v4l2_dev_str.sd;
	CAM_ERR(CAM_CCI, "Device Type :%d", soc_info->index);

	cam_register_subdev_fops(&cci_v4l2_subdev_fops);
	cci_v4l2_subdev_fops.unlocked_ioctl = cam_cci_subdev_fops_ioctl;
@@ -350,14 +359,20 @@ static struct platform_driver cci_driver = {
static int cam_cci_assign_fops(void)
{
	struct v4l2_subdev *sd;
	int i = 0;

	sd = g_cci_subdev;
	if (!sd || !(sd->devnode)) {
		CAM_ERR(CAM_CRM,
			"Invalid args sd node: %pK", sd);
	for (; i < MAX_CCI; i++) {
		sd = g_cci_subdev[i];
		if (!sd)
			return 0;
		if (!(sd->devnode)) {
			CAM_ERR(CAM_CCI,
			"Invalid dev node:%pK offset: %d",
			sd->devnode, i);
			return -EINVAL;
		}
		sd->devnode->fops = &cci_v4l2_subdev_fops;
	}

	return 0;
}
Loading