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:

committed by
Gerrit - the friendly Code Review server

parent
5f2db0d3b8
commit
be6ab7d269
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include "cnss_plat_ipc_qmi.h"
|
||||
#include "cnss_utils.h"
|
||||
#include "main.h"
|
||||
#include "bus.h"
|
||||
#include "debug.h"
|
||||
@@ -3764,12 +3765,14 @@ static int cnss_get_dev_cfg_node(struct cnss_plat_data *plat_priv)
|
||||
if (gpio_value && id == QCA6490_DEVICE_ID) {
|
||||
plat_priv->plat_dev->dev.of_node = child;
|
||||
plat_priv->device_id = QCA6490_DEVICE_ID;
|
||||
cnss_utils_update_device_type(CNSS_HSP_DEVICE_TYPE);
|
||||
cnss_pr_dbg("got node[%s@%d] for device[0x%x]\n",
|
||||
child->name, i, id);
|
||||
return 0;
|
||||
} else if (!gpio_value && id == KIWI_DEVICE_ID) {
|
||||
plat_priv->plat_dev->dev.of_node = child;
|
||||
plat_priv->device_id = KIWI_DEVICE_ID;
|
||||
cnss_utils_update_device_type(CNSS_HMT_DEVICE_TYPE);
|
||||
cnss_pr_dbg("got node[%s@%d] for device[0x%x]\n",
|
||||
child->name, i, id);
|
||||
return 0;
|
||||
|
@@ -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;
|
||||
|
@@ -14,12 +14,21 @@ enum cnss_utils_cc_src {
|
||||
CNSS_UTILS_SOURCE_USER
|
||||
};
|
||||
|
||||
enum cnss_utils_device_type {
|
||||
CNSS_UNSUPPORETD_DEVICE_TYPE = -1,
|
||||
CNSS_HMT_DEVICE_TYPE,
|
||||
CNSS_HSP_DEVICE_TYPE
|
||||
};
|
||||
|
||||
extern int cnss_utils_set_wlan_unsafe_channel(struct device *dev,
|
||||
u16 *unsafe_ch_list,
|
||||
u16 ch_count);
|
||||
extern int cnss_utils_get_wlan_unsafe_channel(struct device *dev,
|
||||
u16 *unsafe_ch_list,
|
||||
u16 *ch_count, u16 buf_len);
|
||||
extern enum cnss_utils_device_type cnss_utils_update_device_type(
|
||||
enum cnss_utils_device_type device_type);
|
||||
|
||||
extern int cnss_utils_wlan_set_dfs_nol(struct device *dev,
|
||||
const void *info, u16 info_len);
|
||||
extern int cnss_utils_wlan_get_dfs_nol(struct device *dev,
|
||||
|
Reference in New Issue
Block a user