Explorar el Código

Merge "msm: camera: icp: Add support for fw pas id" into camera-kernel.lnx.7.0

Camera Software Integration hace 1 año
padre
commit
1361bffa3d

+ 12 - 0
drivers/cam_icp/icp_hw/icp_proc/icp_common/cam_icp_soc_common.c

@@ -160,6 +160,16 @@ static int cam_icp_soc_get_hw_version(struct device_node *np,
 	return rc;
 }
 
+static void cam_icp_soc_get_fw_pas_id(struct device_node *np,
+	struct cam_icp_soc_info *icp_soc_info)
+{
+	if (of_property_read_u32(np, "fw-pas-id", &icp_soc_info->fw_pas_id)) {
+		CAM_WARN(CAM_ICP, "PAS_ID is not passed from DTSI and use default value: %d",
+			CAM_FW_PAS_ID_DEFAULT);
+		icp_soc_info->fw_pas_id = CAM_FW_PAS_ID_DEFAULT;
+	}
+}
+
 static int cam_icp_soc_dt_properties_get(struct cam_hw_soc_info *soc_info)
 {
 	struct cam_icp_soc_info *icp_soc_info;
@@ -188,6 +198,8 @@ static int cam_icp_soc_dt_properties_get(struct cam_hw_soc_info *soc_info)
 
 	cam_icp_soc_qos_get(np, icp_soc_info);
 
+	cam_icp_soc_get_fw_pas_id(np, icp_soc_info);
+
 	rc = cam_icp_soc_get_hw_version(np, icp_soc_info);
 	if (rc) {
 		CAM_ERR(CAM_ICP, "Get ICP HW version failed");

+ 5 - 1
drivers/cam_icp/icp_hw/icp_proc/icp_common/cam_icp_soc_common.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef CAM_ICP_SOC_COMMON_H
@@ -15,6 +15,8 @@
 #define CAM_ICP_V2_VERSION   0x0200
 #define CAM_ICP_V2_1_VERSION 0x0201
 
+#define CAM_FW_PAS_ID_DEFAULT 33
+
 /**
  * struct cam_icp_ubwc_cfg - ICP ubwc cfg
  * @ipe_fetch: UBWC configuration for IPE fetch.
@@ -41,6 +43,7 @@ struct cam_icp_ubwc_cfg {
  * @dev_type: Device type.
  * @qos_val: QOS value.
  * @hw_version: hw version.
+ * @fw_pas_id: Firmware pas id
  * @uconfig: union of ubwc_cfg_ext and ubwc_cfg. ubwc_cfg may
  *           be used in icp_v1 for older chipsets. icp_v2 only
  *           uses ubwc_cfg_ext.
@@ -50,6 +53,7 @@ struct cam_icp_soc_info {
 	enum cam_icp_hw_type dev_type;
 	uint32_t qos_val;
 	uint32_t hw_version;
+	uint32_t fw_pas_id;
 	union {
 		uint32_t ubwc_cfg[ICP_UBWC_CFG_MAX];
 		struct cam_icp_ubwc_cfg ubwc_cfg_ext;

+ 14 - 6
drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_core.c

@@ -594,7 +594,8 @@ err:
 }
 
 #if IS_REACHABLE(CONFIG_QCOM_MDT_LOADER)
-static int __load_firmware(struct platform_device *pdev)
+static int __load_firmware(struct platform_device *pdev,
+	uint32_t fw_pas_id)
 {
 	const char *fw_name;
 	const struct firmware *firmware = NULL;
@@ -669,7 +670,7 @@ static int __load_firmware(struct platform_device *pdev)
 		goto out;
 	}
 
-	rc = qcom_mdt_load(&pdev->dev, firmware, firmware_name, CAM_FW_PAS_ID,
+	rc = qcom_mdt_load(&pdev->dev, firmware, firmware_name, fw_pas_id,
 			vaddr, res_start, res_size, NULL);
 	if (rc) {
 		CAM_ERR(CAM_ICP, "failed to load firmware rc=%d", rc);
@@ -690,6 +691,7 @@ static int cam_icp_v2_boot(struct cam_hw_info *icp_v2_info,
 {
 	int rc;
 	struct cam_icp_v2_core_info *core_info = NULL;
+	struct cam_icp_soc_info     *soc_priv;
 
 	if (!IS_REACHABLE(CONFIG_QCOM_MDT_LOADER))
 		return -EOPNOTSUPP;
@@ -707,17 +709,19 @@ static int cam_icp_v2_boot(struct cam_hw_info *icp_v2_info,
 	}
 
 	core_info = (struct cam_icp_v2_core_info *)icp_v2_info->core_info;
+	soc_priv = (struct cam_icp_soc_info *)icp_v2_info->soc_info.soc_private;
+
 	prepare_boot(icp_v2_info, args);
 
 #if IS_REACHABLE(CONFIG_QCOM_MDT_LOADER)
-	rc = __load_firmware(icp_v2_info->soc_info.pdev);
+	rc = __load_firmware(icp_v2_info->soc_info.pdev, soc_priv->fw_pas_id);
 	if (rc) {
 		CAM_ERR(CAM_ICP, "firmware loading failed rc=%d", rc);
 		goto err;
 	}
 #endif
 
-	rc = qcom_scm_pas_auth_and_reset(CAM_FW_PAS_ID);
+	rc = qcom_scm_pas_auth_and_reset(soc_priv->fw_pas_id);
 	if (rc) {
 		CAM_ERR(CAM_ICP, "auth and reset failed rc=%d", rc);
 		goto err;
@@ -735,11 +739,13 @@ static int cam_icp_v2_shutdown(struct cam_hw_info *icp_v2_info)
 	int rc = 0;
 	struct cam_icp_v2_core_info *core_info =
 		(struct cam_icp_v2_core_info *)icp_v2_info->core_info;
+	struct cam_icp_soc_info *soc_priv =
+		(struct cam_icp_soc_info *)icp_v2_info->soc_info.soc_private;
 
 	prepare_shutdown(icp_v2_info);
 
 	if (core_info->use_sec_pil)
-		rc = qcom_scm_pas_shutdown(CAM_FW_PAS_ID);
+		rc = qcom_scm_pas_shutdown(soc_priv->fw_pas_id);
 	else {
 		int32_t sys_base_idx = core_info->reg_base_idx[ICP_V2_SYS_BASE];
 		void __iomem *base;
@@ -799,9 +805,11 @@ static int cam_icp_v2_core_control(struct cam_hw_info *icp_v2_info,
 	int rc = 0;
 	struct cam_icp_v2_core_info *core_info =
 		(struct cam_icp_v2_core_info *)icp_v2_info->core_info;
+	struct cam_icp_soc_info *soc_priv =
+		(struct cam_icp_soc_info *)icp_v2_info->soc_info.soc_private;
 
 	if (core_info->use_sec_pil) {
-		rc = qcom_scm_set_remote_state(state, CAM_FW_PAS_ID);
+		rc = qcom_scm_set_remote_state(state, soc_priv->fw_pas_id);
 		if (rc) {
 			CAM_ERR(CAM_ICP,
 				"remote state set to %s failed rc=%d",

+ 1 - 4
drivers/cam_icp/icp_hw/icp_proc/icp_v2_hw/cam_icp_v2_core.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _CAM_ICP_V2_CORE_H_
@@ -12,9 +12,6 @@
 #include "hfi_intf.h"
 #include "cam_icp_v2_reg.h"
 
-#define UNSUPPORTED_PROC_PAS_ID   30
-#define CAM_FW_PAS_ID             33
-
 /* Domain ID masks */
 #define ICP_V2_DOMAIN_MASK_CFG_0 0x00FF00FF
 #define ICP_V2_DOMAIN_MASK_CFG_1 0xFF00FF00