Procházet zdrojové kódy

Merge "msm: camera: utils: use updated SCM calls for csf2.5" into camera-kernel.lnx.7.0

Camera Software Integration před 9 měsíci
rodič
revize
b11ccc186f

+ 8 - 0
Kconfig

@@ -99,6 +99,14 @@ config DOMAIN_ID_SECURE_CAMERA
 		domain ID based security architecture.
 		VC based security can be achieved with this.
 
+config CSF_2_5_SECURE_CAMERA
+	bool "enable CSF2.5 feature flow"
+	help
+		This is to enable Call flow for CSF2.5
+		enabled platforms. this config differentiates
+		between csf2.0 and csf 2.5 compliant
+		scm calls.
+
 config DYNAMIC_FD_PORT_CONFIG
 	bool "enable dynamic FD port config feature"
 	help

+ 2 - 0
config/cliffs.mk

@@ -9,6 +9,7 @@ CONFIG_SPECTRA_LLCC_STALING := y
 CONFIG_SPECTRA_USE_RPMH_DRV_API := y
 CONFIG_SPECTRA_USE_CLK_CRM_API := y
 CONFIG_DOMAIN_ID_SECURE_CAMERA := y
+CONFIG_CSF_2_5_SECURE_CAMERA := y
 
 # Flags to pass into C preprocessor
 ccflags-y += -DCONFIG_SPECTRA_ISP=1
@@ -19,6 +20,7 @@ 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
+ccflags-y += -DCONFIG_CSF_2_5_SECURE_CAMERA=1
 
 # External Dependencies
 KBUILD_CPPFLAGS += -DCONFIG_MSM_MMRM=1

+ 2 - 0
config/pineapple.mk

@@ -11,6 +11,7 @@ CONFIG_SPECTRA_USE_RPMH_DRV_API := y
 CONFIG_SPECTRA_USE_CLK_CRM_API := y
 CONFIG_DOMAIN_ID_SECURE_CAMERA := y
 CONFIG_DYNAMIC_FD_PORT_CONFIG := y
+CONFIG_CSF_2_5_SECURE_CAMERA := y
 
 # Flags to pass into C preprocessor
 ccflags-y += -DCONFIG_SPECTRA_ISP=1
@@ -23,6 +24,7 @@ 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
 ccflags-y += -DCONFIG_DYNAMIC_FD_PORT_CONFIG=1
+ccflags-y += -DCONFIG_CSF_2_5_SECURE_CAMERA=1
 
 # External Dependencies
 KBUILD_CPPFLAGS += -DCONFIG_MSM_MMRM=1

+ 2 - 0
config/volcano.mk

@@ -6,6 +6,7 @@ CONFIG_SPECTRA_ICP := y
 CONFIG_SPECTRA_TFE := y
 CONFIG_SPECTRA_CRE := y
 CONFIG_SPECTRA_SENSOR := y
+CONFIG_CSF_2_5_SECURE_CAMERA := y
 
 # Flags to pass into C preprocessor
 ccflags-y += -DCONFIG_SPECTRA_ISP=1
@@ -13,3 +14,4 @@ ccflags-y += -DCONFIG_SPECTRA_ICP=1
 ccflags-y += -DCONFIG_SPECTRA_TFE=1
 ccflags-y += -DCONFIG_SPECTRA_CRE=1
 ccflags-y += -DCONFIG_SPECTRA_SENSOR=1
+ccflags-y += -DCONFIG_CSF_2_5_SECURE_CAMERA=1

+ 42 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_core.c

@@ -1065,6 +1065,38 @@ end:
 	return rc;
 }
 
