1 From e5b19d7219195af3496f3f3904e62d75d300156f Mon Sep 17 00:00:00 2001
2 From: Sameo <sameo@openedhand.com>
3 Date: Sun, 13 Apr 2008 07:25:55 +0100
4 Subject: [PATCH] fix-wlan-disable.patch
7 http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=1288
9 .../sdio/function/wlan/ar6000/ar6000/ar6000_drv.c | 1 +
10 .../sdio/function/wlan/ar6000/ar6000/ar6000_drv.h | 1 +
11 .../function/wlan/ar6000/ar6000/wireless_ext.c | 19 +++++++++--
12 .../sdio/function/wlan/ar6000/include/wmi_api.h | 1 +
13 drivers/sdio/function/wlan/ar6000/wmi/wmi.c | 33 ++++++++++++++++++++
14 5 files changed, 52 insertions(+), 3 deletions(-)
16 diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
17 index bb9ef55..d35f31c 100644
18 --- a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
19 +++ b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
20 @@ -704,6 +704,7 @@ ar6000_avail_ev(HTC_HANDLE HTCHandle)
21 ar->arHtcTarget = HTCHandle;
22 ar->arHifDevice = HTCGetHifDevice(HTCHandle);
23 ar->arWlanState = WLAN_ENABLED;
24 + ar->arRadioSwitch = WLAN_ENABLED;
25 ar->arDeviceIndex = device_index;
27 A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, dev);
28 diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
29 index c7b6ec4..655288b 100644
30 --- a/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
31 +++ b/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
32 @@ -201,6 +201,7 @@ typedef struct ar6_softc {
36 + A_BOOL arRadioSwitch;
37 HTC_HANDLE arHtcTarget;
40 diff --git a/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c b/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
41 index d775e4d..db749e2 100644
42 --- a/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
43 +++ b/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
44 @@ -649,8 +649,16 @@ ar6000_ioctl_siwtxpow(struct net_device *dev,
48 - if (rrq->disabled) {
50 + if (ar->arRadioSwitch == WLAN_ENABLED
52 + if (wmi_switch_radio(ar->arWmi, WLAN_DISABLED) < 0)
54 + ar->arRadioSwitch = WLAN_DISABLED;
55 + } else if (ar->arRadioSwitch == WLAN_DISABLED
56 + && !rrq->disabled) {
57 + if (wmi_switch_radio(ar->arWmi, WLAN_ENABLED) < 0)
59 + ar->arRadioSwitch = WLAN_ENABLED;
63 @@ -686,6 +694,11 @@ ar6000_ioctl_giwtxpow(struct net_device *dev,
67 + if (ar->arRadioSwitch == WLAN_DISABLED) {
72 if (down_interruptible(&ar->arSem)) {
75 @@ -1610,7 +1623,7 @@ ar6000_ioctl_giwrange(struct net_device *dev,
76 data->length = sizeof(struct iw_range);
77 A_MEMZERO(range, sizeof(struct iw_range));
79 - range->txpower_capa = 0;
80 + range->txpower_capa = IW_TXPOW_DBM;
82 range->min_pmp = 1 * 1024;
83 range->max_pmp = 65535 * 1024;
84 diff --git a/drivers/sdio/function/wlan/ar6000/include/wmi_api.h b/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
85 index aa9a9c6..267edfd 100644
86 --- a/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
87 +++ b/drivers/sdio/function/wlan/ar6000/include/wmi_api.h
88 @@ -168,6 +168,7 @@ A_STATUS wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
89 WMI_SET_PMKID_LIST_CMD *pmkInfo);
90 A_STATUS wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM);
91 A_STATUS wmi_get_txPwr_cmd(struct wmi_t *wmip);
92 +A_STATUS wmi_switch_radio(struct wmi_t *wmip, A_UINT8 on);
93 A_STATUS wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid);
94 A_STATUS wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex);
95 A_STATUS wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en);
96 diff --git a/drivers/sdio/function/wlan/ar6000/wmi/wmi.c b/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
97 index 0e0e6ba..d322cf3 100644
98 --- a/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
99 +++ b/drivers/sdio/function/wlan/ar6000/wmi/wmi.c
100 @@ -2990,6 +2990,39 @@ wmi_get_txPwr_cmd(struct wmi_t *wmip)
101 return (wmi_cmd_send(wmip, osbuf, WMI_GET_TX_PWR_CMDID, NO_SYNC_WMIFLAG));
105 +wmi_switch_radio(struct wmi_t *wmip, A_UINT8 on)
107 + WMI_SCAN_PARAMS_CMD scParams = {0, 0, 0, 0, 0,
108 + WMI_SHORTSCANRATIO_DEFAULT,
109 + DEFAULT_SCAN_CTRL_FLAGS,
113 + /* Enable foreground scanning */
114 + if (wmi_scanparams_cmd(wmip, scParams.fg_start_period,
115 + scParams.fg_end_period,
116 + scParams.bg_period,
117 + scParams.minact_chdwell_time,
118 + scParams.maxact_chdwell_time,
119 + scParams.pas_chdwell_time,
120 + scParams.shortScanRatio,
121 + scParams.scanCtrlFlags,
122 + scParams.max_dfsch_act_time) != A_OK) {
126 + wmi_disconnect_cmd(wmip);
127 + if (wmi_scanparams_cmd(wmip, 0xFFFF, 0, 0, 0,
128 + 0, 0, 0, 0xFF, 0) != A_OK) {
138 wmi_get_mapped_qos_queue(struct wmi_t *wmip, A_UINT8 trafficClass)