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

Commit 236fb2f2 authored by Viswanadha Raju Thotakura's avatar Viswanadha Raju Thotakura
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>
parent 00e32fc3
Loading
Loading
Loading
Loading
+79 −60
Original line number Diff line number Diff line
@@ -1122,6 +1122,7 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
	int rc = -EINVAL;
	struct cam_hw_soc_info                   *soc_info;
	const struct cam_ife_csid_reg_offset     *csid_reg;
	unsigned long                             flags;

	/* Check for refcount */
	if (!csid_hw->hw_info->open_count) {
@@ -1156,6 +1157,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",
			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->error_irq_count = 0;

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

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

	if (rc)
		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:
	mutex_unlock(&csid_hw->hw_info->hw_mutex);
	return rc;
@@ -3031,6 +3040,7 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
	uint32_t val, irq_status_ppp = 0;
	bool fatal_err_detected = false;
	uint32_t sof_irq_debug_en = 0;
	unsigned long flags;

	csid_hw = (struct cam_ife_csid_hw *)data;

@@ -3096,6 +3106,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
		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) {
			CAM_ERR_RATE_LIMIT(CAM_ISP, "CSID:%d lane 0 over flow",
				 csid_hw->hw_intf->hw_idx);
@@ -3122,12 +3134,14 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
			fatal_err_detected = true;
		}
		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->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",
			CAM_ERR_RATE_LIMIT(CAM_ISP,
				"CSID:%d CPHY_SOT_RECEPTION",
				 csid_hw->hw_intf->hw_idx);
			csid_hw->error_irq_count++;
		}
@@ -3148,7 +3162,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
				 csid_hw->hw_intf->hw_idx);
		}
		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->error_irq_count++;
		}
@@ -3157,6 +3172,8 @@ irqreturn_t cam_ife_csid_irq(int irq_num, void *data)
				 csid_hw->hw_intf->hw_idx);
			csid_hw->error_irq_count++;
		}
	}
	spin_unlock_irqrestore(&csid_hw->lock_state, flags);

	if (csid_hw->error_irq_count >
		CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT) {
@@ -3407,9 +3424,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->device_enabled = 0;
	ife_csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	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->lock_state);
	init_completion(&ife_csid_hw->hw_info->hw_complete);

	init_completion(&ife_csid_hw->csid_top_complete);
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -494,6 +494,8 @@ struct cam_ife_csid_hw {
	bool                             sof_irq_triggered;
	uint32_t                         irq_debug_cnt;
	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,