cnss2: Use CONFIG_INTERCONNECT to protect icc related APIs

This makes sure CNSS2 driver is able to work in the platforms and
kernels which do not have on-chip interconnect management feature.

Change-Id: I282ef1a282fab9ce4910e7ab914f26789b34ba64
Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
Yue Ma 2020-12-04 15:16:54 -08:00
commit 112dc33583
3 changed files with 26 additions and 0 deletions

View file

@ -2391,6 +2391,7 @@ int cnss_minidump_remove_region(struct cnss_plat_data *plat_priv,
}
#endif /* CONFIG_QCOM_MINIDUMP */
#if IS_ENABLED(CONFIG_INTERCONNECT)
/**
* cnss_register_bus_scale() - Setup interconnect voting data
* @plat_priv: Platform data structure
@ -2516,6 +2517,14 @@ static void cnss_unregister_bus_scale(struct cnss_plat_data *plat_priv)
}
memset(&plat_priv->icc, 0, sizeof(plat_priv->icc));
}
#else
static int cnss_register_bus_scale(struct cnss_plat_data *plat_priv)
{
return 0;
}
static void cnss_unregister_bus_scale(struct cnss_plat_data *plat_priv) {}
#endif /* CONFIG_INTERCONNECT */
static ssize_t recovery_store(struct device *dev,
struct device_attribute *attr,

View file

@ -9,7 +9,9 @@
#include <linux/esoc_client.h>
#endif
#include <linux/etherdevice.h>
#if IS_ENABLED(CONFIG_INTERCONNECT)
#include <linux/interconnect.h>
#endif
#include <linux/pm_qos.h>
#include <linux/platform_device.h>
#include <net/cnss2.h>
@ -146,6 +148,7 @@ struct cnss_esoc_info {
};
#endif
#if IS_ENABLED(CONFIG_INTERCONNECT)
/**
* struct cnss_bus_bw_cfg - Interconnect vote data
* @avg_bw: Vote for average bandwidth
@ -172,6 +175,7 @@ struct cnss_bus_bw_info {
struct icc_path *icc_path;
struct cnss_bus_bw_cfg *cfg_table;
};
#endif
/**
* struct cnss_interconnect_cfg - CNSS platform interconnect config

View file

@ -527,6 +527,7 @@ static int cnss_pci_force_wake_put(struct cnss_pci_data *pci_priv)
return ret;
}
#if IS_ENABLED(CONFIG_INTERCONNECT)
/**
* cnss_setup_bus_bandwidth() - Setup interconnect vote for given bandwidth
* @plat_priv: Platform private data struct
@ -580,6 +581,18 @@ int cnss_request_bus_bandwidth(struct device *dev, int bandwidth)
return cnss_setup_bus_bandwidth(plat_priv, (u32)bandwidth, true);
}
#else
static int cnss_setup_bus_bandwidth(struct cnss_plat_data *plat_priv,
u32 bw, bool save)
{
return 0;
}
int cnss_request_bus_bandwidth(struct device *dev, int bandwidth)
{
return 0;
}
#endif
EXPORT_SYMBOL(cnss_request_bus_bandwidth);
int cnss_pci_debug_reg_read(struct cnss_pci_data *pci_priv, u32 offset,