Browse Source

msm: camera: common: DDR type selection deprecation

Deprecates legacy api of_fdt_get_ddrtype() as new targets only have
LPDDR5 for platforms that support linux kernel 5.15 and newer.

CRs-Fixed: 3048249
Change-Id: I8e7f3274eadc597870118956b964fb87d69549ee
Signed-off-by: Karthik Jayakumar <[email protected]>
Karthik Jayakumar 3 năm trước cách đây
mục cha
commit
ed82a7cc9c

+ 3 - 1
drivers/cam_icp/icp_hw/a5_hw/a5_core.c

@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <media/cam_icp.h>
+
 #include "cam_io_util.h"
 #include "cam_a5_hw_intf.h"
 #include "cam_hw.h"
@@ -28,6 +29,7 @@
 #include "cam_debug_util.h"
 #include "cam_icp_utils.h"
 #include "cam_common_util.h"
+#include "cam_compat.h"
 
 #define PC_POLL_DELAY_US 100
 #define PC_POLL_TIMEOUT_US 10000
@@ -678,7 +680,7 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
 
 		if (a5_soc->ubwc_config_ext) {
 			/* Invoke kernel API to determine DDR type */
-			ddr_type = of_fdt_get_ddrtype();
+			ddr_type = cam_get_ddr_type();
 			if ((ddr_type == DDR_TYPE_LPDDR5) ||
 				(ddr_type == DDR_TYPE_LPDDR5X))
 				index = 1;

+ 2 - 1
drivers/cam_icp/icp_hw/lx7_hw/lx7_core.c

@@ -20,6 +20,7 @@
 #include "lx7_reg.h"
 #include "lx7_soc.h"
 #include "cam_common_util.h"
+#include "cam_compat.h"
 
 #define TZ_STATE_SUSPEND 0
 #define TZ_STATE_RESUME  1
@@ -45,7 +46,7 @@ static int cam_lx7_ubwc_configure(struct cam_hw_soc_info *soc_info)
 
 	soc_priv = soc_info->soc_private;
 
-	ddr_type = of_fdt_get_ddrtype();
+	ddr_type = cam_get_ddr_type();
 	if (ddr_type == DDR_TYPE_LPDDR5 || ddr_type == DDR_TYPE_LPDDR5X)
 		i = 1;
 

+ 2 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -25,6 +25,7 @@
 #include "cam_trace.h"
 #include "cam_smmu_api.h"
 #include "cam_common_util.h"
+#include "cam_compat.h"
 
 static const char drv_name[] = "vfe_bus";
 
@@ -1881,7 +1882,7 @@ static int cam_vfe_bus_ver3_init_comp_grp(uint32_t index,
 		rsrc_data->comp_grp_type != CAM_VFE_BUS_VER3_COMP_GRP_1)
 		rsrc_data->ubwc_static_ctrl = 0;
 	else {
-		ddr_type = of_fdt_get_ddrtype();
+		ddr_type = cam_get_ddr_type();
 		if ((ddr_type == DDR_TYPE_LPDDR5) ||
 			(ddr_type == DDR_TYPE_LPDDR5X))
 			rsrc_data->ubwc_static_ctrl =

+ 16 - 1
drivers/cam_utils/cam_compat.c

@@ -248,7 +248,7 @@ end:
 	return rc;
 }
 
-#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
 #include <linux/qcom-iommu-util.h>
 void cam_check_iommu_faults(struct iommu_domain *domain,
 	struct cam_smmu_pf_info *pf_info)
@@ -281,4 +281,19 @@ void cam_check_iommu_faults(struct iommu_domain *domain,
 	pf_info->pid = fault_ids.pid;
 	pf_info->mid = fault_ids.mid;
 }
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+int cam_get_ddr_type(void)
+{
+	/* We assume all chipsets running kernel version 5.15+
+	 * to be using only DDR5 based memory.
+	 */
+	return DDR_TYPE_LPDDR5;
+}
+#else
+int cam_get_ddr_type(void)
+{
+	return of_fdt_get_ddrtype();
+}
 #endif

+ 9 - 21
drivers/cam_utils/cam_compat.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _CAM_COMPAT_H_
@@ -9,36 +9,23 @@
 #include <linux/version.h>
 #include <linux/platform_device.h>
 #include <linux/component.h>
+#include <linux/iommu.h>
+#include <linux/qcom_scm.h>
 
 #include "cam_csiphy_dev.h"
 #include "cam_cpastop_hw.h"
 #include "cam_smmu_api.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
-
-#define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
-
-#endif
-
-#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
-
-#include <linux/msm_ion.h>
-#include <linux/iommu.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
 #include <linux/ion.h>
-#include <linux/qcom_scm.h>
-
-#else
-
 #include <linux/msm_ion.h>
-#include <linux/ion_kernel.h>
-#include <soc/qcom/scm.h>
-
+#define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
 #endif
 
-#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) && \
+	LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
+#include <soc/qcom/of_common.h>
 #include <linux/qcom-dma-mapping.h>
-
 #endif
 
 struct cam_fw_alloc_info {
@@ -58,5 +45,6 @@ int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
 void cam_free_clear(const void *);
 void cam_check_iommu_faults(struct iommu_domain *domain,
 	struct cam_smmu_pf_info *pf_info);
+int cam_get_ddr_type(void);
 
 #endif /* _CAM_COMPAT_H_ */