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

Commit 296fee45 authored by Rishabh Jain's avatar Rishabh Jain
Browse files

msm: camera: isp: Set device enable flag after enable csid hardware



Device enable flag is getting set after configuring the CSID csi rx
and csid path configuration. If irq comes after configuring the csi rx
hardware then irq handler is not handling as it is checking the device
enable flag. So set device enable flag after enabling the hardware.

CRs-Fixed: 2614498
Change-Id: I0e5a1f99ec4e2e4d3bd11274e2251f001223a651
Signed-off-by: default avatarRishabh Jain <risjai@codeaurora.org>
parent 6ebe9aa5
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/iopoll.h>
@@ -830,6 +830,7 @@ static int cam_tfe_csid_enable_hw(struct cam_tfe_csid_hw *csid_hw)
	const struct cam_tfe_csid_reg_offset      *csid_reg;
	struct cam_hw_soc_info              *soc_info;
	uint32_t i, val, clk_lvl;
	unsigned long                           flags;

	csid_reg = csid_hw->csid_info->csid_reg;
	soc_info = &csid_hw->hw_info->soc_info;
@@ -902,6 +903,10 @@ static int cam_tfe_csid_enable_hw(struct cam_tfe_csid_hw *csid_hw)
	if (rc)
		goto disable_soc;

	spin_lock_irqsave(&csid_hw->spin_lock, flags);
	csid_hw->device_enabled = 1;
	spin_unlock_irqrestore(&csid_hw->spin_lock, flags);

	return rc;

disable_soc:
@@ -1876,7 +1881,6 @@ static int cam_tfe_csid_init_hw(void *hw_priv,
	struct cam_hw_info                     *csid_hw_info;
	struct cam_isp_resource_node           *res;
	const struct cam_tfe_csid_reg_offset   *csid_reg;
	unsigned long                           flags;

	if (!hw_priv || !init_args ||
		(arg_size != sizeof(struct cam_isp_resource_node))) {
@@ -1936,9 +1940,6 @@ static int cam_tfe_csid_init_hw(void *hw_priv,
	if (rc)
		cam_tfe_csid_disable_hw(csid_hw);

	spin_lock_irqsave(&csid_hw->spin_lock, flags);
	csid_hw->device_enabled = 1;
	spin_unlock_irqrestore(&csid_hw->spin_lock, flags);
end:
	mutex_unlock(&csid_hw->hw_info->hw_mutex);
	return rc;
@@ -2465,16 +2466,6 @@ irqreturn_t cam_tfe_csid_irq(int irq_num, void *data)
		csid_hw->error_irq_count = 0;
	}

	CAM_INFO(CAM_ISP,
		"CSID %d irq status 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
		csid_hw->hw_intf->hw_idx,
		irq_status[TFE_CSID_IRQ_REG_TOP],
		irq_status[TFE_CSID_IRQ_REG_RX],
		irq_status[TFE_CSID_IRQ_REG_IPP],
		irq_status[TFE_CSID_IRQ_REG_RDI0],
		irq_status[TFE_CSID_IRQ_REG_RDI1],
		irq_status[TFE_CSID_IRQ_REG_RDI2]);

	if (fatal_err_detected) {
		/* Reset the Rx CFG registers */
		cam_io_w_mb(0, soc_info->reg_map[0].mem_base +