Selaa lähdekoodia

msm: camera: sensor: Don't print CCI error log during probing

Since the CCI error isn't fatal error during probing sensor,
so we can just print an info log for the CCI error.

CRs-Fixed: 3118450
Change-Id: Ie980c9eb37e410b07c434a7a304ab1c18925319b
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 3 vuotta sitten
vanhempi
sitoutus
4b560cae54

+ 24 - 6
drivers/cam_sensor_module/cam_cci/cam_cci_core.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/module.h>
@@ -1421,8 +1422,14 @@ static int32_t cam_cci_read(struct v4l2_subdev *sd,
 	}
 
 	if (cci_dev->cci_master_info[master].status) {
-		CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d_Q%d ERROR with Slave 0x%x",
-			cci_dev->soc_info.index, master, queue, (c_ctrl->cci_info->sid << 1));
+		if (cci_dev->is_probing)
+			CAM_INFO(CAM_CCI, "CCI%d_I2C_M%d_Q%d ERROR with Slave 0x%x",
+				cci_dev->soc_info.index, master, queue,
+				(c_ctrl->cci_info->sid << 1));
+		else
+			CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d_Q%d ERROR with Slave 0x%x",
+				cci_dev->soc_info.index, master, queue,
+				(c_ctrl->cci_info->sid << 1));
 		rc = -EINVAL;
 		cci_dev->cci_master_info[master].status = 0;
 		goto rel_mutex_q;
@@ -1686,8 +1693,12 @@ static int32_t cam_cci_read_bytes_v_1_2(struct v4l2_subdev *sd,
 		cci_dev->is_burst_read[master] = false;
 		rc = cam_cci_read(sd, c_ctrl);
 		if (rc) {
-			CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d failed to read rc: %d",
-				cci_dev->soc_info.index, master, rc);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI, "CCI%d_I2C_M%d failed to read rc: %d",
+					cci_dev->soc_info.index, master, rc);
+			else
+				CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d failed to read rc: %d",
+					cci_dev->soc_info.index, master, rc);
 			goto ERROR;
 		}
 
@@ -1739,6 +1750,8 @@ static int32_t cam_cci_read_bytes(struct v4l2_subdev *sd,
 		return -EINVAL;
 	}
 
+	cci_dev->is_probing = c_ctrl->is_probing;
+
 	master = c_ctrl->cci_info->cci_i2c_master;
 	read_cfg = &c_ctrl->cfg.cci_i2c_read_cfg;
 	if ((!read_cfg->num_byte) || (read_cfg->num_byte > CCI_I2C_MAX_READ)) {
@@ -1774,8 +1787,12 @@ static int32_t cam_cci_read_bytes(struct v4l2_subdev *sd,
 			rc = cam_cci_read(sd, c_ctrl);
 		}
 		if (rc) {
-			CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d Failed to read rc:%d",
-				cci_dev->soc_info.index, master, rc);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI, "CCI%d_I2C_M%d Failed to read rc:%d",
+					cci_dev->soc_info.index, master, rc);
+			else
+				CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d Failed to read rc:%d",
+					cci_dev->soc_info.index, master, rc);
 			goto ERROR;
 		}
 
@@ -1925,6 +1942,7 @@ int32_t cam_cci_core_cfg(struct v4l2_subdev *sd,
 		CAM_WARN(CAM_CCI, "CCI hardware is resetting");
 		return -EAGAIN;
 	}
