Selaa lähdekoodia

msm: camera: icp: Add safety checks for IPE/BPS

Starting Waipio the FW region is stage 2 only,
as part of the dump IOCTL return success for lx7 since
the FW memory cannot be dumped in HLOS. Also ensure
IPE/BPS reset/PC/resume is done only if IPE/BPS cores
are powered on.

CRs-Fixed: 2841729
Change-Id: I61df98f9740410f2b5a9fee6142572715a391583
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 4 vuotta sitten
vanhempi
sitoutus
09c8ca0a28

+ 13 - 3
drivers/cam_icp/icp_hw/bps_hw/bps_core.c

@@ -158,6 +158,11 @@ static int cam_bps_handle_pc(struct cam_hw_info *bps_dev)
 	core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
 	hw_info = core_info->bps_hw_info;
 
+	if (!core_info->cpas_start) {
+		CAM_DBG(CAM_ICP, "CPAS BPS client not started");
+		return 0;
+	}
+
 	rc = cam_cpas_reg_read(core_info->cpas_handle,
 			CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
 			true, &pwr_ctrl);
@@ -224,6 +229,11 @@ static int cam_bps_handle_resume(struct cam_hw_info *bps_dev)
 	core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
 	hw_info = core_info->bps_hw_info;
 
+	if (!core_info->cpas_start) {
+		CAM_DBG(CAM_ICP, "CPAS BPS client not started");
+		return 0;
+	}
+
 	rc = cam_cpas_reg_read(core_info->cpas_handle,
 			CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
 			true, &pwr_ctrl);
@@ -279,9 +289,9 @@ static int cam_bps_cmd_reset(struct cam_hw_soc_info *soc_info,
 	CAM_DBG(CAM_ICP, "CAM_ICP_BPS_CMD_RESET");
 
 	if (!core_info->clk_enable || !core_info->cpas_start) {
-		CAM_ERR(CAM_ICP, "BPS reset failed. clk_en %d cpas_start %d",
-				core_info->clk_enable, core_info->cpas_start);
-		return -EINVAL;
+		CAM_DBG(CAM_ICP, "BPS not powered on clk_en %d cpas_start %d",
+			core_info->clk_enable, core_info->cpas_start);
+		return 0;
 	}
 
 	hw_info = core_info->bps_hw_info;

+ 14 - 4
drivers/cam_icp/icp_hw/ipe_hw/ipe_core.c

@@ -156,6 +156,11 @@ static int cam_ipe_handle_pc(struct cam_hw_info *ipe_dev)
 	core_info = (struct cam_ipe_device_core_info *)ipe_dev->core_info;
 	hw_info = core_info->ipe_hw_info;
 
+	if (!core_info->cpas_start) {
+		CAM_DBG(CAM_ICP, "CPAS IPE client not started");
+		return 0;
+	}
+
 	rc = cam_cpas_reg_read(core_info->cpas_handle,
 			CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
 			true, &pwr_ctrl);
@@ -223,6 +228,11 @@ static int cam_ipe_handle_resume(struct cam_hw_info *ipe_dev)
 	core_info = (struct cam_ipe_device_core_info *)ipe_dev->core_info;
 	hw_info = core_info->ipe_hw_info;
 
+	if (!core_info->cpas_start) {
+		CAM_DBG(CAM_ICP, "CPAS IPE client not started");
+		return 0;
+	}
+
 	rc = cam_cpas_reg_read(core_info->cpas_handle,
 			CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
 			true, &pwr_ctrl);
@@ -276,9 +286,9 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 
 	CAM_DBG(CAM_ICP, "CAM_ICP_IPE_CMD_RESET");
 	if (!core_info->clk_enable || !core_info->cpas_start) {
-		CAM_ERR(CAM_HFI, "IPE reset failed. clk_en %d cpas_start %d",
+		CAM_DBG(CAM_ICP, "IPE not powered on clk_en %d cpas_start %d",
 				core_info->clk_enable, core_info->cpas_start);
-		return -EINVAL;
+		return 0;
 	}
 
 	hw_info = core_info->ipe_hw_info;
@@ -293,7 +303,7 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 			IPE_RST_DONE_IRQ_STATUS_BIT, IPE_RST_DONE_IRQ_STATUS_BIT,
 			&status);
 
-		CAM_DBG(CAM_HFI, "ipe_cdm_irq_status = %u", status);
+		CAM_DBG(CAM_ICP, "ipe_cdm_irq_status = %u", status);
 		if ((status & IPE_RST_DONE_IRQ_STATUS_BIT) == 0x1)
 			break;
 		retry_cnt++;
@@ -316,7 +326,7 @@ static int cam_ipe_cmd_reset(struct cam_hw_soc_info *soc_info,
 			IPE_RST_DONE_IRQ_STATUS_BIT, IPE_RST_DONE_IRQ_STATUS_BIT,
 			&status);
 
-		CAM_DBG(CAM_HFI, "ipe_top_irq_status = %u", status);
+		CAM_DBG(CAM_ICP, "ipe_top_irq_status = %u", status);
 
 		if ((status & IPE_RST_DONE_IRQ_STATUS_BIT) == 0x1)
 			break;

+ 4 - 0
drivers/cam_icp/icp_hw/lx7_hw/lx7_core.c

@@ -825,6 +825,10 @@ int cam_lx7_process_cmd(void *priv, uint32_t cmd_type,
 		rc = __cam_lx7_update_clk_rate(lx7_info, args);
 		break;
 	}
+	case CAM_ICP_CMD_HW_DUMP:
+		/* Not supported for lx7 */
+		rc = 0;
+		break;
 	default:
 		CAM_ERR(CAM_ICP, "invalid command type=%u", cmd_type);
 		break;