Преглед на файлове

Merge "msm: camera: isp: Disable csid sof irq logs based on threshold count" into camera-kernel.lnx.5.0

Savita Patted преди 4 години
родител
ревизия
b8a0954d26

+ 11 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c

@@ -4202,6 +4202,7 @@ static int cam_ife_csid_ver1_path_top_half(
 	uint32_t                                debug_bits;
 	uint32_t                                bit_pos = 0;
 	int                                     id = 0;
+	uint32_t                                sof_irq_debug_en = 0;
 
 	csid_reg = (struct cam_ife_csid_ver1_reg_info *)
 			csid_hw->core_info->csid_reg;
@@ -4252,6 +4253,11 @@ static int cam_ife_csid_ver1_path_top_half(
 		return 0;
 	}
 
+	if (csid_hw->flags.sof_irq_triggered &&
+		(status & IFE_CSID_VER1_PATH_INFO_INPUT_SOF)) {
+		csid_hw->counters.irq_debug_cnt++;
+	}
+
 	if (status & path_reg->fatal_err_mask)
 		cam_io_w_mb(CAM_CSID_HALT_IMMEDIATELY,
 			soc_info->reg_map[0].mem_base +
@@ -4275,6 +4281,11 @@ static int cam_ife_csid_ver1_path_top_half(
 	*need_bh = status & (path_reg->fatal_err_mask |
 			path_reg->non_fatal_err_mask);
 
+	if (csid_hw->counters.irq_debug_cnt >= CAM_CSID_IRQ_SOF_DEBUG_CNT_MAX) {
+		cam_ife_csid_ver1_sof_irq_debug(csid_hw, &sof_irq_debug_en);
+		csid_hw->counters.irq_debug_cnt = 0;
+	}
+
 	return IRQ_HANDLED;
 }
 

+ 88 - 76
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -286,6 +286,83 @@ static int cam_ife_csid_ver2_set_debug(
 	return 0;
 }
 
+static int cam_ife_csid_ver2_sof_irq_debug(
+	struct cam_ife_csid_ver2_hw *csid_hw,
+	void *cmd_args)
+{
+	int i = 0;
+	uint32_t val = 0;
+	bool sof_irq_enable = false;
+	struct cam_hw_soc_info                  *soc_info;
+	struct cam_ife_csid_ver2_reg_info *csid_reg;
+
+	if (*((uint32_t *)cmd_args) == 1)
+		sof_irq_enable = true;
+
+	if (csid_hw->hw_info->hw_state ==
+		CAM_HW_STATE_POWER_DOWN) {
+		CAM_WARN(CAM_ISP,
+			"CSID powered down unable to %s sof irq",
+			(sof_irq_enable) ? "enable" : "disable");
+		return 0;
+	}
+
+	soc_info = &csid_hw->hw_info->soc_info;
+	csid_reg = (struct cam_ife_csid_ver2_reg_info *)
+			csid_hw->core_info->csid_reg;
+
+	for (i = 0; i < csid_reg->cmn_reg->num_pix; i++) {
+
+		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
+			csid_reg->ipp_reg->irq_mask_addr);
+
+		if (!val)
+			continue;
+
+		if (sof_irq_enable)
+			val |= IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+		else
+			val &= ~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+
+		cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
+			csid_reg->ipp_reg->irq_mask_addr);
+	}
+
+	for (i = 0; i < csid_reg->cmn_reg->num_rdis; i++) {
+		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
+			csid_reg->rdi_reg[i]->irq_mask_addr);
+		if (!val)
+			continue;
+
+		if (sof_irq_enable)
+			val |= IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+		else
+			val &= ~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+
+		cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
+			csid_reg->rdi_reg[i]->irq_mask_addr);
+	}
+
+	if (sof_irq_enable) {
+		csid_hw->debug_info.path_mask |=
+			IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+		csid_hw->debug_info.debug_val |=
+			CAM_IFE_CSID_DEBUG_ENABLE_SOF_IRQ;
+		csid_hw->flags.sof_irq_triggered = true;
+	} else {
+		csid_hw->debug_info.path_mask &=
+			~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
+		csid_hw->debug_info.debug_val &=
+			~CAM_IFE_CSID_DEBUG_ENABLE_SOF_IRQ;
+		csid_hw->flags.sof_irq_triggered = false;
+	}
+
+	CAM_INFO(CAM_ISP, "SOF freeze: CSID SOF irq %s",
+		(sof_irq_enable) ? "enabled" : "disabled");
+
+	return 0;
+}
+
 static int cam_ife_csid_ver2_get_evt_payload(
 	struct cam_ife_csid_ver2_hw *csid_hw,
 	struct cam_ife_csid_ver2_evt_payload **evt_payload,
@@ -712,10 +789,16 @@ static int cam_ife_csid_ver2_parse_path_irq_status(
 	const uint8_t                        **irq_reg_tag;
 	uint32_t                               bit_pos = 0;
 	uint32_t                               temp_status;
+	uint32_t                               sof_irq_debug_en = 0;
 
 	irq_reg_tag = cam_ife_csid_get_irq_reg_tag_ptr();
 	temp_status = irq_status & err_mask;
 
+	if (csid_hw->flags.sof_irq_triggered &&
+		(irq_status & IFE_CSID_VER2_PATH_INFO_INPUT_SOF)) {
+		csid_hw->counters.irq_debug_cnt++;
+	}
+
 	while (temp_status) {
 
 		if (temp_status & 0x1)
@@ -743,6 +826,11 @@ static int cam_ife_csid_ver2_parse_path_irq_status(
 		temp_status >>= 1;
 	}
 
+	if (csid_hw->counters.irq_debug_cnt >= CAM_CSID_IRQ_SOF_DEBUG_CNT_MAX) {
+		cam_ife_csid_ver2_sof_irq_debug(csid_hw, &sof_irq_debug_en);
+		csid_hw->counters.irq_debug_cnt = 0;
+	}
+
 	return 0;
 }
 
@@ -3593,82 +3681,6 @@ static int cam_ife_csid_ver2_set_csid_clock(
 	return 0;
 }
 
-static int cam_ife_csid_ver2_sof_irq_debug(
-	struct cam_ife_csid_ver2_hw *csid_hw,
-	void *cmd_args)
-{
-	int i = 0;
-	uint32_t val = 0;
-	bool sof_irq_enable = false;
-	struct cam_hw_soc_info                  *soc_info;
-	struct cam_ife_csid_ver2_reg_info *csid_reg;
-
-	if (*((uint32_t *)cmd_args) == 1)
-		sof_irq_enable = true;
-
-	if (csid_hw->hw_info->hw_state ==
-		CAM_HW_STATE_POWER_DOWN) {
-		CAM_WARN(CAM_ISP,
-			"CSID powered down unable to %s sof irq",
-			(sof_irq_enable) ? "enable" : "disable");
-		return 0;
-	}
-
-	soc_info = &csid_hw->hw_info->soc_info;
-	csid_reg = (struct cam_ife_csid_ver2_reg_info *)
-			csid_hw->core_info->csid_reg;
-
-	for (i = 0; i < csid_reg->cmn_reg->num_pix; i++) {
-
-		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-			csid_reg->ipp_reg->irq_mask_addr);
-
-		if (!val)
-			continue;
-
-		if (sof_irq_enable)
-			val |= IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-		else
-			val &= ~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-
-		cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
-			csid_reg->ipp_reg->irq_mask_addr);
-	}
-
-	for (i = 0; i < csid_reg->cmn_reg->num_rdis; i++) {
-		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
-			csid_reg->rdi_reg[i]->irq_mask_addr);
-		if (!val)
-			continue;
-
-		if (sof_irq_enable)
-			val |= IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-		else
-			val &= ~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-
-		cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
-			csid_reg->rdi_reg[i]->irq_mask_addr);
-	}
-
-	if (sof_irq_enable) {
-		csid_hw->debug_info.path_mask |=
-			IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-		csid_hw->debug_info.debug_val |=
-			CAM_IFE_CSID_DEBUG_ENABLE_SOF_IRQ;
-		csid_hw->flags.sof_irq_triggered = true;
-	} else {
-		csid_hw->debug_info.path_mask &=
-			~IFE_CSID_VER2_PATH_INFO_INPUT_SOF;
-		csid_hw->debug_info.debug_val &=
-			~CAM_IFE_CSID_DEBUG_ENABLE_SOF_IRQ;
-		csid_hw->flags.sof_irq_triggered = false;
-	}
-
-	CAM_INFO(CAM_ISP, "SOF freeze: CSID SOF irq %s",
-		(sof_irq_enable) ? "enabled" : "disabled");
-
-	return 0;
-}
 static int cam_ife_csid_ver2_dual_sync_cfg(
 	struct cam_ife_csid_ver2_hw  *csid_hw,
 	void *cmd_args)