+	cci_dev->is_probing = false;
 	CAM_DBG(CAM_CCI, "CCI%d_I2C_M%d cmd = %d", cci_dev->soc_info.index, master, cci_ctrl->cmd);
 
 	switch (cci_ctrl->cmd) {

+ 33 - 12
drivers/cam_sensor_module/cam_cci/cam_cci_dev.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "cam_cci_dev.h"
@@ -289,18 +290,28 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
 	if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M0_ERROR_BMSK) {
 		cci_dev->cci_master_info[MASTER_0].status = -EINVAL;
 		if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M0_Q0_NACK_ERROR_BMSK) {
-			CAM_ERR(CAM_CCI,
-				"Base:%pK,cci: %d, M0_Q0 NACK ERROR: 0x%x",
-				base, cci_dev->soc_info.index, irq_status0);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI,
+					"Base:%pK,cci: %d, M0_Q0 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
+			else
+				CAM_ERR(CAM_CCI,
+					"Base:%pK,cci: %d, M0_Q0 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
 			cam_cci_dump_registers(cci_dev, MASTER_0,
 					QUEUE_0);
 			complete_all(&cci_dev->cci_master_info[MASTER_0]
 				.report_q[QUEUE_0]);
 		}
 		if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M0_Q1_NACK_ERROR_BMSK) {
-			CAM_ERR(CAM_CCI,
-				"Base:%pK,cci: %d, M0_Q1 NACK ERROR: 0x%x",
-				base, cci_dev->soc_info.index, irq_status0);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI,
+					"Base:%pK,cci: %d, M0_Q1 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
+			else
+				CAM_ERR(CAM_CCI,
+					"Base:%pK,cci: %d, M0_Q1 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
 			cam_cci_dump_registers(cci_dev, MASTER_0,
 					QUEUE_1);
 			complete_all(&cci_dev->cci_master_info[MASTER_0]
@@ -321,18 +332,28 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
 	if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M1_ERROR_BMSK) {
 		cci_dev->cci_master_info[MASTER_1].status = -EINVAL;
 		if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M1_Q0_NACK_ERROR_BMSK) {
-			CAM_ERR(CAM_CCI,
-				"Base:%pK, cci: %d, M1_Q0 NACK ERROR: 0x%x",
-				base, cci_dev->soc_info.index, irq_status0);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI,
+					"Base:%pK, cci: %d, M1_Q0 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
+			else
+				CAM_ERR(CAM_CCI,
+					"Base:%pK, cci: %d, M1_Q0 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
 			cam_cci_dump_registers(cci_dev, MASTER_1,
 					QUEUE_0);
 			complete_all(&cci_dev->cci_master_info[MASTER_1]
 			.report_q[QUEUE_0]);
 		}
 		if (irq_status0 & CCI_IRQ_STATUS_0_I2C_M1_Q1_NACK_ERROR_BMSK) {
-			CAM_ERR(CAM_CCI,
-				"Base:%pK, cci: %d, M1_Q1 NACK ERROR: 0x%x",
-				base, cci_dev->soc_info.index, irq_status0);
+			if (cci_dev->is_probing)
+				CAM_INFO(CAM_CCI,
+					"Base:%pK, cci: %d, M1_Q1 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
+			else
+				CAM_ERR(CAM_CCI,
+					"Base:%pK, cci: %d, M1_Q1 NACK ERROR: 0x%x",
+					base, cci_dev->soc_info.index, irq_status0);
 			cam_cci_dump_registers(cci_dev, MASTER_1,
 				QUEUE_1);
 			complete_all(&cci_dev->cci_master_info[MASTER_1]

+ 5 - 0
drivers/cam_sensor_module/cam_cci/cam_cci_dev.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _CAM_CCI_DEV_H_
@@ -200,6 +201,7 @@ enum cam_cci_state_t {
  * @init_mutex:                 Mutex for maintaining refcount for attached
  *                              devices to cci during init/deinit.
  * @dump_en:                    To enable the selective dump
+ * @is_probing:                 Flag to determine if we are probing a sensor
  */
 struct cci_device {
 	struct v4l2_subdev subdev;
@@ -231,6 +233,7 @@ struct cci_device {
 	uint32_t irqs_disabled;
 	struct mutex init_mutex;
 	uint64_t  dump_en;
+	bool is_probing;
 };
 
 enum cam_cci_i2c_cmd_type {
@@ -277,6 +280,7 @@ struct cam_sensor_cci_client {
 	uint16_t retries;
 	uint16_t id_map;
 	uint16_t cci_device;
+	bool is_probing;
 };
 
 struct cam_cci_ctrl {
@@ -289,6 +293,7 @@ struct cam_cci_ctrl {
 		struct cam_cci_wait_sync_cfg cci_wait_sync_cfg;
 		struct cam_cci_gpio_cfg gpio_cfg;
 	} cfg;
+	bool is_probing;
 };
 
 struct cci_write_async {

+ 2 - 2
drivers/cam_sensor_module/cam_sensor/cam_sensor_core.c

@@ -735,7 +735,7 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
 		&(s_ctrl->io_master_info),
 		slave_info->sensor_id_reg_addr,
 		&chipid, CAMERA_SENSOR_I2C_TYPE_WORD,
-		CAMERA_SENSOR_I2C_TYPE_WORD);
+		CAMERA_SENSOR_I2C_TYPE_WORD, true);
 
 	CAM_DBG(CAM_SENSOR, "%s read id: 0x%x expected id 0x%x:",
 		s_ctrl->sensor_name, chipid, slave_info->sensor_id);
@@ -836,7 +836,7 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 		/* Match sensor ID */
 		rc = cam_sensor_match_id(s_ctrl);
 		if (rc < 0) {
-			CAM_ERR(CAM_SENSOR,
+			CAM_INFO(CAM_SENSOR,
 				"Probe failed for %s slot:%d, slave_addr:0x%x, sensor_id:0x%x",
 				s_ctrl->sensor_name,
 				s_ctrl->soc_info.index,

+ 1 - 1
drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c

@@ -55,7 +55,7 @@ static long cam_sensor_subdev_ioctl(struct v4l2_subdev *sd,
 			if (rc == -EBADR)
 				CAM_INFO(CAM_SENSOR,
 					"Failed in Driver cmd: %d, it has been flushed", rc);
-			else
+			else if (rc != -ENODEV)
 				CAM_ERR(CAM_SENSOR,
 					"Failed in Driver cmd: %d", rc);
 		}

+ 9 - 3
drivers/cam_sensor_module/cam_sensor_io/cam_sensor_cci_i2c.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2017-2018, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "cam_sensor_cmn_header.h"
@@ -10,7 +11,8 @@
 int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *cci_client,
 	uint32_t addr, uint32_t *data,
 	enum camera_sensor_i2c_type addr_type,
-	enum camera_sensor_i2c_type data_type)
+	enum camera_sensor_i2c_type data_type,
+	bool is_probing)
 {
 	int32_t rc = -EINVAL;
 	unsigned char buf[CAMERA_SENSOR_I2C_TYPE_DWORD];
@@ -22,6 +24,7 @@ int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *cci_client,
 		|| data_type >= CAMERA_SENSOR_I2C_TYPE_MAX)
 		return rc;
 
+	cci_ctrl.is_probing = is_probing;
 	cci_ctrl.cmd = MSM_CCI_I2C_READ;
 	cci_ctrl.cci_info = cci_client;
 	cci_ctrl.cfg.cci_i2c_read_cfg.addr = addr;
@@ -32,7 +35,10 @@ int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *cci_client,
 	rc = v4l2_subdev_call(cci_client->cci_subdev,
 		core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
 	if (rc < 0) {
-		CAM_ERR(CAM_SENSOR, "rc = %d", rc);
+		if (is_probing)
+			CAM_INFO(CAM_SENSOR, "rc = %d", rc);
+		else
+			CAM_ERR(CAM_SENSOR, "rc = %d", rc);
 		return rc;
 	}
 
@@ -168,7 +174,7 @@ static int32_t cam_cci_i2c_compare(struct cam_sensor_cci_client *client,
 	uint32_t reg_data = 0;
 
 	rc = cam_cci_i2c_read(client, addr, &reg_data,
-		addr_type, data_type);
+		addr_type, data_type, false);
 	if (rc < 0)
 		return rc;
 

+ 4 - 1
drivers/cam_sensor_module/cam_sensor_io/cam_sensor_i2c.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _CAM_SENSOR_I2C_H_
@@ -25,13 +26,15 @@
  * @data: I2C data
  * @addr_type: I2c address type
  * @data_type: I2C data type
+ * @is_probing: Is probing a sensor
  *
  * This API handles CCI read
  */
 int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *client,
 	uint32_t addr, uint32_t *data,
 	enum camera_sensor_i2c_type addr_type,
-	enum camera_sensor_i2c_type data_type);
+	enum camera_sensor_i2c_type data_type,
+	bool is_probing);
 
 /**
  * @client: CCI client structure

+ 4 - 2
drivers/cam_sensor_module/cam_sensor_io/cam_sensor_io.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "cam_sensor_io.h"
@@ -66,7 +67,8 @@ int32_t camera_io_dev_erase(struct camera_io_master *io_master_info,
 int32_t camera_io_dev_read(struct camera_io_master *io_master_info,
 	uint32_t addr, uint32_t *data,
 	enum camera_sensor_i2c_type addr_type,
-	enum camera_sensor_i2c_type data_type)
+	enum camera_sensor_i2c_type data_type,
+	bool is_probing)
 {
 	if (!io_master_info) {
 		CAM_ERR(CAM_SENSOR, "Invalid Args");
@@ -75,7 +77,7 @@ int32_t camera_io_dev_read(struct camera_io_master *io_master_info,
 
 	if (io_master_info->master_type == CCI_MASTER) {
 		return cam_cci_i2c_read(io_master_info->cci_client,
-			addr, data, addr_type, data_type);
+			addr, data, addr_type, data_type, is_probing);
 	} else if (io_master_info->master_type == I2C_MASTER) {
 		return cam_qup_i2c_read(io_master_info->client,
 			addr, data, addr_type, data_type);

+ 4 - 1
drivers/cam_sensor_module/cam_sensor_io/cam_sensor_io.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _CAM_SENSOR_IO_H_
@@ -33,13 +34,15 @@ struct camera_io_master {
  * @data: I2C data
  * @addr_type: I2C addr_type
  * @data_type: I2C data type
+ * @is_probing: Is probing a sensor
  *
  * This API abstracts read functionality based on master type
  */
 int32_t camera_io_dev_read(struct camera_io_master *io_master_info,
 	uint32_t addr, uint32_t *data,
 	enum camera_sensor_i2c_type addr_type,
-	enum camera_sensor_i2c_type data_type);
+	enum camera_sensor_i2c_type data_type,
+	bool is_probing);
 
 /**
  * @io_master_info: I2C/SPI master information

+ 3 - 1
drivers/cam_sensor_module/cam_sensor_utils/cam_sensor_util.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/kernel.h>
@@ -912,7 +913,8 @@ int32_t cam_sensor_i2c_read_data(
 					reg_setting->reg_addr,
 					&reg_setting->reg_data,
 					i2c_list->i2c_settings.addr_type,
-					i2c_list->i2c_settings.data_type);
+					i2c_list->i2c_settings.data_type,
+					false);
 				if (rc < 0) {
 					CAM_ERR(CAM_SENSOR,
 					"Failed: random read I2C settings: %d",