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

Commit 2e1a2da1 authored by Abhilash Kumar's avatar Abhilash Kumar
Browse files

msm: camera: csid: Disable CSI Rx if non-fatal errors exceed threshold



Too many EOT and SOT interrupts can cause watchdog bark on device.
Disable CSI Rx if we receive these interrupts too much, as these are
not fatal errors.

Change-Id: Iff187e8e30871794473c49498737be53eac98fa6
Signed-off-by: default avatarAbhilash Kumar <krabhi@codeaurora.org>
parent 7fd7a065
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@
/* Max number of sof irq's triggered in case of SOF freeze */
#define CAM_CSID_IRQ_SOF_DEBUG_CNT_MAX 12

/* Max CSI Rx irq error count threshold value */
#define CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT               100

static int cam_ife_csid_is_ipp_ppp_format_supported(
	uint32_t in_format)
{
@@ -435,6 +438,7 @@ static int cam_ife_csid_global_reset(struct cam_ife_csid_hw *csid_hw)
	if (val != 0)
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
			csid_hw->hw_intf->hw_idx, val);
	csid_hw->error_irq_count = 0;

	return rc;
}
@@ -1122,6 +1126,8 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
			csid_hw->hw_intf->hw_idx);

	csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	csid_hw->error_irq_count = 0;

	return rc;
}

@@ -2981,10 +2987,12 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_EOT_RECEPTION) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_EOT_RECEPTION",
			 csid_hw->hw_intf->hw_idx);
		csid_hw->error_irq_count++;
	}
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_SOT_RECEPTION) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_SOT_RECEPTION",
			 csid_hw->hw_intf->hw_idx);
		csid_hw->error_irq_count++;
	}
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_PH_CRC) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_PH_CRC",
@@ -3011,6 +3019,12 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
			 csid_hw->hw_intf->hw_idx);
	}

	if (csid_hw->error_irq_count >
		CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT) {
		fatal_err_detected = true;
		csid_hw->error_irq_count = 0;
	}

	if (fatal_err_detected)
		cam_ife_csid_halt_csi2(csid_hw);

@@ -3344,6 +3358,8 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf,
	}

	ife_csid_hw->csid_debug = 0;
	ife_csid_hw->error_irq_count = 0;

	return 0;
err:
	if (rc) {
+3 −0
Original line number Diff line number Diff line
@@ -449,6 +449,8 @@ struct cam_ife_csid_path_cfg {
 * @sof_irq_triggered:        Flag is set on receiving event to enable sof irq
 *                            incase of SOF freeze.
 * @irq_debug_cnt:            Counter to track sof irq's when above flag is set.
 * @error_irq_count           Error IRQ count, if continuous error irq comes
 *                            need to stop the CSID and mask interrupts.
 *
 */
struct cam_ife_csid_hw {
@@ -474,6 +476,7 @@ struct cam_ife_csid_hw {
	uint64_t                         clk_rate;
	bool                             sof_irq_triggered;
	uint32_t                         irq_debug_cnt;
	uint32_t                         error_irq_count;
};

int cam_ife_csid_hw_probe_init(struct cam_hw_intf  *csid_hw_intf,