msm: camera: csiphy: Refine MINK API usage for secure camera

Use MINK API for all the targets that support domain ID and
use legacy API for all other targets. In addition, use a
target based macro to not compile the MINK API for the
older targets where those APIs are not defined.

Change-Id: I0d8f05df6ca8126db1e3ad8456fe78aa77a33ebf
CRs-Fixed: 3529425
Signed-off-by: Vijay Kumar Tumati <quic_vtumati@quicinc.com>
这个提交包含在:
Vijay Kumar Tumati
2023-06-13 11:45:12 -07:00
提交者 Camera Software Integration
父节点 a795d64c87
当前提交 db988fcff4
修改 6 个文件,包含 21 行新增17 行删除

查看文件

@@ -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

查看文件

@@ -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,

查看文件

@@ -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);
/*

查看文件

@@ -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;
}

查看文件

@@ -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)
{

查看文件

@@ -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 <linux/smcinvoke.h>
#include <linux/IClientEnv.h>
#include <linux/ITrustedCameraDriver.h>