aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig4
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c42
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c138
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c131
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.h48
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c41
11 files changed, 19 insertions, 414 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 6fe259fcfb8f..029ccb6bdbaa 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -10,10 +10,6 @@ config IWLWIFI_LEDS
10 bool "Enable LED support in iwlagn and iwl3945 drivers" 10 bool "Enable LED support in iwlagn and iwl3945 drivers"
11 depends on IWLWIFI 11 depends on IWLWIFI
12 12
13config IWLWIFI_RFKILL
14 def_bool y
15 depends on IWLWIFI && RFKILL
16
17config IWLWIFI_SPECTRUM_MEASUREMENT 13config IWLWIFI_SPECTRUM_MEASUREMENT
18 bool "Enable Spectrum Measurement in iwlagn driver" 14 bool "Enable Spectrum Measurement in iwlagn driver"
19 depends on IWLWIFI 15 depends on IWLWIFI
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index d79d97ad61a5..1d4e0a226fd4 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -4,7 +4,6 @@ iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o iwl-calib.o
4iwlcore-objs += iwl-scan.o 4iwlcore-objs += iwl-scan.o
5iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o 5iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
6iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o 6iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
7iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
8iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o 7iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
9 8
10obj-$(CONFIG_IWLAGN) += iwlagn.o 9obj-$(CONFIG_IWLAGN) += iwlagn.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 4d8a325ea9d8..fbb3a573463e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -36,10 +36,6 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <net/ieee80211_radiotap.h> 37#include <net/ieee80211_radiotap.h>
38 38
39/*used for rfkill*/
40#include <linux/rfkill.h>
41#include <linux/input.h>
42
43/* Hardware specific file defines the PCI IDs table for that hardware module */ 39/* Hardware specific file defines the PCI IDs table for that hardware module */
44extern struct pci_device_id iwl3945_hw_card_ids[]; 40extern struct pci_device_id iwl3945_hw_card_ids[];
45 41
@@ -155,7 +151,6 @@ struct iwl3945_frame {
155#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 151#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */
156#define STATUS_INT_ENABLED 2 152#define STATUS_INT_ENABLED 2
157#define STATUS_RF_KILL_HW 3 153#define STATUS_RF_KILL_HW 3
158#define STATUS_RF_KILL_SW 4
159#define STATUS_INIT 5 154#define STATUS_INIT 5
160#define STATUS_ALIVE 6 155#define STATUS_ALIVE 6
161#define STATUS_READY 7 156#define STATUS_READY 7
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index b77208de92ad..a5637c4aa85d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -737,19 +737,13 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
737 clear_bit(STATUS_RF_KILL_HW, &priv->status); 737 clear_bit(STATUS_RF_KILL_HW, &priv->status);
738 738
739 739
740 if (flags & SW_CARD_DISABLED)
741 set_bit(STATUS_RF_KILL_SW, &priv->status);
742 else
743 clear_bit(STATUS_RF_KILL_SW, &priv->status);
744
745 if (!(flags & RXON_CARD_DISABLED)) 740 if (!(flags & RXON_CARD_DISABLED))
746 iwl_scan_cancel(priv); 741 iwl_scan_cancel(priv);
747 742
748 if ((test_bit(STATUS_RF_KILL_HW, &status) != 743 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
749 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 744 test_bit(STATUS_RF_KILL_HW, &priv->status)))
750 (test_bit(STATUS_RF_KILL_SW, &status) != 745 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
751 test_bit(STATUS_RF_KILL_SW, &priv->status))) 746 test_bit(STATUS_RF_KILL_HW, &priv->status));
752 queue_work(priv->workqueue, &priv->rf_kill);
753 else 747 else
754 wake_up_interruptible(&priv->wait_command_queue); 748 wake_up_interruptible(&priv->wait_command_queue);
755} 749}
@@ -1045,7 +1039,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
1045 set_bit(STATUS_RF_KILL_HW, &priv->status); 1039 set_bit(STATUS_RF_KILL_HW, &priv->status);
1046 else 1040 else
1047 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1041 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1048 queue_work(priv->workqueue, &priv->rf_kill); 1042 wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill);
1049 } 1043 }
1050 1044
1051 handled |= CSR_INT_BIT_RF_KILL; 1045 handled |= CSR_INT_BIT_RF_KILL;
@@ -1218,7 +1212,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1218 set_bit(STATUS_RF_KILL_HW, &priv->status); 1212 set_bit(STATUS_RF_KILL_HW, &priv->status);
1219 else 1213 else
1220 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1214 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1221 queue_work(priv->workqueue, &priv->rf_kill); 1215 wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill);
1222 } 1216 }
1223 1217
1224 handled |= CSR_INT_BIT_RF_KILL; 1218 handled |= CSR_INT_BIT_RF_KILL;
@@ -1726,12 +1720,10 @@ static void __iwl_down(struct iwl_priv *priv)
1726 ieee80211_stop_queues(priv->hw); 1720 ieee80211_stop_queues(priv->hw);
1727 1721
1728 /* If we have not previously called iwl_init() then 1722 /* If we have not previously called iwl_init() then
1729 * clear all bits but the RF Kill bits and return */ 1723 * clear all bits but the RF Kill bit and return */
1730 if (!iwl_is_init(priv)) { 1724 if (!iwl_is_init(priv)) {
1731 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 1725 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1732 STATUS_RF_KILL_HW | 1726 STATUS_RF_KILL_HW |
1733 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
1734 STATUS_RF_KILL_SW |
1735 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1727 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1736 STATUS_GEO_CONFIGURED | 1728 STATUS_GEO_CONFIGURED |
1737 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1729 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
@@ -1740,11 +1732,9 @@ static void __iwl_down(struct iwl_priv *priv)
1740 } 1732 }
1741 1733
1742 /* ...otherwise clear out all the status bits but the RF Kill 1734 /* ...otherwise clear out all the status bits but the RF Kill
1743 * bits and continue taking the NIC down. */ 1735 * bit and continue taking the NIC down. */
1744 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << 1736 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1745 STATUS_RF_KILL_HW | 1737 STATUS_RF_KILL_HW |
1746 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
1747 STATUS_RF_KILL_SW |
1748 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1738 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1749 STATUS_GEO_CONFIGURED | 1739 STATUS_GEO_CONFIGURED |
1750 test_bit(STATUS_FW_ERROR, &priv->status) << 1740 test_bit(STATUS_FW_ERROR, &priv->status) <<
@@ -1866,9 +1856,10 @@ static int __iwl_up(struct iwl_priv *priv)
1866 set_bit(STATUS_RF_KILL_HW, &priv->status); 1856 set_bit(STATUS_RF_KILL_HW, &priv->status);
1867 1857
1868 if (iwl_is_rfkill(priv)) { 1858 if (iwl_is_rfkill(priv)) {
1859 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
1860
1869 iwl_enable_interrupts(priv); 1861 iwl_enable_interrupts(priv);
1870 IWL_WARN(priv, "Radio disabled by %s RF Kill switch\n", 1862 IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
1871 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW");
1872 return 0; 1863 return 0;
1873 } 1864 }
1874 1865
@@ -2001,7 +1992,6 @@ static void iwl_bg_up(struct work_struct *data)
2001 mutex_lock(&priv->mutex); 1992 mutex_lock(&priv->mutex);
2002 __iwl_up(priv); 1993 __iwl_up(priv);
2003 mutex_unlock(&priv->mutex); 1994 mutex_unlock(&priv->mutex);
2004 iwl_rfkill_set_hw_state(priv);
2005} 1995}
2006 1996
2007static void iwl_bg_restart(struct work_struct *data) 1997static void iwl_bg_restart(struct work_struct *data)
@@ -2179,8 +2169,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2179 2169
2180 mutex_unlock(&priv->mutex); 2170 mutex_unlock(&priv->mutex);
2181 2171
2182 iwl_rfkill_set_hw_state(priv);
2183
2184 if (ret) 2172 if (ret)
2185 return ret; 2173 return ret;
2186 2174
@@ -2775,7 +2763,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
2775 INIT_WORK(&priv->up, iwl_bg_up); 2763 INIT_WORK(&priv->up, iwl_bg_up);
2776 INIT_WORK(&priv->restart, iwl_bg_restart); 2764 INIT_WORK(&priv->restart, iwl_bg_restart);
2777 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); 2765 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish);
2778 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
2779 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 2766 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
2780 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); 2767 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
2781 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 2768 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start);
@@ -3046,12 +3033,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3046 else 3033 else
3047 set_bit(STATUS_RF_KILL_HW, &priv->status); 3034 set_bit(STATUS_RF_KILL_HW, &priv->status);
3048 3035
3049 err = iwl_rfkill_init(priv); 3036 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
3050 if (err) 3037 test_bit(STATUS_RF_KILL_HW, &priv->status));
3051 IWL_ERR(priv, "Unable to initialize RFKILL system. "
3052 "Ignoring error: %d\n", err);
3053 else
3054 iwl_rfkill_set_hw_state(priv);
3055 3038
3056 iwl_power_initialize(priv); 3039 iwl_power_initialize(priv);
3057 return 0; 3040 return 0;
@@ -3115,7 +3098,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
3115 3098
3116 iwl_synchronize_irq(priv); 3099 iwl_synchronize_irq(priv);
3117 3100
3118 iwl_rfkill_unregister(priv);
3119 iwl_dealloc_ucode_pci(priv); 3101 iwl_dealloc_ucode_pci(priv);
3120 3102
3121 if (priv->rxq.bd) 3103 if (priv->rxq.bd)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 51cae4ec26a5..f9d16ca5b3d9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -36,7 +36,6 @@
36#include "iwl-debug.h" 36#include "iwl-debug.h"
37#include "iwl-core.h" 37#include "iwl-core.h"
38#include "iwl-io.h" 38#include "iwl-io.h"
39#include "iwl-rfkill.h"
40#include "iwl-power.h" 39#include "iwl-power.h"
41#include "iwl-sta.h" 40#include "iwl-sta.h"
42#include "iwl-helpers.h" 41#include "iwl-helpers.h"
@@ -2211,126 +2210,6 @@ int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
2211} 2210}
2212EXPORT_SYMBOL(iwl_send_card_state); 2211EXPORT_SYMBOL(iwl_send_card_state);
2213 2212
2214void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
2215{
2216 unsigned long flags;
2217
2218 if (test_bit(STATUS_RF_KILL_SW, &priv->status))
2219 return;
2220
2221 IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO OFF\n");
2222
2223 iwl_scan_cancel(priv);
2224 /* FIXME: This is a workaround for AP */
2225 if (priv->iw_mode != NL80211_IFTYPE_AP) {
2226 spin_lock_irqsave(&priv->lock, flags);
2227 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
2228 CSR_UCODE_SW_BIT_RFKILL);
2229 spin_unlock_irqrestore(&priv->lock, flags);
2230 /* call the host command only if no hw rf-kill set */
2231 if (!test_bit(STATUS_RF_KILL_HW, &priv->status) &&
2232 iwl_is_ready(priv))
2233 iwl_send_card_state(priv,
2234 CARD_STATE_CMD_DISABLE, 0);
2235 set_bit(STATUS_RF_KILL_SW, &priv->status);
2236 /* make sure mac80211 stop sending Tx frame */
2237 if (priv->mac80211_registered)
2238 ieee80211_stop_queues(priv->hw);
2239 }
2240}
2241EXPORT_SYMBOL(iwl_radio_kill_sw_disable_radio);
2242
2243int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv)
2244{
2245 unsigned long flags;
2246
2247 if (!test_bit(STATUS_RF_KILL_SW, &priv->status))
2248 return 0;
2249
2250 IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO ON\n");
2251
2252 spin_lock_irqsave(&priv->lock, flags);
2253 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2254
2255 /* If the driver is up it will receive CARD_STATE_NOTIFICATION
2256 * notification where it will clear SW rfkill status.
2257 * Setting it here would break the handler. Only if the
2258 * interface is down we can set here since we don't
2259 * receive any further notification.
2260 */
2261 if (!priv->is_open)
2262 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2263 spin_unlock_irqrestore(&priv->lock, flags);
2264
2265 /* wake up ucode */
2266 msleep(10);
2267
2268 iwl_read32(priv, CSR_UCODE_DRV_GP1);
2269 spin_lock_irqsave(&priv->reg_lock, flags);
2270 if (!iwl_grab_nic_access(priv))
2271 iwl_release_nic_access(priv);
2272 spin_unlock_irqrestore(&priv->reg_lock, flags);
2273
2274 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
2275 IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
2276 "disabled by HW switch\n");
2277 return 0;
2278 }
2279
2280 /* when driver is up while rfkill is on, it wont receive
2281 * any CARD_STATE_NOTIFICATION notifications so we have to
2282 * restart it in here
2283 */
2284 if (priv->is_open && !test_bit(STATUS_ALIVE, &priv->status)) {
2285 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2286 if (!iwl_is_rfkill(priv))
2287 queue_work(priv->workqueue, &priv->up);
2288 }
2289
2290 /* If the driver is already loaded, it will receive
2291 * CARD_STATE_NOTIFICATION notifications and the handler will
2292 * call restart to reload the driver.
2293 */
2294 return 1;
2295}
2296EXPORT_SYMBOL(iwl_radio_kill_sw_enable_radio);
2297
2298void iwl_bg_rf_kill(struct work_struct *work)
2299{
2300 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill);
2301
2302 wake_up_interruptible(&priv->wait_command_queue);
2303
2304 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2305 return;
2306
2307 mutex_lock(&priv->mutex);
2308
2309 if (!iwl_is_rfkill(priv)) {
2310 IWL_DEBUG_RF_KILL(priv,
2311 "HW and/or SW RF Kill no longer active, restarting "
2312 "device\n");
2313 if (!test_bit(STATUS_EXIT_PENDING, &priv->status) &&
2314 priv->is_open)
2315 queue_work(priv->workqueue, &priv->restart);
2316 } else {
2317 /* make sure mac80211 stop sending Tx frame */
2318 if (priv->mac80211_registered)
2319 ieee80211_stop_queues(priv->hw);
2320
2321 if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
2322 IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
2323 "disabled by SW switch\n");
2324 else
2325 IWL_WARN(priv, "Radio Frequency Kill Switch is On:\n"
2326 "Kill switch must be turned off for "
2327 "wireless networking to work.\n");
2328 }
2329 mutex_unlock(&priv->mutex);
2330 iwl_rfkill_set_hw_state(priv);
2331}
2332EXPORT_SYMBOL(iwl_bg_rf_kill);
2333
2334void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 2213void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
2335 struct iwl_rx_mem_buffer *rxb) 2214 struct iwl_rx_mem_buffer *rxb)
2336{ 2215{
@@ -2849,23 +2728,6 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2849 if (priv->cfg->ops->hcmd->set_rxon_chain) 2728 if (priv->cfg->ops->hcmd->set_rxon_chain)
2850 priv->cfg->ops->hcmd->set_rxon_chain(priv); 2729 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2851 2730
2852 if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
2853 if (conf->radio_enabled &&
2854 iwl_radio_kill_sw_enable_radio(priv)) {
2855 IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
2856 "waiting for uCode\n");
2857 goto out;
2858 }
2859
2860 if (!conf->radio_enabled)
2861 iwl_radio_kill_sw_disable_radio(priv);
2862 }
2863
2864 if (!conf->radio_enabled) {
2865 IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
2866 goto out;
2867 }
2868
2869 if (!iwl_is_ready(priv)) { 2731 if (!iwl_is_ready(priv)) {
2870 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 2732 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
2871 goto out; 2733 goto out;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index b52d0fb16060..dabf663e36e5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -348,14 +348,6 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id);
348 ****************************************************/ 348 ****************************************************/
349int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); 349int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
350 350
351/*****************************************************
352 * RF -Kill - here and not in iwl-rfkill.h to be available when
353 * RF-kill subsystem is not compiled.
354 ****************************************************/
355void iwl_bg_rf_kill(struct work_struct *work);
356void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv);
357int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv);
358
359/******************************************************************************* 351/*******************************************************************************
360 * Rate 352 * Rate
361 ******************************************************************************/ 353 ******************************************************************************/
@@ -498,7 +490,6 @@ void iwlcore_free_geos(struct iwl_priv *priv);
498#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 490#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */
499#define STATUS_INT_ENABLED 2 491#define STATUS_INT_ENABLED 2
500#define STATUS_RF_KILL_HW 3 492#define STATUS_RF_KILL_HW 3
501#define STATUS_RF_KILL_SW 4
502#define STATUS_INIT 5 493#define STATUS_INIT 5
503#define STATUS_ALIVE 6 494#define STATUS_ALIVE 6
504#define STATUS_READY 7 495#define STATUS_READY 7
@@ -533,11 +524,6 @@ static inline int iwl_is_init(struct iwl_priv *priv)
533 return test_bit(STATUS_INIT, &priv->status); 524 return test_bit(STATUS_INIT, &priv->status);
534} 525}
535 526
536static inline int iwl_is_rfkill_sw(struct iwl_priv *priv)
537{
538 return test_bit(STATUS_RF_KILL_SW, &priv->status);
539}
540
541static inline int iwl_is_rfkill_hw(struct iwl_priv *priv) 527static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
542{ 528{
543 return test_bit(STATUS_RF_KILL_HW, &priv->status); 529 return test_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -545,7 +531,7 @@ static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
545 531
546static inline int iwl_is_rfkill(struct iwl_priv *priv) 532static inline int iwl_is_rfkill(struct iwl_priv *priv)
547{ 533{
548 return iwl_is_rfkill_hw(priv) || iwl_is_rfkill_sw(priv); 534 return iwl_is_rfkill_hw(priv);
549} 535}
550 536
551static inline int iwl_is_ready_rf(struct iwl_priv *priv) 537static inline int iwl_is_ready_rf(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index af70229144b3..11e08c068917 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -449,8 +449,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
449 test_bit(STATUS_INT_ENABLED, &priv->status)); 449 test_bit(STATUS_INT_ENABLED, &priv->status));
450 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", 450 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
451 test_bit(STATUS_RF_KILL_HW, &priv->status)); 451 test_bit(STATUS_RF_KILL_HW, &priv->status));
452 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_SW:\t %d\n",
453 test_bit(STATUS_RF_KILL_SW, &priv->status));
454 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", 452 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
455 test_bit(STATUS_INIT, &priv->status)); 453 test_bit(STATUS_INIT, &priv->status));
456 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", 454 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 28c39cf8b126..e2d620f0b6e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -41,7 +41,6 @@
41#include "iwl-prph.h" 41#include "iwl-prph.h"
42#include "iwl-fh.h" 42#include "iwl-fh.h"
43#include "iwl-debug.h" 43#include "iwl-debug.h"
44#include "iwl-rfkill.h"
45#include "iwl-4965-hw.h" 44#include "iwl-4965-hw.h"
46#include "iwl-3945-hw.h" 45#include "iwl-3945-hw.h"
47#include "iwl-3945-led.h" 46#include "iwl-3945-led.h"
@@ -936,9 +935,6 @@ struct iwl_priv {
936 * 4965's initialize alive response contains some calibration data. */ 935 * 4965's initialize alive response contains some calibration data. */
937 struct iwl_init_alive_resp card_alive_init; 936 struct iwl_init_alive_resp card_alive_init;
938 struct iwl_alive_resp card_alive; 937 struct iwl_alive_resp card_alive;
939#if defined(CONFIG_IWLWIFI_RFKILL)
940 struct rfkill *rfkill;
941#endif
942 938
943#ifdef CONFIG_IWLWIFI_LEDS 939#ifdef CONFIG_IWLWIFI_LEDS
944 unsigned long last_blink_time; 940 unsigned long last_blink_time;
@@ -1072,7 +1068,6 @@ struct iwl_priv {
1072 struct work_struct calibrated_work; 1068 struct work_struct calibrated_work;
1073 struct work_struct scan_completed; 1069 struct work_struct scan_completed;
1074 struct work_struct rx_replenish; 1070 struct work_struct rx_replenish;
1075 struct work_struct rf_kill;
1076 struct work_struct abort_scan; 1071 struct work_struct abort_scan;
1077 struct work_struct update_link_led; 1072 struct work_struct update_link_led;
1078 struct work_struct auth_work; 1073 struct work_struct auth_work;
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
deleted file mode 100644
index 13149936fd26..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
4 *
5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * The full GNU General Public License is included in this distribution in the
22 * file called LICENSE.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/init.h>
31
32#include <net/mac80211.h>
33
34#include "iwl-eeprom.h"
35#include "iwl-dev.h"
36#include "iwl-core.h"
37
38/* software rf-kill from user */
39static int iwl_rfkill_soft_rf_kill(void *data, bool blocked)
40{
41 struct iwl_priv *priv = data;
42
43 if (!priv->rfkill)
44 return -EINVAL;
45
46 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
47 return 0;
48
49 IWL_DEBUG_RF_KILL(priv, "received soft RFKILL: block=%d\n", blocked);
50
51 mutex_lock(&priv->mutex);
52
53 if (iwl_is_rfkill_hw(priv))
54 goto out_unlock;
55
56 if (!blocked)
57 iwl_radio_kill_sw_enable_radio(priv);
58 else
59 iwl_radio_kill_sw_disable_radio(priv);
60
61out_unlock:
62 mutex_unlock(&priv->mutex);
63 return 0;
64}
65
66static const struct rfkill_ops iwl_rfkill_ops = {
67 .set_block = iwl_rfkill_soft_rf_kill,
68};
69
70int iwl_rfkill_init(struct iwl_priv *priv)
71{
72 struct device *device = wiphy_dev(priv->hw->wiphy);
73 int ret = 0;
74
75 BUG_ON(device == NULL);
76
77 IWL_DEBUG_RF_KILL(priv, "Initializing RFKILL.\n");
78 priv->rfkill = rfkill_alloc(priv->cfg->name,
79 device,
80 RFKILL_TYPE_WLAN,
81 &iwl_rfkill_ops, priv);
82 if (!priv->rfkill) {
83 IWL_ERR(priv, "Unable to allocate RFKILL device.\n");
84 ret = -ENOMEM;
85 goto error;
86 }
87
88 ret = rfkill_register(priv->rfkill);
89 if (ret) {
90 IWL_ERR(priv, "Unable to register RFKILL: %d\n", ret);
91 goto free_rfkill;
92 }
93
94 IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
95 return 0;
96
97free_rfkill:
98 rfkill_destroy(priv->rfkill);
99 priv->rfkill = NULL;
100
101error:
102 IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
103 return ret;
104}
105EXPORT_SYMBOL(iwl_rfkill_init);
106
107void iwl_rfkill_unregister(struct iwl_priv *priv)
108{
109
110 if (priv->rfkill) {
111 rfkill_unregister(priv->rfkill);
112 rfkill_destroy(priv->rfkill);
113 }
114
115 priv->rfkill = NULL;
116}
117EXPORT_SYMBOL(iwl_rfkill_unregister);
118
119/* set RFKILL to the right state. */
120void iwl_rfkill_set_hw_state(struct iwl_priv *priv)
121{
122 if (!priv->rfkill)
123 return;
124
125 if (rfkill_set_hw_state(priv->rfkill,
126 !!iwl_is_rfkill_hw(priv)))
127 iwl_radio_kill_sw_disable_radio(priv);
128 else
129 iwl_radio_kill_sw_enable_radio(priv);
130}
131EXPORT_SYMBOL(iwl_rfkill_set_hw_state);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.h b/drivers/net/wireless/iwlwifi/iwl-rfkill.h
deleted file mode 100644
index 633dafb4bf1b..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
4 *
5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * The full GNU General Public License is included in this distribution in the
22 * file called LICENSE.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28#ifndef __iwl_rf_kill_h__
29#define __iwl_rf_kill_h__
30
31struct iwl_priv;
32
33#include <linux/rfkill.h>
34
35#ifdef CONFIG_IWLWIFI_RFKILL
36
37void iwl_rfkill_set_hw_state(struct iwl_priv *priv);
38void iwl_rfkill_unregister(struct iwl_priv *priv);
39int iwl_rfkill_init(struct iwl_priv *priv);
40#else
41static inline void iwl_rfkill_set_hw_state(struct iwl_priv *priv) {}
42static inline void iwl_rfkill_unregister(struct iwl_priv *priv) {}
43static inline int iwl_rfkill_init(struct iwl_priv *priv) { return 0; }
44#endif
45
46
47
48#endif /* __iwl_rf_kill_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 92fa1a39c446..83d31606dd00 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1009,18 +1009,12 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
1009 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1009 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1010 1010
1011 1011
1012 if (flags & SW_CARD_DISABLED)
1013 set_bit(STATUS_RF_KILL_SW, &priv->status);
1014 else
1015 clear_bit(STATUS_RF_KILL_SW, &priv->status);
1016
1017 iwl_scan_cancel(priv); 1012 iwl_scan_cancel(priv);
1018 1013
1019 if ((test_bit(STATUS_RF_KILL_HW, &status) != 1014 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
1020 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 1015 test_bit(STATUS_RF_KILL_HW, &priv->status)))
1021 (test_bit(STATUS_RF_KILL_SW, &status) != 1016 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
1022 test_bit(STATUS_RF_KILL_SW, &priv->status))) 1017 test_bit(STATUS_RF_KILL_HW, &priv->status));
1023 queue_work(priv->workqueue, &priv->rf_kill);
1024 else 1018 else
1025 wake_up_interruptible(&priv->wait_command_queue); 1019 wake_up_interruptible(&priv->wait_command_queue);
1026} 1020}
@@ -2586,8 +2580,6 @@ static void __iwl3945_down(struct iwl_priv *priv)
2586 if (!iwl_is_init(priv)) { 2580 if (!iwl_is_init(priv)) {
2587 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 2581 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2588 STATUS_RF_KILL_HW | 2582 STATUS_RF_KILL_HW |
2589 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
2590 STATUS_RF_KILL_SW |
2591 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2583 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
2592 STATUS_GEO_CONFIGURED | 2584 STATUS_GEO_CONFIGURED |
2593 test_bit(STATUS_EXIT_PENDING, &priv->status) << 2585 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
@@ -2596,11 +2588,9 @@ static void __iwl3945_down(struct iwl_priv *priv)
2596 } 2588 }
2597 2589
2598 /* ...otherwise clear out all the status bits but the RF Kill 2590 /* ...otherwise clear out all the status bits but the RF Kill
2599 * bits and continue taking the NIC down. */ 2591 * bit and continue taking the NIC down. */
2600 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << 2592 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2601 STATUS_RF_KILL_HW | 2593 STATUS_RF_KILL_HW |
2602 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
2603 STATUS_RF_KILL_SW |
2604 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2594 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
2605 STATUS_GEO_CONFIGURED | 2595 STATUS_GEO_CONFIGURED |
2606 test_bit(STATUS_FW_ERROR, &priv->status) << 2596 test_bit(STATUS_FW_ERROR, &priv->status) <<
@@ -2657,12 +2647,6 @@ static int __iwl3945_up(struct iwl_priv *priv)
2657 return -EIO; 2647 return -EIO;
2658 } 2648 }
2659 2649
2660 if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
2661 IWL_WARN(priv, "Radio disabled by SW RF kill (module "
2662 "parameter)\n");
2663 return -ENODEV;
2664 }
2665
2666 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 2650 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
2667 IWL_ERR(priv, "ucode not available for device bring up\n"); 2651 IWL_ERR(priv, "ucode not available for device bring up\n");
2668 return -EIO; 2652 return -EIO;
@@ -2779,15 +2763,14 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2779{ 2763{
2780 struct iwl_priv *priv = 2764 struct iwl_priv *priv =
2781 container_of(data, struct iwl_priv, rfkill_poll.work); 2765 container_of(data, struct iwl_priv, rfkill_poll.work);
2782 unsigned long status = priv->status;
2783 2766
2784 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2767 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
2785 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2768 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2786 else 2769 else
2787 set_bit(STATUS_RF_KILL_HW, &priv->status); 2770 set_bit(STATUS_RF_KILL_HW, &priv->status);
2788 2771
2789 if (test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status)) 2772 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
2790 queue_work(priv->workqueue, &priv->rf_kill); 2773 test_bit(STATUS_RF_KILL_HW, &priv->status));
2791 2774
2792 queue_delayed_work(priv->workqueue, &priv->rfkill_poll, 2775 queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
2793 round_jiffies_relative(2 * HZ)); 2776 round_jiffies_relative(2 * HZ));
@@ -3019,7 +3002,6 @@ static void iwl3945_bg_up(struct work_struct *data)
3019 mutex_lock(&priv->mutex); 3002 mutex_lock(&priv->mutex);
3020 __iwl3945_up(priv); 3003 __iwl3945_up(priv);
3021 mutex_unlock(&priv->mutex); 3004 mutex_unlock(&priv->mutex);
3022 iwl_rfkill_set_hw_state(priv);
3023} 3005}
3024 3006
3025static void iwl3945_bg_restart(struct work_struct *data) 3007static void iwl3945_bg_restart(struct work_struct *data)
@@ -3182,8 +3164,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
3182 3164
3183 mutex_unlock(&priv->mutex); 3165 mutex_unlock(&priv->mutex);
3184 3166
3185 iwl_rfkill_set_hw_state(priv);
3186
3187 if (ret) 3167 if (ret)
3188 goto out_release_irq; 3168 goto out_release_irq;
3189 3169
@@ -3836,7 +3816,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
3836 INIT_WORK(&priv->up, iwl3945_bg_up); 3816 INIT_WORK(&priv->up, iwl3945_bg_up);
3837 INIT_WORK(&priv->restart, iwl3945_bg_restart); 3817 INIT_WORK(&priv->restart, iwl3945_bg_restart);
3838 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); 3818 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish);
3839 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
3840 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); 3819 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
3841 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); 3820 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
3842 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3821 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
@@ -4203,13 +4182,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4203 if (err) 4182 if (err)
4204 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); 4183 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
4205 4184
4206 err = iwl_rfkill_init(priv);
4207 if (err)
4208 IWL_ERR(priv, "Unable to initialize RFKILL system. "
4209 "Ignoring error: %d\n", err);
4210 else
4211 iwl_rfkill_set_hw_state(priv);
4212
4213 /* Start monitoring the killswitch */ 4185 /* Start monitoring the killswitch */
4214 queue_delayed_work(priv->workqueue, &priv->rfkill_poll, 4186 queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
4215 2 * HZ); 4187 2 * HZ);
@@ -4275,7 +4247,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4275 4247
4276 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 4248 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
4277 4249
4278 iwl_rfkill_unregister(priv);
4279 cancel_delayed_work_sync(&priv->rfkill_poll); 4250 cancel_delayed_work_sync(&priv->rfkill_poll);
4280 4251
4281 iwl3945_dealloc_ucode_pci(priv); 4252 iwl3945_dealloc_ucode_pci(priv);