icnss2: Additional platform changes for sun

Current code has compilation errors for sun kernel.
Fix this by resolving the errors.

Change-Id: I903f4c4ca0301626062c3b5d11069feaba48850a
CRs-Fixed: 3632179
This commit is contained in:
Mohammed Ahmed
2023-10-03 17:03:04 -07:00
committed by Ravindra Konda
parent 41022800bc
commit 0a9f61aed2
2 changed files with 143 additions and 14 deletions

View File

@@ -44,7 +44,10 @@
#include <linux/remoteproc/qcom_rproc.h>
#include <linux/soc/qcom/pdr.h>
#include <linux/remoteproc.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
#include <trace/hooks/remoteproc.h>
#endif
#ifdef SLATE_MODULE_ENABLED
#include <linux/soc/qcom/slatecom_interface.h>
#include <linux/soc/qcom/slate_events_bridge_intf.h>
@@ -2676,7 +2679,11 @@ static int icnss_ramdump_devnode_init(struct icnss_priv *priv)
{
int ret = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
priv->icnss_ramdump_class = class_create(THIS_MODULE, ICNSS_RAMDUMP_NAME);
#else
priv->icnss_ramdump_class = class_create(ICNSS_RAMDUMP_NAME);
#endif
if (IS_ERR_OR_NULL(priv->icnss_ramdump_class)) {
ret = PTR_ERR(priv->icnss_ramdump_class);
icnss_pr_err("%s:Class create failed for ramdump devices (%d)\n", __func__, ret);
@@ -3706,6 +3713,20 @@ struct iommu_domain *icnss_smmu_get_domain(struct device *dev)
}
EXPORT_SYMBOL(icnss_smmu_get_domain);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
int icnss_iommu_map(struct iommu_domain *domain,
unsigned long iova, phys_addr_t paddr, size_t size, int prot)
{
return iommu_map(domain, iova, paddr, size, prot);
}
#else
int icnss_iommu_map(struct iommu_domain *domain,
unsigned long iova, phys_addr_t paddr, size_t size, int prot)
{
return iommu_map(domain, iova, paddr, size, prot, GFP_KERNEL);
}
#endif
int icnss_smmu_map(struct device *dev,
phys_addr_t paddr, uint32_t *iova_addr, size_t size)
{
@@ -3749,7 +3770,7 @@ int icnss_smmu_map(struct device *dev,
icnss_pr_dbg("IOMMU Map: iova %lx, len %zu\n", iova, len);
ret = iommu_map(priv->iommu_domain, iova,
ret = icnss_iommu_map(priv->iommu_domain, iova,
rounddown(paddr, PAGE_SIZE), len,
flag);
if (ret) {
@@ -4161,6 +4182,39 @@ static void icnss_remove_sysfs_link(struct icnss_priv *priv)
sysfs_remove_link(kernel_kobj, "icnss");
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
union icnss_device_group_devres {
const struct attribute_group *group;
};
static void devm_icnss_group_remove(struct device *dev, void *res)
{
union icnss_device_group_devres *devres = res;
const struct attribute_group *group = devres->group;
icnss_pr_dbg("%s: removing group %p\n", __func__, group);
sysfs_remove_group(&dev->kobj, group);
}
static int devm_icnss_group_match(struct device *dev, void *res, void *data)
{
return ((union icnss_device_group_devres *)res) == data;
}
static void icnss_devm_device_remove_group(struct icnss_priv *priv)
{
WARN_ON(devres_release(&priv->pdev->dev,
devm_icnss_group_remove, devm_icnss_group_match,
(void *)&icnss_attr_group));
}
#else
static void icnss_devm_device_remove_group(struct icnss_priv *priv)
{
devm_device_remove_group(&priv->pdev->dev, &icnss_attr_group);
}
#endif
static int icnss_sysfs_create(struct icnss_priv *priv)
{
int ret = 0;
@@ -4181,7 +4235,7 @@ static int icnss_sysfs_create(struct icnss_priv *priv)
return 0;
remove_icnss_group:
devm_device_remove_group(&priv->pdev->dev, &icnss_attr_group);
icnss_devm_device_remove_group(priv);
out:
return ret;
}
@@ -4190,7 +4244,7 @@ static void icnss_sysfs_destroy(struct icnss_priv *priv)
{
icnss_destroy_shutdown_sysfs(priv);
icnss_remove_sysfs_link(priv);
devm_device_remove_group(&priv->pdev->dev, &icnss_attr_group);
icnss_devm_device_remove_group(priv);
}
static int icnss_resource_parse(struct icnss_priv *priv)
@@ -4612,6 +4666,7 @@ static inline bool icnss_use_nv_mac(struct icnss_priv *priv)
"use-nv-mac");
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static void rproc_restart_level_notifier(void *data, struct rproc *rproc)
{
struct icnss_subsys_restart_level_data *restart_level_data;
@@ -4633,6 +4688,7 @@ static void rproc_restart_level_notifier(void *data, struct rproc *rproc)
0, restart_level_data);
}
}
#endif
#if IS_ENABLED(CONFIG_WCNSS_MEM_PRE_ALLOC)
static void icnss_initialize_mem_pool(unsigned long device_id)
@@ -4652,6 +4708,32 @@ static void icnss_deinitialize_mem_pool(void)
}
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static void register_rproc_restart_level_notifier(void)
{
register_trace_android_vh_rproc_recovery_set(rproc_restart_level_notifier, NULL);
}
#else
static void register_rproc_restart_level_notifier(void)
{
return;
}
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static void unregister_rproc_restart_level_notifier(void)
{
unregister_trace_android_vh_rproc_recovery_set(rproc_restart_level_notifier, NULL);
}
#else
static void unregister_rproc_restart_level_notifier(void)
{
return;
}
#endif
static int icnss_probe(struct platform_device *pdev)
{
int ret = 0;
@@ -4770,7 +4852,7 @@ static int icnss_probe(struct platform_device *pdev)
icnss_aop_interface_init(priv);
set_bit(ICNSS_COLD_BOOT_CAL, &priv->state);
priv->bdf_download_support = true;
register_trace_android_vh_rproc_recovery_set(rproc_restart_level_notifier, NULL);
register_rproc_restart_level_notifier();
}
if (priv->wpss_supported) {
@@ -4881,7 +4963,7 @@ static int icnss_remove(struct platform_device *pdev)
priv->device_id == WCN6450_DEVICE_ID) {
icnss_genl_exit();
icnss_runtime_pm_deinit(priv);
unregister_trace_android_vh_rproc_recovery_set(rproc_restart_level_notifier, NULL);
unregister_rproc_restart_level_notifier();
complete_all(&priv->smp2p_soc_wake_wait);
icnss_destroy_ramdump_device(priv->m3_dump_phyareg);
icnss_destroy_ramdump_device(priv->m3_dump_phydbg);