summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.24/1115-fix-wlan-disable.patch.patch
blob: e2eaed9f32959eeea4219b473c9946b17d1a9971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
From e5b19d7219195af3496f3f3904e62d75d300156f Mon Sep 17 00:00:00 2001
From: Sameo <sameo@openedhand.com>
Date: Sun, 13 Apr 2008 07:25:55 +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.5