diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index ab4c4bae7600..2406b73e9093 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2717,19 +2717,34 @@ static void iwl3945_bg_alive_start(struct work_struct *data) | |||
2717 | mutex_unlock(&priv->mutex); | 2717 | mutex_unlock(&priv->mutex); |
2718 | } | 2718 | } |
2719 | 2719 | ||
2720 | /* | ||
2721 | * 3945 cannot interrupt driver when hardware rf kill switch toggles; | ||
2722 | * driver must poll CSR_GP_CNTRL_REG register for change. This register | ||
2723 | * *is* readable even when device has been SW_RESET into low power mode | ||
2724 | * (e.g. during RF KILL). | ||
2725 | */ | ||
2720 | static void iwl3945_rfkill_poll(struct work_struct *data) | 2726 | static void iwl3945_rfkill_poll(struct work_struct *data) |
2721 | { | 2727 | { |
2722 | struct iwl_priv *priv = | 2728 | struct iwl_priv *priv = |
2723 | container_of(data, struct iwl_priv, rfkill_poll.work); | 2729 | container_of(data, struct iwl_priv, rfkill_poll.work); |
2730 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); | ||
2731 | bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) | ||
2732 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | ||
2724 | 2733 | ||
2725 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 2734 | if (new_rfkill != old_rfkill) { |
2726 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2735 | if (new_rfkill) |
2727 | else | 2736 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
2728 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2737 | else |
2738 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | ||
2729 | 2739 | ||
2730 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, | 2740 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); |
2731 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 2741 | |
2742 | IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", | ||
2743 | new_rfkill ? "disable radio" : "enable radio"); | ||
2744 | } | ||
2732 | 2745 | ||
2746 | /* Keep this running, even if radio now enabled. This will be | ||
2747 | * cancelled in mac_start() if system decides to start again */ | ||
2733 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 2748 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, |
2734 | round_jiffies_relative(2 * HZ)); | 2749 | round_jiffies_relative(2 * HZ)); |
2735 | 2750 | ||