Commit c9eec95c authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

iwlwifi: move rfkill status handling out of transport

The transport layer should only check the
hardware RF kill status, not impose any
policy or reaction based on it, so move
that out of it into the op_mode.

For now keep the restriction on loading
firmware, that will have to be removed
later.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b1eea297
...@@ -1460,6 +1460,11 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) ...@@ -1460,6 +1460,11 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
{ {
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
if (state)
set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
else
clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
wiphy_rfkill_set_hw_state(priv->hw->wiphy, state); wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
} }
......
...@@ -1016,30 +1016,16 @@ void iwl_irq_tasklet(struct iwl_trans *trans) ...@@ -1016,30 +1016,16 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
/* HW RF KILL switch toggled */ /* HW RF KILL switch toggled */
if (inta & CSR_INT_BIT_RF_KILL) { if (inta & CSR_INT_BIT_RF_KILL) {
int hw_rf_kill = 0; bool hw_rfkill;
if (!(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
hw_rf_kill = 1;
hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
IWL_WARN(trans, "RF_KILL bit toggled to %s.\n", IWL_WARN(trans, "RF_KILL bit toggled to %s.\n",
hw_rf_kill ? "disable radio" : "enable radio"); hw_rfkill ? "disable radio" : "enable radio");
isr_stats->rfkill++; isr_stats->rfkill++;
/* driver only loads ucode once setting the interface up. iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
* the driver allows loading the ucode even if the radio
* is killed. Hence update the killswitch state here. The
* rfkill handler will care about restarting if needed.
*/
if (!test_bit(STATUS_ALIVE, &trans->shrd->status)) {
if (hw_rf_kill)
set_bit(STATUS_RF_KILL_HW,
&trans->shrd->status);
else
clear_bit(STATUS_RF_KILL_HW,
&trans->shrd->status);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rf_kill);
}
handled |= CSR_INT_BIT_RF_KILL; handled |= CSR_INT_BIT_RF_KILL;
} }
......
...@@ -1021,6 +1021,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, ...@@ -1021,6 +1021,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
int ret; int ret;
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
bool hw_rfkill;
trans->shrd->ucode_owner = IWL_OWNERSHIP_DRIVER; trans->shrd->ucode_owner = IWL_OWNERSHIP_DRIVER;
trans_pcie->ac_to_queue[IWL_RXON_CTX_BSS] = iwlagn_bss_ac_to_queue; trans_pcie->ac_to_queue[IWL_RXON_CTX_BSS] = iwlagn_bss_ac_to_queue;
...@@ -1039,14 +1040,11 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, ...@@ -1039,14 +1040,11 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
} }
/* If platform's RF_KILL switch is NOT set to KILL */ /* If platform's RF_KILL switch is NOT set to KILL */
if (iwl_read32(trans, CSR_GP_CNTRL) & hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
clear_bit(STATUS_RF_KILL_HW, &trans->shrd->status); iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
else
set_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
if (iwl_is_rfkill(trans->shrd)) { if (hw_rfkill) {
iwl_op_mode_hw_rf_kill(trans->op_mode, true);
iwl_enable_interrupts(trans); iwl_enable_interrupts(trans);
return -ERFKILL; return -ERFKILL;
} }
...@@ -1506,6 +1504,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) ...@@ -1506,6 +1504,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
int err; int err;
bool hw_rfkill;
trans_pcie->inta_mask = CSR_INI_SET_MASK; trans_pcie->inta_mask = CSR_INI_SET_MASK;
...@@ -1535,16 +1534,9 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) ...@@ -1535,16 +1534,9 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
iwl_apm_init(trans); iwl_apm_init(trans);
/* If platform's RF_KILL switch is NOT set to KILL */ hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
if (iwl_read32(trans, CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
clear_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
else
set_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
iwl_op_mode_hw_rf_kill(trans->op_mode,
test_bit(STATUS_RF_KILL_HW,
&trans->shrd->status));
return err; return err;
...@@ -1659,19 +1651,12 @@ static int iwl_trans_pcie_suspend(struct iwl_trans *trans) ...@@ -1659,19 +1651,12 @@ static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
static int iwl_trans_pcie_resume(struct iwl_trans *trans) static int iwl_trans_pcie_resume(struct iwl_trans *trans)
{ {
bool hw_rfkill = false; bool hw_rfkill;
iwl_enable_interrupts(trans); iwl_enable_interrupts(trans);
if (!(iwl_read32(trans, CSR_GP_CNTRL) & hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) &
CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
hw_rfkill = true;
if (hw_rfkill)
set_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
else
clear_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment