Browse Source

msm: camera: common: logging improvement

After flushed, KMD reports ERR including isp, actuator, sensor, flash.
However many CRs don't have fatal KMD error log, but participant is KMD.
Remove the non-fatal KMD error log.

CRs-Fixed: 3095401
Change-Id: I0e5e370c0c4d1daceb72d9eed8d0c45baad5179e
Signed-off-by: Wang Kan <[email protected]>
Wang Kan 3 years ago
parent
commit
df174ddd8a

+ 3 - 2
drivers/cam_core/cam_context.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/slab.h>
@@ -227,7 +228,7 @@ int cam_context_handle_crm_flush_req(struct cam_context *ctx,
 			rc = ctx->state_machine[ctx->state].crm_ops.flush_req(ctx,
 				flush);
 		} else {
-			CAM_ERR(CAM_CORE, "No crm flush req in dev %d, state %d, name %s",
+			CAM_INFO(CAM_CORE, "No crm flush req in dev %d, state %d, name %s",
 				ctx->dev_hdl, ctx->state, ctx->dev_name);
 			rc = -EPROTO;
 		}
@@ -513,7 +514,7 @@ int cam_context_handle_config_dev(struct cam_context *ctx,
 		rc = ctx->state_machine[ctx->state].ioctl_ops.config_dev(
 			ctx, cmd);
 	} else {
-		CAM_ERR(CAM_CORE, "No config device in dev %d, state %d",
+		CAM_INFO(CAM_CORE, "No config device in dev %d, state %d",
 			ctx->dev_hdl, ctx->state);
 		rc = -EPROTO;
 	}

+ 2 - 1
drivers/cam_core/cam_context_utils.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/debugfs.h>
@@ -518,7 +519,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
 	}
 
 	if (packet->header.request_id <= ctx->last_flush_req) {
-		CAM_ERR(CAM_CORE,
+		CAM_INFO(CAM_CORE,
 			"request %lld has been flushed, reject packet",
 			packet->header.request_id);
 		rc = -EBADR;

+ 9 - 3
drivers/cam_core/cam_node.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/debugfs.h>
@@ -330,9 +331,14 @@ static int __cam_node_handle_config_dev(struct cam_node *node,
 	}
 
 	rc = cam_context_handle_config_dev(ctx, config);
-	if (rc)
-		CAM_ERR(CAM_CORE, "Config failure for node %s", node->name);
-
+	if (rc) {
+		if (ctx->state == CAM_CTX_FLUSHED)
+			CAM_INFO(CAM_CORE,
+				"Config failure for node %s, it has been flushed",
+				node->name);
+		else
+			CAM_ERR(CAM_CORE, "Config failure for node %s", node->name);
+	}
 	return rc;
 }
 

+ 7 - 2
drivers/cam_isp/cam_isp_context.c

@@ -5751,8 +5751,13 @@ static int __cam_isp_ctx_config_dev_in_top_state(
 			add_req.req_id   = req->request_id;
 			rc = ctx->ctx_crm_intf->add_req(&add_req);
 			if (rc) {
-				CAM_ERR(CAM_ISP, "Add req failed: req id=%llu",
-					req->request_id);
+				if (rc == -EBADR)
+					CAM_INFO(CAM_ISP,
+						"Add req failed: req id=%llu, it has been flushed",
+						req->request_id);
+				else
+					CAM_ERR(CAM_ISP, "Add req failed: req id=%llu",
+						req->request_id);
 			} else {
 				__cam_isp_ctx_enqueue_request_in_order(
 					ctx, req);

+ 1 - 1
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -3315,7 +3315,7 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req)
 	idx = __cam_req_mgr_find_slot_for_req(link->req.in_q, add_req->req_id);
 	if (idx < 0) {
 		if (((uint32_t)add_req->req_id) <= (link->last_flush_id)) {
-			CAM_ERR(CAM_CRM,
+			CAM_INFO(CAM_CRM,
 				"req %lld not found in in_q; it has been flushed [last_flush_req %u]",
 				add_req->req_id, link->last_flush_id);
 			rc = -EBADR;

+ 15 - 4
drivers/cam_sensor_module/cam_actuator/cam_actuator_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>
@@ -383,9 +384,14 @@ static int cam_actuator_update_req_mgr(
 		a_ctrl->bridge_intf.crm_cb->add_req) {
 		rc = a_ctrl->bridge_intf.crm_cb->add_req(&add_req);
 		if (rc) {
-			CAM_ERR(CAM_ACTUATOR,
-				"Adding request: %llu failed: rc: %d",
-				csl_packet->header.request_id, rc);
+			if (rc == -EBADR)
+				CAM_INFO(CAM_ACTUATOR,
+					"Adding request: %llu failed: rc: %d, it has been flushed",
+					csl_packet->header.request_id, rc);
+			else
+				CAM_ERR(CAM_ACTUATOR,
+					"Adding request: %llu failed: rc: %d",
+					csl_packet->header.request_id, rc);
 			return rc;
 		}
 		CAM_DBG(CAM_ACTUATOR, "Request Id: %lld added to CRM",
@@ -983,7 +989,12 @@ int32_t cam_actuator_driver_cmd(struct cam_actuator_ctrl_t *a_ctrl,
 			ACT_APPLY_SETTINGS_LATER;
 		rc = cam_actuator_i2c_pkt_parse(a_ctrl, arg);
 		if (rc < 0) {
-			CAM_ERR(CAM_ACTUATOR, "Failed in actuator Parsing");
+			if (rc == -EBADR)
+				CAM_INFO(CAM_ACTUATOR,
+					"Failed in actuator Parsing, it has been flushed");
+			else
+				CAM_ERR(CAM_ACTUATOR,
+					"Failed in actuator Parsing");
 			goto release_mutex;
 		}
 

+ 10 - 3
drivers/cam_sensor_module/cam_actuator/cam_actuator_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_actuator_dev.h"
@@ -52,9 +53,15 @@ static long cam_actuator_subdev_ioctl(struct v4l2_subdev *sd,
 	switch (cmd) {
 	case VIDIOC_CAM_CONTROL:
 		rc = cam_actuator_driver_cmd(a_ctrl, arg);
-		if (rc)
-			CAM_ERR(CAM_ACTUATOR,
-				"Failed for driver_cmd: %d", rc);
+		if (rc) {
+			if (rc == -EBADR)
+				CAM_INFO(CAM_ACTUATOR,
+					"Failed for driver_cmd: %d, it has been flushed",
+					rc);
+			else
+				CAM_ERR(CAM_ACTUATOR,
+					"Failed for driver_cmd: %d", rc);
+		}
 		break;
 	case CAM_SD_SHUTDOWN:
 		if (!cam_req_mgr_is_shutdown()) {

+ 18 - 7
drivers/cam_sensor_module/cam_flash/cam_flash_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>
@@ -1272,9 +1273,14 @@ update_req_mgr:
 			fctrl->bridge_intf.crm_cb->add_req) {
 			rc = fctrl->bridge_intf.crm_cb->add_req(&add_req);
 			if  (rc) {
-				CAM_ERR(CAM_FLASH,
-					"Failed in adding request: %llu to request manager",
-					csl_packet->header.request_id);
+				if (rc == -EBADR)
+					CAM_INFO(CAM_FLASH,
+						"Failed in adding request: %llu to request manager, it has been flushed",
+						csl_packet->header.request_id);
+				else
+					CAM_ERR(CAM_FLASH,
+						"Failed in adding request: %llu to request manager",
+						csl_packet->header.request_id);
 				return rc;
 			}
 			CAM_DBG(CAM_FLASH,
@@ -1765,10 +1771,15 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
 		if (fctrl->bridge_intf.crm_cb &&
 			fctrl->bridge_intf.crm_cb->add_req) {
 			rc = fctrl->bridge_intf.crm_cb->add_req(&add_req);
-			if  (rc) {
-				CAM_ERR(CAM_FLASH,
-					"Failed in adding request: %llu to request manager",
-					csl_packet->header.request_id);
+			if (rc) {
+				if (rc == -EBADR)
+					CAM_INFO(CAM_FLASH,
+						"Failed in adding request: %llu to request manager, it has been flushed",
+						csl_packet->header.request_id);
+				else
+					CAM_ERR(CAM_FLASH,
+						"Failed in adding request: %llu to request manager",
+						csl_packet->header.request_id);
 				return rc;
 			}
 			CAM_DBG(CAM_FLASH,

+ 14 - 4
drivers/cam_sensor_module/cam_flash/cam_flash_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 <linux/module.h>
@@ -191,7 +192,11 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
 		CAM_DBG(CAM_FLASH, "CAM_CONFIG_DEV");
 		rc = fctrl->func_tbl.parser(fctrl, arg);
 		if (rc) {
-			CAM_ERR(CAM_FLASH, "Failed Flash Config: rc=%d\n", rc);
+			if (rc == -EBADR)
+				CAM_INFO(CAM_FLASH,
+					"Failed Flash Config: rc=%d\n, it has been flushed", rc);
+			else
+				CAM_ERR(CAM_FLASH, "Failed Flash Config: rc=%d\n", rc);
 			goto release_mutex;
 		}
 		break;
@@ -287,9 +292,14 @@ static long cam_flash_subdev_ioctl(struct v4l2_subdev *sd,
 	case VIDIOC_CAM_CONTROL: {
 		rc = cam_flash_driver_cmd(fctrl, arg,
 			soc_private);
-		if (rc)
-			CAM_ERR(CAM_FLASH,
-				"Failed in driver cmd: %d", rc);
+		if (rc) {
+			if (rc == -EBADR)
+				CAM_INFO(CAM_FLASH,
+					"Failed in driver cmd: %d, it has been flushed", rc);
+			else
+				CAM_ERR(CAM_FLASH,
+					"Failed in driver cmd: %d", rc);
+		}
 		break;
 	}
 	case CAM_SD_SHUTDOWN:

+ 17 - 5
drivers/cam_sensor_module/cam_sensor/cam_sensor_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>
@@ -30,9 +31,14 @@ static int cam_sensor_update_req_mgr(
 		s_ctrl->bridge_intf.crm_cb->add_req) {
 		rc = s_ctrl->bridge_intf.crm_cb->add_req(&add_req);
 		if (rc) {
-			CAM_ERR(CAM_SENSOR,
-				"Adding request: %llu failed with request manager rc: %d",
-				csl_packet->header.request_id, rc);
+			if (rc == -EBADR)
+				CAM_INFO(CAM_SENSOR,
+					"Adding request: %llu failed with request manager rc: %d, it has been flushed",
+					csl_packet->header.request_id, rc);
+			else
+				CAM_ERR(CAM_SENSOR,
+					"Adding request: %llu failed with request manager rc: %d",
+					csl_packet->header.request_id, rc);
 			return rc;
 		}
 	}
@@ -1125,8 +1131,14 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 	case CAM_CONFIG_DEV: {
 		rc = cam_sensor_i2c_pkt_parse(s_ctrl, arg);
 		if (rc < 0) {
-			CAM_ERR(CAM_SENSOR, "%s:Failed i2c pkt parse. rc: %d",
-				s_ctrl->sensor_name, rc);
+			if (rc == -EBADR)
+				CAM_INFO(CAM_SENSOR,
+					"%s:Failed i2c pkt parse. rc: %d, it has been flushed",
+					s_ctrl->sensor_name, rc);
+			else
+				CAM_ERR(CAM_SENSOR,
+					"%s:Failed i2c pkt parse. rc: %d",
+					s_ctrl->sensor_name, rc);
 			goto release_mutex;
 		}
 		if (s_ctrl->i2c_data.init_settings.is_settings_valid &&

+ 9 - 3
drivers/cam_sensor_module/cam_sensor/cam_sensor_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_sensor_dev.h"
@@ -50,9 +51,14 @@ static long cam_sensor_subdev_ioctl(struct v4l2_subdev *sd,
 	switch (cmd) {
 	case VIDIOC_CAM_CONTROL:
 		rc = cam_sensor_driver_cmd(s_ctrl, arg);
-		if (rc)
-			CAM_ERR(CAM_SENSOR,
-				"Failed in Driver cmd: %d", rc);
+		if (rc) {
+			if (rc == -EBADR)
+				CAM_INFO(CAM_SENSOR,
+					"Failed in Driver cmd: %d, it has been flushed", rc);
+			else
+				CAM_ERR(CAM_SENSOR,
+					"Failed in Driver cmd: %d", rc);
+		}
 		break;
 	case CAM_SD_SHUTDOWN:
 		if (!cam_req_mgr_is_shutdown()) {