struct ieee80211_channel channels[14];
struct ieee80211_rate rates[12];
+ bool radio_on;
+
/* RF preamble: Short, Long or Auto */
u8 radio_preamble;
- u8 radio_state;
/* WMM MODE 1 for enabled; 0 for disabled */
bool wmm_mode;
};
/* Radio settings */
-#define MWL8K_RADIO_FORCE 0x2
-#define MWL8K_RADIO_ENABLE 0x1
-#define MWL8K_RADIO_DISABLE 0x0
#define MWL8K_RADIO_AUTO_PREAMBLE 0x0005
#define MWL8K_RADIO_SHORT_PREAMBLE 0x0003
#define MWL8K_RADIO_LONG_PREAMBLE 0x0001
count = mwl8k_txq_busy(priv);
if (count) {
priv->tx_wait = &cmd_wait;
- if (priv->radio_state)
+ if (priv->radio_on)
mwl8k_tx_start(priv);
}
spin_unlock_bh(&priv->tx_lock);
ieee80211_tx_status_irqsafe(hw, skb);
- wake = !priv->inconfig && priv->radio_state;
+ wake = !priv->inconfig && priv->radio_on;
}
if (wake)
__le16 radio_on;
} __attribute__((packed));
-static int mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, int enable)
+static int
+mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, bool enable, bool force)
{
struct mwl8k_priv *priv = hw->priv;
struct mwl8k_cmd_802_11_radio_control *cmd;
int rc;
- if (((enable & MWL8K_RADIO_ENABLE) == priv->radio_state) &&
- !(enable & MWL8K_RADIO_FORCE))
+ if (enable == priv->radio_on && !force)
return 0;
- enable &= MWL8K_RADIO_ENABLE;
-
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (cmd == NULL)
return -ENOMEM;
kfree(cmd);
if (!rc)
- priv->radio_state = enable;
+ priv->radio_on = enable;
return rc;
}
+static int mwl8k_cmd_802_11_radio_disable(struct ieee80211_hw *hw)
+{
+ return mwl8k_cmd_802_11_radio_control(hw, 0, 0);
+}
+
+static int mwl8k_cmd_802_11_radio_enable(struct ieee80211_hw *hw)
+{
+ return mwl8k_cmd_802_11_radio_control(hw, 1, 0);
+}
+
static int
mwl8k_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble)
{
MWL8K_RADIO_SHORT_PREAMBLE :
MWL8K_RADIO_LONG_PREAMBLE);
- return mwl8k_cmd_802_11_radio_control(hw,
- MWL8K_RADIO_ENABLE | MWL8K_RADIO_FORCE);
+ return mwl8k_cmd_802_11_radio_control(hw, 1, 1);
}
/*
if (status & MWL8K_A2H_INT_QUEUE_EMPTY) {
if (!priv->inconfig &&
- priv->radio_state &&
+ priv->radio_on &&
mwl8k_txq_busy(priv))
mwl8k_tx_start(priv);
}
spin_lock_irq(&priv->tx_lock);
priv->inconfig = false;
- if (priv->pending_tx_pkts && priv->radio_state)
+ if (priv->pending_tx_pkts && priv->radio_on)
mwl8k_tx_start(priv);
spin_unlock_irq(&priv->tx_lock);
ieee80211_wake_queues(hw);
}
/* Turn on radio */
- if (mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_ENABLE)) {
+ if (mwl8k_cmd_802_11_radio_enable(hw)) {
rc = -EIO;
goto mwl8k_start_exit;
}
{
struct mwl8k_stop_worker *worker = (struct mwl8k_stop_worker *)wt;
struct ieee80211_hw *hw = worker->header.hw;
- int rc;
-
- rc = mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_DISABLE);
- return rc;
+ return mwl8k_cmd_802_11_radio_disable(hw);
}
static void mwl8k_stop(struct ieee80211_hw *hw)
struct mwl8k_priv *priv = hw->priv;
int rc = 0;
- if (mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_ENABLE)) {
+ if (mwl8k_cmd_802_11_radio_enable(hw)) {
rc = -EINVAL;
goto mwl8k_config_exit;
}
/* Set default radio state and preamble */
priv->radio_preamble = MWL8K_RADIO_DEFAULT_PREAMBLE;
- priv->radio_state = MWL8K_RADIO_DISABLE;
+ priv->radio_on = 0;
/* Finalize join worker */
INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker);
}
/* Turn radio off */
- rc = mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_DISABLE);
+ rc = mwl8k_cmd_802_11_radio_disable(hw);
if (rc) {
printk(KERN_ERR "%s: Cannot disable\n", priv->name);
goto err_stop_firmware;