diff --git a/config/pineapple.mk b/config/pineapple.mk index ce6f33ab15..4b6e8d1274 100644 --- a/config/pineapple.mk +++ b/config/pineapple.mk @@ -17,6 +17,7 @@ ccflags-y += -DCONFIG_SPECTRA_SENSOR=1 ccflags-y += -DCONFIG_SPECTRA_LLCC_STALING=1 ccflags-y += -DCONFIG_SPECTRA_USE_RPMH_DRV_API=1 ccflags-y += -DCONFIG_SPECTRA_USE_CLK_CRM_API=1 +ccflags-y += -DCONFIG_DOMAIN_ID_SECURE_CAMERA=1 # External Dependencies KBUILD_CPPFLAGS += -DCONFIG_MSM_MMRM=1 diff --git a/drivers/cam_cpas/cam_cpas_soc.c b/drivers/cam_cpas/cam_cpas_soc.c index fc70e0c7dd..23fd1b527b 100644 --- a/drivers/cam_cpas/cam_cpas_soc.c +++ b/drivers/cam_cpas/cam_cpas_soc.c @@ -1019,6 +1019,7 @@ end: return rc; } +#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA static int cam_cpas_parse_domain_id_mapping(struct device_node *of_node, struct cam_cpas_private_soc *soc_private) { @@ -1103,6 +1104,7 @@ err: soc_private->domain_id_info.domain_id_entries = NULL; return rc; } +#endif static int cam_cpas_get_domain_id_support_clks(struct device_node *of_node, struct cam_hw_soc_info *soc_info, struct cam_cpas_private_soc *soc_private) @@ -1195,10 +1197,17 @@ int cam_cpas_get_custom_dt_info(struct cam_hw_info *cpas_hw, cam_cpas_get_hw_features(pdev, soc_private); +#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA /* get domain id mapping info */ rc = cam_cpas_parse_domain_id_mapping(of_node, soc_private); if (rc) return rc; + /* check if the domain ID configuration is available in the DTSI */ + if (soc_private->domain_id_info.domain_id_supported == false) { + CAM_ERR(CAM_CPAS, "Domain ID configuration is expected for this target"); + return -EINVAL; + } +#endif soc_private->camnoc_axi_min_ib_bw = 0; rc = of_property_read_u64(of_node, diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c index d0a912b8d1..baa8c3362b 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c @@ -5333,7 +5333,7 @@ int cam_ife_csid_ver2_start(void *hw_priv, void *args, */ if ((csid_hw->sync_mode != CAM_ISP_HW_SYNC_SLAVE) && start_args->is_secure && - cam_is_mink_api_available()) + csid_hw->flags.domain_id_security) cam_ife_csid_ver2_send_secure_info(start_args, csid_hw); /* diff --git a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_core.c b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_core.c index 7eeaea072e..bb912907fb 100644 --- a/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_core.c +++ b/drivers/cam_sensor_module/cam_csiphy/cam_csiphy_core.c @@ -487,10 +487,8 @@ static int cam_csiphy_update_secure_info(struct csiphy_device *csiphy_dev, int32 uint32_t cpas_version; int rc; - if (cam_is_mink_api_available()) { - CAM_DBG(CAM_CSIPHY, "Using MINK API for CSIPHY [%u], skipping legacy update", - csiphy_dev->soc_info.index); - + if (csiphy_dev->domain_id_security) { + CAM_DBG(CAM_CSIPHY, "Target supports domain ID security, skipping legacy update"); return 0; } @@ -1314,14 +1312,18 @@ static int cam_csiphy_program_secure_mode(struct csiphy_device *csiphy_dev, } rc = cam_cpas_enable_clks_for_domain_id(true); - if (rc) + if (rc) { + CAM_ERR(CAM_CSIPHY, "Failed to enable the Domain ID clocks"); return rc; + } } rc = cam_csiphy_notify_secure_mode(csiphy_dev, protect, offset, is_shutdown); if (csiphy_dev->domain_id_security) { - cam_cpas_enable_clks_for_domain_id(false); + if (cam_cpas_enable_clks_for_domain_id(false)) + CAM_ERR(CAM_CSIPHY, "Failed to disable the Domain ID clocks"); + if (!protect) csiphy_dev->csiphy_info[offset].secure_info_updated = false; } diff --git a/drivers/cam_utils/cam_compat.c b/drivers/cam_utils/cam_compat.c index 889fc58d62..5e421204e5 100644 --- a/drivers/cam_utils/cam_compat.c +++ b/drivers/cam_utils/cam_compat.c @@ -318,15 +318,7 @@ void cam_free_clear(const void * ptr) } #endif -bool cam_is_mink_api_available(void) -{ -#if KERNEL_VERSION(6, 0, 0) <= LINUX_VERSION_CODE - return true; -#else - return false; -#endif -} -#if KERNEL_VERSION(6, 0, 0) <= LINUX_VERSION_CODE +#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev, bool protect, int32_t offset, bool is_shutdown) { diff --git a/drivers/cam_utils/cam_compat.h b/drivers/cam_utils/cam_compat.h index febfe9b9ad..4486cce08d 100644 --- a/drivers/cam_utils/cam_compat.h +++ b/drivers/cam_utils/cam_compat.h @@ -44,7 +44,7 @@ MODULE_IMPORT_NS(DMA_BUF); #endif -#if KERNEL_VERSION(6, 0, 0) <= LINUX_VERSION_CODE +#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA #include #include #include