瀏覽代碼

msm: camera: isp: Add support for HWPD debugging

HWPD is associated with several modules, but only image size violation
displayed in the kernel when an error occur. Now we will pass the error
code of HWPD violation to UMD to help UMD to take necessary action and
dump relevant info.

CRs-Fixed: 3440015
Change-Id: I6483b228a8eeaac3bf54f5f83f8f8deab3da6250
Signed-off-by: Stark Lin <[email protected]>
Stark Lin 2 年之前
父節點
當前提交
c23a3f448c

+ 5 - 0
drivers/cam_isp/cam_isp_context.c

@@ -3579,6 +3579,11 @@ static void __cam_isp_get_notification_evt_params(
 		err_type = CAM_SYNC_ISP_EVENT_VIOLATION;
 		recovery_type_temp |= CAM_REQ_MGR_ERROR_TYPE_RECOVERY;
 	}
+	if (hw_error & CAM_ISP_HW_ERROR_HWPD_VIOLATION) {
+		err_code |= CAM_REQ_MGR_ISP_ERR_HWPD_VIOLATION;
+		err_type = CAM_SYNC_ISP_EVENT_VIOLATION;
+		recovery_type_temp |= CAM_REQ_MGR_ERROR_TYPE_RECOVERY;
+	}
 	if (hw_error & CAM_ISP_HW_ERROR_BUSIF_OVERFLOW) {
 		err_code |= CAM_REQ_MGR_ISP_UNREPORTED_ERROR;
 		err_type = CAM_SYNC_ISP_EVENT_BUSIF_OVERFLOW;

+ 5 - 2
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -14135,9 +14135,12 @@ static int cam_ife_hw_mgr_handle_hw_err(
 		CAM_ISP_HW_VFE_IN_CAMIF)
 		cam_ife_hw_mgr_handle_hw_dump_info(ife_hw_mgr_ctx, event_info);
 
-	if (err_type == CAM_VFE_IRQ_STATUS_VIOLATION)
+	if (err_type == CAM_VFE_IRQ_STATUS_VIOLATION) {
 		error_event_data.error_type = CAM_ISP_HW_ERROR_VIOLATION;
-	else if (event_info->res_type == CAM_ISP_RESOURCE_VFE_IN)
+
+		if (err_evt_info->err_mask & CAM_VFE_IRQ_ERR_MASK_HWPD_VIOLATION)
+			error_event_data.error_type |= CAM_ISP_HW_ERROR_HWPD_VIOLATION;
+	} else if (event_info->res_type == CAM_ISP_RESOURCE_VFE_IN)
 		error_event_data.error_type = CAM_ISP_HW_ERROR_OVERFLOW;
 	else if (event_info->res_type == CAM_ISP_RESOURCE_VFE_OUT)
 		error_event_data.error_type = CAM_ISP_HW_ERROR_BUSIF_OVERFLOW;

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/include/cam_isp_hw_mgr_intf.h

@@ -132,6 +132,7 @@ enum cam_isp_hw_err_type {
 	CAM_ISP_HW_ERROR_CSID_MISSING_EOT             = 0x00008000,
 	CAM_ISP_HW_ERROR_CSID_PKT_PAYLOAD_CORRUPTED   = 0x00010000,
 	CAM_ISP_HW_ERROR_CSID_CAMIF_FRAME_DROP        = 0x00020000,
+	CAM_ISP_HW_ERROR_HWPD_VIOLATION               = 0x00040000,
 };
 
 /**

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h

@@ -308,10 +308,12 @@ struct cam_isp_blanking_config {
  * @brief:              Structure to pass error event details to hw mgr
  *
  * @err_type:           Type of error being reported
+ * @err_mask:           Exact error of the err_type
  *
  */
 struct cam_isp_hw_error_event_info {
 	uint32_t    err_type;
+	uint32_t    err_mask;
 };
 
 /**

+ 4 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_vfe_hw_intf.h

@@ -59,6 +59,10 @@ enum cam_vfe_hw_irq_status {
 	CAM_VFE_IRQ_STATUS_MAX,
 };
 
+enum cam_vfe_irq_err_mask {
+	CAM_VFE_IRQ_ERR_MASK_HWPD_VIOLATION     = 0x00000001,
+};
+
 enum cam_vfe_hw_irq_regs {
 	CAM_IFE_IRQ_CAMIF_REG_STATUS0           = 0,
 	CAM_IFE_IRQ_CAMIF_REG_STATUS1           = 1,

+ 29 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -71,6 +71,10 @@ enum cam_vfe_bus_ver3_packer_format {
 	PACKER_FMT_VER3_MAX,
 };
 
+struct cam_vfe_bus_irq_violation_type {
+	bool hwpd_violation;
+};
+
 struct cam_vfe_bus_ver3_comp_grp_acquire_args {
 	enum cam_vfe_bus_ver3_comp_grp_type  comp_grp_id;
 	uint64_t                             composite_mask;
@@ -2764,11 +2768,12 @@ static int cam_vfe_bus_ver3_err_irq_top_half(uint32_t evt_id,
 	return rc;
 }
 
-static void cam_vfe_print_violations(
+static void cam_vfe_check_violations(
 	char *error_type,
 	uint32_t status,
 	struct cam_vfe_bus_ver3_priv *bus_priv,
-	uint64_t *out_port)
+	uint64_t *out_port,
+	struct cam_vfe_bus_irq_violation_type *violation_type)
 {
 	int i, j;
 	struct cam_isp_resource_node       *rsrc_node = NULL;
@@ -2802,6 +2807,17 @@ static void cam_vfe_print_violations(
 				cam_vfe_bus_ver3_print_wm_info(wm_data,
 					common_data, wm_name);
 				*out_port |= BIT_ULL(rsrc_node->res_id & 0xFF);
+
+				/* check what type of violation it is*/
+				switch (wm_data->index) {
+				case 21:
+				case 22:
+					if (!strcmp(error_type, "Image Size"))
+						violation_type->hwpd_violation = true;
+					break;
+				default:
+					break;
+				}
 			}
 		}
 	}
