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

Commit 61ec1a7d authored by Viswanadha Raju Thotakura's avatar Viswanadha Raju Thotakura Committed by Jeyaprakash Soundrapandian
Browse files

msm: camera: Listen to error interrupts once CSID is enabled



In the case of CSID, listen to error interrupts once hardware
is enabled. Ignore all error interrupts received prior
to this state.

Change-Id: Iafd01ab0bf2186f3c081521fdfc7c9511a8a930e
Signed-off-by: default avatarViswanadha Raju Thotakura <viswanad@codeaurora.org>
Signed-off-by: default avatarJeyaprakash Soundrapandian <jsoundra@codeaurora.org>
parent 51cfd1ad
Loading
Loading
Loading
Loading
+79 −60
Original line number Original line Diff line number Diff line
@@ -1114,6 +1114,7 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
	int rc = -EINVAL;
	int rc = -EINVAL;
	struct cam_hw_soc_info                   *soc_info;
	struct cam_hw_soc_info                   *soc_info;
	const struct cam_ife_csid_reg_offset     *csid_reg;
	const struct cam_ife_csid_reg_offset     *csid_reg;
	unsigned long                             flags;


	/* Check for refcount */
	/* Check for refcount */
	if (!csid_hw->hw_info->open_count) {
	if (!csid_hw->hw_info->open_count) {
@@ -1148,6 +1149,9 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
		CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",
		CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",
			csid_hw->hw_intf->hw_idx);
			csid_hw->hw_intf->hw_idx);


	spin_lock_irqsave(&csid_hw->lock_state, flags);
	csid_hw->device_enabled = 0;
	spin_unlock_irqrestore(&csid_hw->lock_state, flags);
	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;
	csid_hw->error_irq_count = 0;


@@ -2603,6 +2607,7 @@ static int cam_ife_csid_init_hw(void *hw_priv,
	struct cam_hw_info                     *csid_hw_info;
	struct cam_hw_info                     *csid_hw_info;
	struct cam_isp_resource_node           *res;
	struct cam_isp_resource_node           *res;
	const struct cam_ife_csid_reg_offset   *csid_reg;
	const struct cam_ife_csid_reg_offset   *csid_reg;
	unsigned long                           flags;


	if (!hw_priv || !init_args ||
	if (!hw_priv || !init_args ||
		(arg_size != sizeof(struct cam_isp_resource_node))) {
		(arg_size != sizeof(struct cam_isp_resource_node))) {
@@ -2670,6 +2675,10 @@ static int cam_ife_csid_init_hw(void *hw_priv,


	if (rc)
	if (rc)
		cam_ife_csid_disable_hw(csid_hw);
		cam_ife_csid_disable_hw(csid_hw);

	spin_lock_irqsave(&csid_hw->lock_state, flags);
	csid_hw->device_enabled = 1;
	spin_unlock_irqrestore(&csid_hw->lock_state, flags);
end:
end:
	mutex_unlock(&csid_hw->hw_info->hw_mutex);
	mutex_unlock(&csid_hw->hw_info->hw_mutex);
	return rc;
	return rc;
@@ -3022,6 +3031,7 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
	uint32_t val, irq_status_ppp = 0;
	uint32_t val, irq_status_ppp = 0;
	bool fatal_err_detected = false;
	bool fatal_err_detected = false;
	uint32_t sof_irq_debug_en = 0;
	uint32_t sof_irq_debug_en = 0;
	unsigned long flags;


	csid_hw = (struct cam_ife_csid_hw *)data;
	csid_hw = (struct cam_ife_csid_hw *)data;


@@ -3087,6 +3097,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
		complete(&csid_hw->csid_csi2_complete);
		complete(&csid_hw->csid_csi2_complete);
	}
	}


	spin_lock_irqsave(&csid_hw->lock_state, flags);
	if (csid_hw->device_enabled == 1) {
		if (irq_status_rx & CSID_CSI2_RX_ERROR_LANE0_FIFO_OVERFLOW) {
		if (irq_status_rx & CSID_CSI2_RX_ERROR_LANE0_FIFO_OVERFLOW) {
			CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d lane 0 over flow",
			CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d lane 0 over flow",
				 csid_hw->hw_intf->hw_idx);
				 csid_hw->hw_intf->hw_idx);
@@ -3113,12 +3125,14 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
			fatal_err_detected = true;
			fatal_err_detected = true;
		}
		}
		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++;
			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++;
			csid_hw->error_irq_count++;
		}
		}
@@ -3139,7 +3153,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
				 csid_hw->hw_intf->hw_idx);
				 csid_hw->hw_intf->hw_idx);
		}
		}
		if (irq_status_rx & CSID_CSI2_RX_ERROR_STREAM_UNDERFLOW) {
		if (irq_status_rx & CSID_CSI2_RX_ERROR_STREAM_UNDERFLOW) {
		CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d ERROR_STREAM_UNDERFLOW",
			CAM_ERR_RATE_LIMIT(CAM_ISP,
				"CSID:%d ERROR_STREAM_UNDERFLOW",
				 csid_hw->hw_intf->hw_idx);
				 csid_hw->hw_intf->hw_idx);
			csid_hw->error_irq_count++;
			csid_hw->error_irq_count++;
		}
		}
@@ -3148,6 +3163,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
				 csid_hw->hw_intf->hw_idx);
				 csid_hw->hw_intf->hw_idx);
			csid_hw->error_irq_count++;
			csid_hw->error_irq_count++;
		}
		}
	}
	spin_unlock_irqrestore(&csid_hw->lock_state, flags);


	if (csid_hw->error_irq_count >
	if (csid_hw->error_irq_count >
		CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT) {
		CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT) {
@@ -3398,9 +3415,11 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf,
		ife_csid_hw->hw_intf->hw_type, csid_idx);
		ife_csid_hw->hw_intf->hw_type, csid_idx);




	ife_csid_hw->device_enabled = 0;
	ife_csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	ife_csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	mutex_init(&ife_csid_hw->hw_info->hw_mutex);
	mutex_init(&ife_csid_hw->hw_info->hw_mutex);
	spin_lock_init(&ife_csid_hw->hw_info->hw_lock);
	spin_lock_init(&ife_csid_hw->hw_info->hw_lock);
	spin_lock_init(&ife_csid_hw->lock_state);
	init_completion(&ife_csid_hw->hw_info->hw_complete);
	init_completion(&ife_csid_hw->hw_info->hw_complete);


	init_completion(&ife_csid_hw->csid_top_complete);
	init_completion(&ife_csid_hw->csid_top_complete);
+2 −0
Original line number Original line Diff line number Diff line
@@ -483,6 +483,8 @@ struct cam_ife_csid_hw {
	bool                             sof_irq_triggered;
	bool                             sof_irq_triggered;
	uint32_t                         irq_debug_cnt;
	uint32_t                         irq_debug_cnt;
	uint32_t                         error_irq_count;
	uint32_t                         error_irq_count;
	uint32_t                         device_enabled;
	spinlock_t                       lock_state;
};
};


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,