+static void cam_tfe_csid_send_secure_info(
+	struct cam_tfe_csid_hw  *csid_hw)
+{
+	struct cam_tfe_csid_secure_info   secure_info;
+	const struct cam_tfe_csid_reg_offset   *csid_reg;
+	int                               phy_sel = 0;
+
+	csid_reg = csid_hw->csid_info->csid_reg;
+
+	secure_info.lane_cfg = csid_hw->csi2_rx_cfg.lane_cfg;
+	secure_info.cdm_hw_idx_mask = 0;
+	secure_info.vc_mask = 0;
+	secure_info.csid_hw_idx_mask = BIT(csid_hw->hw_intf->hw_idx);
+
+	CAM_DBG(CAM_ISP,
+		"PHY secure info for CSID[%u], lane_cfg: 0x%x, tfe: 0x%x, cdm: 0x%x, vc_mask: 0x%llx",
+		csid_hw->hw_intf->hw_idx, secure_info.lane_cfg, secure_info.csid_hw_idx_mask,
+		secure_info.cdm_hw_idx_mask, secure_info.vc_mask);
+
+	phy_sel = (int)(csid_hw->csi2_rx_cfg.phy_sel - csid_reg->csi2_reg->phy_sel_base);
+	if (phy_sel < 0) {
+		CAM_WARN(CAM_ISP, "Can't notify csiphy, incorrect phy selected=%d",
+			phy_sel);
+	} else {
+		secure_info.phy_sel = (uint32_t)phy_sel;
+		CAM_DBG(CAM_ISP, "Notify CSIPHY: %d", phy_sel);
+		cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
+			CAM_SUBDEV_MESSAGE_DOMAIN_ID_SECURE_PARAMS, (void *)&secure_info);
+	}
+
+}
+
 static int cam_tfe_csid_enable_csi2(
 	struct cam_tfe_csid_hw          *csid_hw)
 {
@@ -1246,8 +1278,8 @@ static int cam_tfe_csid_enable_hw(struct cam_tfe_csid_hw  *csid_hw)
 		return rc;
 	}
 
-	CAM_DBG(CAM_ISP, "CSID:%d init CSID HW",
-		csid_hw->hw_intf->hw_idx);
+	CAM_DBG(CAM_ISP, "CSID:%d init CSID HW is_secure: %d",
+		csid_hw->hw_intf->hw_idx, csid_hw->is_secure);
 
 	rc = cam_soc_util_get_clk_level(soc_info, csid_hw->clk_rate,
 		soc_info->src_clk_idx, &clk_lvl);
@@ -1329,6 +1361,9 @@ static int cam_tfe_csid_enable_hw(struct cam_tfe_csid_hw  *csid_hw)
 		path_data->res_sof_cnt = 0;
 	}
 
+	if (csid_hw->is_secure)
+		cam_tfe_csid_send_secure_info(csid_hw);
+
 
 	return rc;
 
@@ -2691,8 +2726,10 @@ static int cam_tfe_csid_reserve(void *hw_priv,
 		return -EINVAL;
 	}
 
-	CAM_DBG(CAM_ISP, "res_type %d, CSID: %u",
-		reserv->res_type, csid_hw->hw_intf->hw_idx);
+	csid_hw->is_secure = reserv->out_port->secure_mode;
+
+	CAM_DBG(CAM_ISP, "res_type %d, CSID: %u is_secure: %d",
+		reserv->res_type, csid_hw->hw_intf->hw_idx, csid_hw->is_secure);
 
 	mutex_lock(&csid_hw->hw_info->hw_mutex);
 	rc = cam_tfe_csid_path_reserve(csid_hw, reserv);
