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 <kjayakum@codeaurora.org>
This commit is contained in:
Karthik Jayakumar
2021-10-05 14:23:05 -07:00
parent 3634a75a4e
commit ed82a7cc9c
5 changed files with 32 additions and 25 deletions

View File

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

View File

@@ -20,6 +20,7 @@
#include "lx7_reg.h" #include "lx7_reg.h"
#include "lx7_soc.h" #include "lx7_soc.h"
#include "cam_common_util.h" #include "cam_common_util.h"
#include "cam_compat.h"
#define TZ_STATE_SUSPEND 0 #define TZ_STATE_SUSPEND 0
#define TZ_STATE_RESUME 1 #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; 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) if (ddr_type == DDR_TYPE_LPDDR5 || ddr_type == DDR_TYPE_LPDDR5X)
i = 1; i = 1;

View File

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

View File

@@ -248,7 +248,7 @@ end:
return rc; 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> #include <linux/qcom-iommu-util.h>
void cam_check_iommu_faults(struct iommu_domain *domain, void cam_check_iommu_faults(struct iommu_domain *domain,
struct cam_smmu_pf_info *pf_info) 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->pid = fault_ids.pid;
pf_info->mid = fault_ids.mid; 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 #endif

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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_ #ifndef _CAM_COMPAT_H_
@@ -9,36 +9,23 @@
#include <linux/version.h> #include <linux/version.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/component.h> #include <linux/component.h>
#include <linux/iommu.h>
#include <linux/qcom_scm.h>
#include "cam_csiphy_dev.h" #include "cam_csiphy_dev.h"
#include "cam_cpastop_hw.h" #include "cam_cpastop_hw.h"
#include "cam_smmu_api.h" #include "cam_smmu_api.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 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>
#include <linux/ion.h> #include <linux/ion.h>
#include <linux/qcom_scm.h>
#else
#include <linux/msm_ion.h> #include <linux/msm_ion.h>
#include <linux/ion_kernel.h> #define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
#include <soc/qcom/scm.h>
#endif #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> #include <linux/qcom-dma-mapping.h>
#endif #endif
struct cam_fw_alloc_info { 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_free_clear(const void *);
void cam_check_iommu_faults(struct iommu_domain *domain, void cam_check_iommu_faults(struct iommu_domain *domain,
struct cam_smmu_pf_info *pf_info); struct cam_smmu_pf_info *pf_info);
int cam_get_ddr_type(void);
#endif /* _CAM_COMPAT_H_ */ #endif /* _CAM_COMPAT_H_ */