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

Commit edc952b2 authored by Jigarkumar Zala's avatar Jigarkumar Zala Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Add reading cci device index from parent node



Subdev node define under cci node can read cci index from parent.
This cci index number is needed for cci framework to pick correct
hardware.

Change-Id: Ic6a45b3dc6f4f7d49a96bef337c54998d815129a
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent 504854af
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/of.h>
@@ -21,6 +21,7 @@ int32_t cam_actuator_parse_dt(struct cam_actuator_ctrl_t *a_ctrl,
		(struct cam_actuator_soc_private *)a_ctrl->soc_info.soc_private;
	struct cam_sensor_power_ctrl_t  *power_info = &soc_private->power_info;
	struct device_node              *of_node = NULL;
	struct device_node              *of_parent = NULL;

	/* Initialize mutex */
	mutex_init(&(a_ctrl->actuator_mutex));
@@ -46,16 +47,13 @@ int32_t cam_actuator_parse_dt(struct cam_actuator_ctrl_t *a_ctrl,
			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) {
		of_parent = of_get_parent(of_node);
		if (of_property_read_u32(of_parent, "cci-device",
				&a_ctrl->cci_num) < 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;
		CAM_DBG(CAM_ACTUATOR, "cci-device %d", a_ctrl->cci_num);
	}

	if (!soc_info->gpio_data) {
+6 −7
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ int cam_eeprom_parse_dt(struct cam_eeprom_ctrl_t *e_ctrl)
	int                             i, rc = 0;
	struct cam_hw_soc_info         *soc_info = &e_ctrl->soc_info;
	struct device_node             *of_node = NULL;
	struct device_node             *of_parent = NULL;
	struct cam_eeprom_soc_private  *soc_private =
		(struct cam_eeprom_soc_private *)e_ctrl->soc_info.soc_private;
	uint32_t                        temp;
@@ -324,16 +325,14 @@ int cam_eeprom_parse_dt(struct cam_eeprom_ctrl_t *e_ctrl)
			return rc;
		}

		rc = of_property_read_u32(of_node, "cci-device",
			&e_ctrl->cci_num);
		CAM_DBG(CAM_ACTUATOR, "cci-device %d, rc %d",
			e_ctrl->cci_num, rc);
		if (rc < 0) {
		of_parent = of_get_parent(of_node);
		if (of_property_read_u32(of_parent, "cell-index",
				&e_ctrl->cci_num) < 0)
			/* Set default master 0 */
			e_ctrl->cci_num = CCI_DEVICE_0;
			rc = 0;
		}

		e_ctrl->io_master_info.cci_client->cci_device = e_ctrl->cci_num;
		CAM_DBG(CAM_EEPROM, "cci-index %d", e_ctrl->cci_num, rc);
	}

	if (e_ctrl->io_master_info.master_type == SPI_MASTER) {
+12 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -103,7 +103,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
		}

		if (fctrl->bridge_intf.link_hdl != -1) {
			CAM_ERR(CAM_SENSOR,
			CAM_ERR(CAM_FLASH,
				"Device [%d] still active on link 0x%x",
				fctrl->flash_state,
				fctrl->bridge_intf.link_hdl);
@@ -399,6 +399,7 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev)
{
	int32_t rc = 0, i = 0;
	struct cam_flash_ctrl *fctrl = NULL;
	struct device_node *of_parent = NULL;

	CAM_DBG(CAM_FLASH, "Enter");
	if (!pdev->dev.of_node) {
@@ -445,6 +446,15 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev)
			return rc;
		}

		of_parent = of_get_parent(pdev->dev.of_node);
		if (of_property_read_u32(of_parent, "cell-index",
				&fctrl->cci_num) < 0)
		/* Set default master 0 */
			fctrl->cci_num = CCI_DEVICE_0;

		fctrl->io_master_info.cci_client->cci_device = fctrl->cci_num;
		CAM_DBG(CAM_FLASH, "cci-index %d", fctrl->cci_num, rc);

		fctrl->i2c_data.per_frame =
			kzalloc(sizeof(struct i2c_settings_array) *
			MAX_PER_FRAME_ARRAY, GFP_KERNEL);
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_FLASH_DEV_H_
@@ -173,6 +173,7 @@ struct cam_flash_func_tbl {
 * @flash_trigger       : Flash trigger ptr
 * @torch_trigger       : Torch trigger ptr
 * @cci_i2c_master      : I2C structure
 * @cci_device_num      : cci parent cell index
 * @io_master_info      : Information about the communication master
 * @i2c_data            : I2C register settings
 * @last_flush_req      : last request to flush
@@ -199,6 +200,7 @@ struct cam_flash_ctrl {
	struct led_trigger           *torch_trigger[CAM_FLASH_MAX_LED_TRIGGERS];
/* I2C related setting */
	enum   cci_i2c_master_t             cci_i2c_master;
	enum   cci_device_num               cci_num;
	struct camera_io_master             io_master_info;
	struct i2c_data_settings            i2c_data;
	uint32_t                            last_flush_req;
+8 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/of.h>
@@ -82,6 +82,7 @@ int cam_ois_driver_soc_init(struct cam_ois_ctrl_t *o_ctrl)
	int                             rc = 0;
	struct cam_hw_soc_info         *soc_info = &o_ctrl->soc_info;
	struct device_node             *of_node = NULL;
	struct device_node             *of_parent = NULL;

	if (!soc_info->dev) {
		CAM_ERR(CAM_OIS, "soc_info is not initialized");
@@ -102,16 +103,15 @@ int cam_ois_driver_soc_init(struct cam_ois_ctrl_t *o_ctrl)
			return rc;
		}

		rc = of_property_read_u32(of_node, "cci-device",
			&o_ctrl->cci_num);
		CAM_DBG(CAM_ACTUATOR, "cci-device %d, rc %d",
			o_ctrl->cci_num, rc);
		if (rc < 0) {
		of_parent = of_get_parent(of_node);
		if (of_property_read_u32(of_parent, "cell-index",
				&o_ctrl->cci_num) < 0)
			/* Set default master 0 */
			o_ctrl->cci_num = CCI_DEVICE_0;
			rc = 0;
		}

		o_ctrl->io_master_info.cci_client->cci_device = o_ctrl->cci_num;
		CAM_DBG(CAM_OIS, "cci-device %d", o_ctrl->cci_num, rc);

	}

	rc = cam_ois_get_dt_data(o_ctrl);
Loading