Browse Source

msm: camera: isp: Reset CSID top wrapper config

CSID wrapper config can be reset only by ares from
camera subsystem power up or ares assert BIT in
CSID clk branch both of which are not gauranteed at
the end of a given CSID stream. This change explicitly
resets the wrapper config via AHB. This is to avoid
any 2 CSID wrapper path config registers ending up with the
same config at a given instance.

CRs-Fixed: 2991630
Change-Id: I7b623841b33cad4e3921d0128f323dcd36e485c8
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 4 years ago
parent
commit
97719779bc

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid680.h

@@ -1173,6 +1173,8 @@ static struct cam_ife_csid_ver2_top_reg_info
 	.master_slave_sel_shift_val     = 1,
 	.master_slave_sel_shift_val     = 1,
 	.master_sel_val                 = 0,
 	.master_sel_val                 = 0,
 	.slave_sel_val                  = 1,
 	.slave_sel_val                  = 1,
+	.io_path_cfg_rst_val            = 1,
+	.dual_cfg_rst_val               = 0,
 };
 };
 
 
 static struct cam_ife_csid_ver2_reg_info cam_ife_csid_680_reg_info = {
 static struct cam_ife_csid_ver2_reg_info cam_ife_csid_680_reg_info = {

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid780.h

@@ -1198,6 +1198,8 @@ static struct cam_ife_csid_ver2_top_reg_info
 	.master_slave_sel_shift_val     = 1,
 	.master_slave_sel_shift_val     = 1,
 	.master_sel_val                 = 0,
 	.master_sel_val                 = 0,
 	.slave_sel_val                  = 1,
 	.slave_sel_val                  = 1,
+	.io_path_cfg_rst_val            = 1,
+	.dual_cfg_rst_val               = 0,
 };
 };
 
 
 static struct cam_ife_csid_ver2_reg_info cam_ife_csid_780_reg_info = {
 static struct cam_ife_csid_ver2_reg_info cam_ife_csid_780_reg_info = {

+ 23 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -3680,7 +3680,9 @@ static int cam_ife_csid_ver2_disable_core(
 	struct cam_ife_csid_ver2_hw *csid_hw)
 	struct cam_ife_csid_ver2_hw *csid_hw)
 {
 {
 	const struct cam_ife_csid_ver2_reg_info *csid_reg;
 	const struct cam_ife_csid_ver2_reg_info *csid_reg;
+	const struct cam_ife_csid_ver2_top_reg_info *top_reg = NULL;
 	struct cam_hw_soc_info                   *soc_info;
 	struct cam_hw_soc_info                   *soc_info;
+	struct cam_csid_soc_private              *soc_private;
 	int rc = 0;
 	int rc = 0;
 	unsigned long                             flags;
 	unsigned long                             flags;
 
 
@@ -3697,8 +3699,11 @@ static int cam_ife_csid_ver2_disable_core(
 		return rc;
 		return rc;
 
 
 	soc_info = &csid_hw->hw_info->soc_info;
 	soc_info = &csid_hw->hw_info->soc_info;
+	soc_private = (struct cam_csid_soc_private *)
+		soc_info->soc_private;
 	csid_reg = (struct cam_ife_csid_ver2_reg_info *)
 	csid_reg = (struct cam_ife_csid_ver2_reg_info *)
 			csid_hw->core_info->csid_reg;
 			csid_hw->core_info->csid_reg;
+	top_reg = csid_reg->top_reg;
 	cam_ife_csid_ver2_disable_csi2(csid_hw);
 	cam_ife_csid_ver2_disable_csi2(csid_hw);
 
 
 	/* Disable the top IRQ interrupt */
 	/* Disable the top IRQ interrupt */
@@ -3712,6 +3717,24 @@ static int cam_ife_csid_ver2_disable_core(
 		csid_hw->reset_irq_handle = 0;
 		csid_hw->reset_irq_handle = 0;
 	}
 	}
 
 
+	/*
+	 * Wrapper config can be reset only by ares from
+	 * camera subsystem power up or CSR ares bit
+	 * in CSID clk branch both of which are not
+	 * gauranteed at the end of a given CSID stream.
+	 * Explicitly resetting the config for full CSIDs
+	 * via AHB to avoid conflict on consecutive sessions
+	 */
+	if ((top_reg) && (!soc_private->is_ife_csid_lite)) {
+		cam_io_w_mb(top_reg->io_path_cfg_rst_val,
+			soc_info->reg_map[CAM_IFE_CSID_TOP_MEM_BASE_ID].mem_base +
+			top_reg->io_path_cfg0_addr[csid_hw->hw_intf->hw_idx]);
+
+		cam_io_w_mb(top_reg->dual_cfg_rst_val,
+			soc_info->reg_map[CAM_IFE_CSID_TOP_MEM_BASE_ID].mem_base +
+			top_reg->dual_csid_cfg0_addr[csid_hw->hw_intf->hw_idx]);
+	}
+
 	rc = cam_ife_csid_disable_soc_resources(soc_info);
 	rc = cam_ife_csid_disable_soc_resources(soc_info);
 	if (rc)
 	if (rc)
 		CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",
 		CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.h

@@ -207,6 +207,8 @@ struct cam_ife_csid_ver2_top_reg_info {
 	uint32_t master_slave_sel_shift_val;
 	uint32_t master_slave_sel_shift_val;
 	uint32_t master_sel_val;
 	uint32_t master_sel_val;
 	uint32_t slave_sel_val;
 	uint32_t slave_sel_val;
+	uint32_t io_path_cfg_rst_val;
+	uint32_t dual_cfg_rst_val;
 };
 };
 
 
 struct cam_ife_csid_ver2_rdi_reg_info {
 struct cam_ife_csid_ver2_rdi_reg_info {