aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2008-03-28 19:21:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:18 -0400
commitad97edd2f524940d524c26ae273a4eb23067a7c0 (patch)
tree7d7af2310ec45dd70dfe17b1723fc66b9228d5cc /drivers/net/wireless/iwlwifi/iwl4965-base.c
parentc8381fdcab98b74f670d879097bab35d97d88400 (diff)
iwlwifi: hook iwlwifi with Linux rfkill
This patch hook IWL with Linux rfkill. Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 5261b6179a86..7f56565b4002 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2607,7 +2607,7 @@ static void iwl4965_set_rate(struct iwl_priv *priv)
2607 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2607 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
2608} 2608}
2609 2609
2610static void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 2610void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2611{ 2611{
2612 unsigned long flags; 2612 unsigned long flags;
2613 2613
@@ -2625,8 +2625,16 @@ static void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2625 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 2625 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
2626 CSR_UCODE_SW_BIT_RFKILL); 2626 CSR_UCODE_SW_BIT_RFKILL);
2627 spin_unlock_irqrestore(&priv->lock, flags); 2627 spin_unlock_irqrestore(&priv->lock, flags);
2628 iwl4965_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); 2628 /* call the host command only if no hw rf-kill set */
2629 if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
2630 iwl4965_send_card_state(priv,
2631 CARD_STATE_CMD_DISABLE,
2632 0);
2629 set_bit(STATUS_RF_KILL_SW, &priv->status); 2633 set_bit(STATUS_RF_KILL_SW, &priv->status);
2634
2635 /* make sure mac80211 stop sending Tx frame */
2636 if (priv->mac80211_registered)
2637 ieee80211_stop_queues(priv->hw);
2630 } 2638 }
2631 return; 2639 return;
2632 } 2640 }
@@ -5852,6 +5860,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
5852 if (test_bit(STATUS_RF_KILL_SW, &priv->status)) { 5860 if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
5853 IWL_WARNING("Radio disabled by SW RF kill (module " 5861 IWL_WARNING("Radio disabled by SW RF kill (module "
5854 "parameter)\n"); 5862 "parameter)\n");
5863 iwl_rfkill_set_hw_state(priv);
5855 return -ENODEV; 5864 return -ENODEV;
5856 } 5865 }
5857 5866
@@ -5867,11 +5876,13 @@ static int __iwl4965_up(struct iwl_priv *priv)
5867 else { 5876 else {
5868 set_bit(STATUS_RF_KILL_HW, &priv->status); 5877 set_bit(STATUS_RF_KILL_HW, &priv->status);
5869 if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) { 5878 if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) {
5879 iwl_rfkill_set_hw_state(priv);
5870 IWL_WARNING("Radio disabled by HW RF Kill switch\n"); 5880 IWL_WARNING("Radio disabled by HW RF Kill switch\n");
5871 return -ENODEV; 5881 return -ENODEV;
5872 } 5882 }
5873 } 5883 }
5874 5884
5885 iwl_rfkill_set_hw_state(priv);
5875 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 5886 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
5876 5887
5877 rc = iwl4965_hw_nic_init(priv); 5888 rc = iwl4965_hw_nic_init(priv);
@@ -5985,6 +5996,9 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
5985 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 5996 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
5986 queue_work(priv->workqueue, &priv->restart); 5997 queue_work(priv->workqueue, &priv->restart);
5987 } else { 5998 } else {
5999 /* make sure mac80211 stop sending Tx frame */
6000 if (priv->mac80211_registered)
6001 ieee80211_stop_queues(priv->hw);
5988 6002
5989 if (!test_bit(STATUS_RF_KILL_HW, &priv->status)) 6003 if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
5990 IWL_DEBUG_RF_KILL("Can not turn radio back on - " 6004 IWL_DEBUG_RF_KILL("Can not turn radio back on - "
@@ -5994,6 +6008,8 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
5994 "Kill switch must be turned off for " 6008 "Kill switch must be turned off for "
5995 "wireless networking to work.\n"); 6009 "wireless networking to work.\n");
5996 } 6010 }
6011 iwl_rfkill_set_hw_state(priv);
6012
5997 mutex_unlock(&priv->mutex); 6013 mutex_unlock(&priv->mutex);
5998} 6014}
5999 6015
@@ -6674,7 +6690,8 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
6674 } 6690 }
6675#endif 6691#endif
6676 6692
6677 iwl4965_radio_kill_sw(priv, !conf->radio_enabled); 6693 if (priv->cfg->ops->lib->radio_kill_sw)
6694 priv->cfg->ops->lib->radio_kill_sw(priv, !conf->radio_enabled);
6678 6695
6679 if (!conf->radio_enabled) { 6696 if (!conf->radio_enabled) {
6680 IWL_DEBUG_MAC80211("leave - radio disabled\n"); 6697 IWL_DEBUG_MAC80211("leave - radio disabled\n");
@@ -7449,36 +7466,6 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
7449 7466
7450#endif /* CONFIG_IWLWIFI_DEBUG */ 7467#endif /* CONFIG_IWLWIFI_DEBUG */
7451 7468
7452static ssize_t show_rf_kill(struct device *d,
7453 struct device_attribute *attr, char *buf)
7454{
7455 /*
7456 * 0 - RF kill not enabled
7457 * 1 - SW based RF kill active (sysfs)
7458 * 2 - HW based RF kill active
7459 * 3 - Both HW and SW based RF kill active
7460 */
7461 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
7462 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) |
7463 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0);
7464
7465 return sprintf(buf, "%i\n", val);
7466}
7467
7468static ssize_t store_rf_kill(struct device *d,
7469 struct device_attribute *attr,
7470 const char *buf, size_t count)
7471{
7472 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
7473
7474 mutex_lock(&priv->mutex);
7475 iwl4965_radio_kill_sw(priv, buf[0] == '1');
7476 mutex_unlock(&priv->mutex);
7477
7478 return count;
7479}
7480
7481static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
7482 7469
7483static ssize_t show_temperature(struct device *d, 7470static ssize_t show_temperature(struct device *d,
7484 struct device_attribute *attr, char *buf) 7471 struct device_attribute *attr, char *buf)
@@ -7964,7 +7951,6 @@ static struct attribute *iwl4965_sysfs_entries[] = {
7964#endif 7951#endif
7965 &dev_attr_power_level.attr, 7952 &dev_attr_power_level.attr,
7966 &dev_attr_retry_rate.attr, 7953 &dev_attr_retry_rate.attr,
7967 &dev_attr_rf_kill.attr,
7968 &dev_attr_rs_window.attr, 7954 &dev_attr_rs_window.attr,
7969 &dev_attr_statistics.attr, 7955 &dev_attr_statistics.attr,
7970 &dev_attr_status.attr, 7956 &dev_attr_status.attr,