bcmdhd: added set and get btcparams functions
Mahesh Patil [Mon, 18 Jan 2016 20:32:43 +0000 (12:32 -0800)]
support to driver

Bug 1719066

Change-Id: I9f75026c841195dad6725dac2399a5d35edbb410
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: http://git-master/r/933954
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

drivers/net/wireless/bcmdhd/wl_android.c [changed mode: 0644->0755]
drivers/net/wireless/bcmdhd/wl_cfg_btcoex.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index df4fcdf..6e30ae0
 #define CMD_RXRATESTATS                "RXRATESTATS"
 #define CMD_MAXLINKSPEED       "MAXLINKSPEED"
 #define CMD_AMPDU_SEND_DELBA   "AMPDU_SEND_DELBA"
+#define CMD_SETBTCPARAMS       "SETBTCPARAMS"
+#define CMD_GETBTCPARAMS       "GETBTCPARAMS"
 
 /* Commands for iovar settings */
 #define CMD_SETIOVAR           "SETIOVAR"
@@ -258,6 +260,8 @@ int wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len)
 int wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len)
 { return 0; }
 #endif /* WK_CFG80211 */
+int wl_btcoex_set_btcparams(struct net_device *dev, char *command, int total_len);
+int wl_btcoex_get_btcparams(struct net_device *dev, char *command, int total_len);
 
 extern int dhd_set_slpauto_mode(struct net_device *dev, s32 val);
 
@@ -2714,6 +2718,12 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
                bytes_written = wl_android_set_wfds_hash(net, command, priv_cmd.total_len, 0);
        }
 #endif /* WLWFDS */
+       else if (strnicmp(command, CMD_SETBTCPARAMS, strlen(CMD_SETBTCPARAMS)) == 0) {
+               bytes_written = wl_btcoex_set_btcparams(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_GETBTCPARAMS, strlen(CMD_GETBTCPARAMS)) == 0) {
+               bytes_written = wl_btcoex_get_btcparams(net, command, priv_cmd.total_len);
+       }
        else {
                DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
                snprintf(command, 3, "OK");
old mode 100644 (file)
new mode 100755 (executable)
index 6ac0506..5f57b8e
@@ -547,3 +547,42 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, dhd_pub_t *dhd, char *co
 
        return (strlen("OK"));
 }
+
+int wl_btcoex_set_btcparams(struct net_device *dev, char *command, int total_len)
+{
+       int bytes_written = 0, ret = -1;
+       uint32 param = -1, value = -1;
+
+       if (sscanf(command, "%*s %d %d", &param , &value) != 2) {
+               WL_ERR(("%s: command error", __func__));
+               return BCME_BADARG;
+       }
+       WL_TRACE(("%s:btcparams param %d, value %d\n",__func__, param, value));
+       memset(command,0,total_len);
+       if ((ret = dev_wlc_intvar_set_reg(dev,"btc_params", (char*)&param, (char*)&value))!= BCME_OK) {
+               WL_ERR(("%s: failed %d\n",__func__, ret));
+               return ret;
+       }
+       bytes_written = snprintf(command, total_len, "OK");
+       return bytes_written;
+}
+
+int wl_btcoex_get_btcparams(struct net_device *dev, char *command, int total_len)
+{
+       int bytes_written = 0, ret = -1, value = 0 ;
+       uint param = 0;
+
+       if (sscanf(command, "%*s %d", &param) != 1) {
+       WL_ERR(("%s: command error", __func__));
+               return BCME_BADARG;
+       }
+       WL_TRACE(("%s: btcparams value %d\n",__func__, param));
+       if((ret = dev_wlc_intvar_get_reg(dev,"btc_params", param, &value))!= BCME_OK) {
+               WL_ERR(("%s: failed %d\n",__func__, ret));
+               return ret;
+       }
+       memset(command,0,total_len);
+       bytes_written = snprintf(command, total_len, "%d", value);
+       return bytes_written;
+}
+