openwrt-owl/target/linux/s3c24xx/patches-2.6.26/1105-fix-wlan-disable.patch...

143 lines
5.5 KiB
Diff
Executable File

From 2d1fed81a5bac8db65fcfd9eabfb76d4c3deab31 Mon Sep 17 00:00:00 2001
From: Sameo <sameo@openedhand.com>
Date: Fri, 25 Jul 2008 23:06:04 +0100
Subject: [PATCH] fix-wlan-disable.patch
see
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=1288
---
.../sdio/function/wlan/ar6000/ar6000/ar6000_drv.c | 1 +
.../sdio/function/wlan/ar6000/ar6000/ar6000_drv.h | 1 +
.../function/wlan/ar6000/ar6000/wireless_ext.c | 19 +++++++++--
.../sdio/function/wlan/ar6000/include/wmi_api.h | 1 +
drivers/sdio/function/wlan/ar6000/wmi/wmi.c | 33 ++++++++++++++++++++
5 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
index bb9ef55..d35f31c 100644
--- a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
+++ b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
@@ -704,6 +704,7 @@ ar6000_avail_ev(HTC_HANDLE HTCHandle)
ar->arHtcTarget = HTCHandle;
ar->arHifDevice = HTCGetHifDevice(HTCHandle);
ar->arWlanState = WLAN_ENABLED;
+ ar->arRadioSwitch = WLAN_ENABLED;
ar->arDeviceIndex = device_index;
A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, dev);
diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
index c7b6ec4..655288b 100644
--- a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
+++ b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
@@ -201,6 +201,7 @@ typedef struct ar6_softc {
A_BOOL arWmiEnabled;
A_BOOL arWmiReady;
A_BOOL arConnected;
+ A_BOOL arRadioSwitch;
HTC_HANDLE arHtcTarget;
void *arHifDevice;
spinlock_t arLock;
diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c b/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
index d775e4d..db749e2 100644
--- a/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
+++ b/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
@@ -649,8 +649,16 @@ ar6000_ioctl_siwtxpow(struct net_device *dev,
return -EIO;
}
- if (rrq->disabled) {
- return -EOPNOTSUPP;
+ if (ar->arRadioSwitch == WLAN_ENABLED
+ && rrq->disabled) {
+ if (wmi_switch_radio(ar->arWmi, WLAN_DISABLED) < 0)
+ return -EIO;
+ ar->arRadioSwitch = WLAN_DISABLED;
+ } else if (ar->arRadioSwitch == WLAN_DISABLED
+ && !rrq->disabled) {
+ if (wmi_switch_radio(ar->arWmi, WLAN_ENABLED) < 0)
+ return -EIO;
+ ar->arRadioSwitch = WLAN_ENABLED;
}
if (rrq->fixed) {
@@ -686,6 +694,11 @@ ar6000_ioctl_giwtxpow(struct net_device *dev,
return -EIO;
}
+ if (ar->arRadioSwitch == WLAN_DISABLED) {
+ rrq->disabled = 1;
+ return 0;
+ }
+
if (down_interruptible(&ar->arSem)) {
return -ERESTARTSYS;
}
@@ -1610,7 +1623,7 @@ ar6000_ioctl_giwrange(struct net_device *dev,
data->length = sizeof(struct iw_range);
A_MEMZERO(range, sizeof(struct iw_range));
- range->txpower_capa = 0;
+ range->txpower_capa = IW_TXPOW_DBM;
range->min_pmp = 1 * 1024;
range->max_pmp = 65535 * 1024;
diff --git a/drivers/sdio/function/wlan/ar6000/include/wmi_api.h b/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
index aa9a9c6..267edfd 100644
--- a/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
+++ b/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
@@ -168,6 +168,7 @@ A_STATUS wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
WMI_SET_PMKID_LIST_CMD *pmkInfo);
A_STATUS wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM);
A_STATUS wmi_get_txPwr_cmd(struct wmi_t *wmip);
+A_STATUS wmi_switch_radio(struct wmi_t *wmip, A_UINT8 on);
A_STATUS wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid);
A_STATUS wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex);
A_STATUS wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en);
diff --git a/drivers/sdio/function/wlan/ar6000/wmi/wmi.c b/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
index 0e0e6ba..d322cf3 100644
--- a/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
+++ b/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
@@ -2990,6 +2990,39 @@ wmi_get_txPwr_cmd(struct wmi_t *wmip)
return (wmi_cmd_send(wmip, osbuf, WMI_GET_TX_PWR_CMDID, NO_SYNC_WMIFLAG));
}
+A_STATUS
+wmi_switch_radio(struct wmi_t *wmip, A_UINT8 on)
+{
+ WMI_SCAN_PARAMS_CMD scParams = {0, 0, 0, 0, 0,
+ WMI_SHORTSCANRATIO_DEFAULT,
+ DEFAULT_SCAN_CTRL_FLAGS,
+ 0};
+
+ if (on) {
+ /* Enable foreground scanning */
+ if (wmi_scanparams_cmd(wmip, scParams.fg_start_period,
+ scParams.fg_end_period,
+ scParams.bg_period,
+ scParams.minact_chdwell_time,
+ scParams.maxact_chdwell_time,
+ scParams.pas_chdwell_time,
+ scParams.shortScanRatio,
+ scParams.scanCtrlFlags,
+ scParams.max_dfsch_act_time) != A_OK) {
+ return -EIO;
+ }
+ } else {
+ wmi_disconnect_cmd(wmip);
+ if (wmi_scanparams_cmd(wmip, 0xFFFF, 0, 0, 0,
+ 0, 0, 0, 0xFF, 0) != A_OK) {
+ return -EIO;
+ }
+ }
+
+ return A_OK;
+}
+
+
A_UINT16
wmi_get_mapped_qos_queue(struct wmi_t *wmip, A_UINT8 trafficClass)
{
--
1.5.6.3