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

Commit 69b963bc authored by Suresh Vankadara's avatar Suresh Vankadara Committed by Gerrit - the friendly Code Review server
Browse files

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

Merge "msm: camera: csid: Disable CSI Rx if non-fatal errors exceed threshold" into dev/msm-4.14-camx
parents 94cb661a 2e1a2da1
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,9 @@
/* Max number of sof irq's triggered in case of SOF freeze */
/* Max number of sof irq's triggered in case of SOF freeze */
#define CAM_CSID_IRQ_SOF_DEBUG_CNT_MAX 12
#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(
static int cam_ife_csid_is_ipp_ppp_format_supported(
	uint32_t in_format)
	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)
	if (val != 0)
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
			csid_hw->hw_intf->hw_idx, val);
			csid_hw->hw_intf->hw_idx, val);
	csid_hw->error_irq_count = 0;


	return rc;
	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_intf->hw_idx);


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

	return rc;
	return rc;
}
}


@@ -2983,10 +2989,12 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_EOT_RECEPTION) {
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_EOT_RECEPTION) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_EOT_RECEPTION",
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_EOT_RECEPTION",
			 csid_hw->hw_intf->hw_idx);
			 csid_hw->hw_intf->hw_idx);
		csid_hw->error_irq_count++;
	}
	}
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_SOT_RECEPTION) {
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_SOT_RECEPTION) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_SOT_RECEPTION",
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_SOT_RECEPTION",
			 csid_hw->hw_intf->hw_idx);
			 csid_hw->hw_intf->hw_idx);
		csid_hw->error_irq_count++;
	}
	}
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_PH_CRC) {
	if (irq_status_rx & CSID_CSI2_RX_ERROR_CPHY_PH_CRC) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_PH_CRC",
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d CPHY_PH_CRC",
@@ -3013,6 +3021,12 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
			 csid_hw->hw_intf->hw_idx);
			 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)
	if (fatal_err_detected)
		cam_ife_csid_halt_csi2(csid_hw);
		cam_ife_csid_halt_csi2(csid_hw);


@@ -3346,6 +3360,8 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf,
	}
	}


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

	return 0;
	return 0;
err:
err:
	if (rc) {
	if (rc) {
+3 −0
Original line number Original line 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
 * @sof_irq_triggered:        Flag is set on receiving event to enable sof irq
 *                            incase of SOF freeze.
 *                            incase of SOF freeze.
 * @irq_debug_cnt:            Counter to track sof irq's when above flag is set.
 * @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 {
struct cam_ife_csid_hw {
@@ -474,6 +476,7 @@ struct cam_ife_csid_hw {
	uint64_t                         clk_rate;
	uint64_t                         clk_rate;
	bool                             sof_irq_triggered;
	bool                             sof_irq_triggered;
	uint32_t                         irq_debug_cnt;
	uint32_t                         irq_debug_cnt;
	uint32_t                         error_irq_count;
};
};


int cam_ife_csid_hw_probe_init(struct cam_hw_intf  *csid_hw_intf,
int cam_ife_csid_hw_probe_init(struct cam_hw_intf  *csid_hw_intf,