@@ -2738,6 +2775,7 @@ static int cam_tfe_csid_release(void *hw_priv,
 
 	csid_hw->event_cb = NULL;
 	csid_hw->event_cb_priv = NULL;
+	csid_hw->is_secure = false;
 
 	if ((res->res_state <= CAM_ISP_RESOURCE_STATE_AVAILABLE) ||
 		(res->res_state >= CAM_ISP_RESOURCE_STATE_STREAMING)) {

+ 29 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_core.h

@@ -331,6 +331,33 @@ struct cam_tfe_csid_reg_offset {
 	const struct cam_tfe_csid_rdi_reg_offset *rdi_reg[CAM_TFE_CSID_RDI_MAX];
 };
 
+/**
+ * struct cam_tfe_csid_secure_info: Contains all relevant info to be
+ *                                  programmed for targets supporting
+ *                                  this feature
+ * @phy_sel:          Intermediate value for this mask. CSID passes
+ *                    phy_sel.This variable's position at the top is to
+ *                    be left unchanged, to have it be used correctly
+ *                    in the cam_subdev_notify_message callback for
+ *                    csiphy
+ * @lane_cfg:         This value is similar to lane_assign in the PHY
+ *                    driver, and is used to identify the particular
+ *                    PHY instance with which this IFE session is
+ *                    connected to.
+ * @vc_mask:          Virtual channel masks (Unused for mobile usecase)
+ * @csid_hw_idx_mask: Bit position denoting CSID(s) in use for secure
+ *                    session
+ * @cdm_hw_idx_mask:  Bit position denoting CDM in use for secure
+ *                    session
+ */
+struct cam_tfe_csid_secure_info {
+	uint32_t phy_sel;
+	uint32_t lane_cfg;
+	uint64_t vc_mask;
+	uint32_t csid_hw_idx_mask;
+	uint32_t cdm_hw_idx_mask;
+};
+
 /**
  * struct cam_tfe_csid_hw_info- CSID HW info
  *
@@ -511,6 +538,7 @@ struct cam_csid_evt_payload {
  * @prev_boot_timestamp       previous frame bootime stamp
  * @prev_qtimer_ts            previous frame qtimer csid timestamp
  * @sync_clk                  sync clocks such that freq(TFE)>freq(CSID)>freq(CSIPHY)
+ * @is_secure                 Flag to denote secure operation
  *
  */
 struct cam_tfe_csid_hw {
@@ -548,6 +576,7 @@ struct cam_tfe_csid_hw {
 	uint64_t                            prev_boot_timestamp;
 	uint64_t                            prev_qtimer_ts;
 	bool                                sync_clk;
+	bool                                is_secure;
 };
 
 int cam_tfe_csid_hw_probe_init(struct cam_hw_intf  *csid_hw_intf,

+ 1 - 1
drivers/cam_utils/cam_compat.c

@@ -318,7 +318,7 @@ void cam_free_clear(const void * ptr)
 }
 #endif
 
-#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA
+#ifdef CONFIG_CSF_2_5_SECURE_CAMERA
 int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
 	bool protect, int32_t offset, bool is_shutdown)
 {

+ 1 - 1
drivers/cam_utils/cam_compat.h

@@ -44,7 +44,7 @@
 MODULE_IMPORT_NS(DMA_BUF);
 #endif
 
-#ifdef CONFIG_DOMAIN_ID_SECURE_CAMERA
+#ifdef CONFIG_CSF_2_5_SECURE_CAMERA
 #include <linux/IClientEnv.h>
 #include <linux/ITrustedCameraDriver.h>
 #include <linux/CTrustedCameraDriver.h>

+ 1 - 0
pineapple_defconfig

@@ -11,3 +11,4 @@ CONFIG_MSM_MMRM=y
 CONFIG_INTERCONNECT_QCOM=y
 CONFIG_DOMAIN_ID_SECURE_CAMERA=y
 CONFIG_DYNAMIC_FD_PORT_CONFIG=y
+CONFIG_CSF_2_5_SECURE_CAMERA=y

+ 1 - 0
volcano_defconfig

@@ -4,3 +4,4 @@ CONFIG_SPECTRA_TFE=y
 CONFIG_SPECTRA_CRE=y
 CONFIG_SPECTRA_SENSOR=y
 CONFIG_INTERCONNECT_QCOM=y
+CONFIG_CSF_2_5_SECURE_CAMERA=y