wlan_platform: use cnss_utils to send device type across wlan & bt

Add code to use cnss_utils to send device type across wlan & bt.
cnss platform driver reads the wlan sw control gpio and updates
the cnss_utils with the device type, when Bt comes up it get the
device type from cnss_utils.

Change-Id: I5b6f3e7d3dc44e4c5a4a341b3e286f87b5c24bbb
This commit is contained in:
Mohammed Siddiq
2022-04-26 18:03:15 +05:30
committed by Gerrit - the friendly Code Review server
parent 5f2db0d3b8
commit be6ab7d269
3 changed files with 40 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ static struct cnss_utils_priv {
struct cnss_wlan_mac_addr wlan_der_mac_addr;
enum cnss_utils_cc_src cc_source;
struct dentry *root_dentry;
/* generic mutex for device_id */
struct mutex cnss_device_id_lock;
enum cnss_utils_device_type cnss_device_type;
} *cnss_utils_priv;
int cnss_utils_set_wlan_unsafe_channel(struct device *dev,
@@ -111,6 +114,29 @@ int cnss_utils_get_wlan_unsafe_channel(struct device *dev,
}
EXPORT_SYMBOL(cnss_utils_get_wlan_unsafe_channel);
enum cnss_utils_device_type cnss_utils_update_device_type(
enum cnss_utils_device_type device_type)
{
struct cnss_utils_priv *priv = cnss_utils_priv;
if (!priv)
return -EINVAL;
mutex_lock(&priv->cnss_device_id_lock);
pr_info("cnss_utils: device type:%d\n", device_type);
if (priv->cnss_device_type == CNSS_UNSUPPORETD_DEVICE_TYPE) {
priv->cnss_device_type = device_type;
pr_info("cnss_utils: set device type:%d\n",
priv->cnss_device_type);
} else {
pr_info("cnss_utils: device type already set :%d\n",
priv->cnss_device_type);
}
mutex_unlock(&priv->cnss_device_id_lock);
return priv->cnss_device_type;
}
EXPORT_SYMBOL(cnss_utils_update_device_type);
int cnss_utils_wlan_set_dfs_nol(struct device *dev,
const void *info, u16 info_len)
{
@@ -482,8 +508,10 @@ static int __init cnss_utils_init(void)
return -ENOMEM;
priv->cc_source = CNSS_UTILS_SOURCE_CORE;
priv->cnss_device_type = CNSS_UNSUPPORETD_DEVICE_TYPE;
mutex_init(&priv->unsafe_channel_list_lock);
mutex_init(&priv->cnss_device_id_lock);
spin_lock_init(&priv->dfs_nol_info_lock);
cnss_utils_debugfs_create(priv);
cnss_utils_priv = priv;