@@ -2817,6 +2833,7 @@ static int cam_vfe_bus_ver3_err_irq_bottom_half(
 	struct cam_isp_hw_error_event_info err_evt_info;
 	uint32_t status = 0, image_size_violation = 0, ccif_violation = 0, constraint_violation = 0;
 	uint64_t out_port_id = 0;
+	struct cam_vfe_bus_irq_violation_type violation_type;
 
 	if (!handler_priv || !evt_payload_priv)
 		return -EINVAL;
@@ -2839,20 +2856,27 @@ static int cam_vfe_bus_ver3_err_irq_bottom_half(
 
 	memset(&evt_info, 0, sizeof(evt_info));
 	memset(&err_evt_info, 0, sizeof(err_evt_info));
+	memset(&violation_type, 0, sizeof(violation_type));
 
 	if (image_size_violation || constraint_violation) {
 		status = evt_payload->image_size_violation_status;
 		if (!status)
 			cam_vfe_bus_ver3_get_constraint_errors(bus_priv);
 		else {
-			cam_vfe_print_violations("Image Size", status,
-				bus_priv, &out_port_id);
+			cam_vfe_check_violations("Image Size", status, bus_priv,
+				&out_port_id, &violation_type);
 		}
 	}
 
 	if (ccif_violation) {
 		status = evt_payload->ccif_violation_status;
-		cam_vfe_print_violations("CCIF", status, bus_priv, &out_port_id);
+		cam_vfe_check_violations("CCIF", status, bus_priv,
+			&out_port_id, &violation_type);
+	}
+
+	if (image_size_violation && violation_type.hwpd_violation) {
+		err_evt_info.err_mask |= CAM_VFE_IRQ_ERR_MASK_HWPD_VIOLATION;
+		CAM_DBG(CAM_ISP, "HWPD image size violation");
 	}
 
 	cam_vfe_bus_ver3_put_evt_payload(common_data, &evt_payload);

+ 5 - 1
include/uapi/camera/media/cam_req_mgr.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef __UAPI_LINUX_CAM_REQ_MGR_H
@@ -660,6 +660,8 @@ struct cam_mem_cpu_access_op {
  * @CAM_REQ_MGR_CSID_MISSING_EOT               : CSID is missing EOT on one or more lanes
  * @CAM_REQ_MGR_CSID_RX_PKT_PAYLOAD_CORRUPTION : CSID long packet payload CRC mismatch
  * @CAM_REQ_MGR_SENSOR_STREAM_OFF_FAILED       : Failed to stream off sensor
+ * @CAM_REQ_MGR_VALID_SHUTTER_DROPPED          : Valid shutter dropped
+ * @CAM_REQ_MGR_ISP_ERR_HWPD_VIOLATION         : HWPD image size violation
  */
 #define CAM_REQ_MGR_ISP_UNREPORTED_ERROR                 0
 #define CAM_REQ_MGR_LINK_STALLED_ERROR                   BIT(0)
@@ -677,6 +679,8 @@ struct cam_mem_cpu_access_op {
 #define CAM_REQ_MGR_CSID_MISSING_EOT                     BIT(12)
 #define CAM_REQ_MGR_CSID_RX_PKT_PAYLOAD_CORRUPTION       BIT(13)
 #define CAM_REQ_MGR_SENSOR_STREAM_OFF_FAILED             BIT(14)
+#define CAM_REQ_MGR_VALID_SHUTTER_DROPPED                BIT(15)
+#define CAM_REQ_MGR_ISP_ERR_HWPD_VIOLATION               BIT(16)
 
 /**
  * struct cam_req_mgr_error_msg