p54: control output power levels
authorChristian Lamparter <chunkeey@web.de>
Sat, 6 Sep 2008 12:25:53 +0000 (14:25 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 11 Sep 2008 19:53:32 +0000 (15:53 -0400)
I hope this patch is enough to cover at least the basic requirements of IEEE 802.11h's TPC.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c

index 370202f..1d0704f 100644 (file)
@@ -88,6 +88,7 @@ struct p54_common {
        void *cached_vdcf;
        unsigned int fw_var;
        unsigned int fw_interface;
+       unsigned int output_power;
        u32 tsf_low32;
        u32 tsf_high32;
        struct ieee80211_tx_queue_stats tx_stats[8];
index 670d7ad..7ec695c 100644 (file)
@@ -800,7 +800,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        txhdr->hw_queue = skb_get_queue_mapping(skb) + 4;
        txhdr->tx_antenna = (info->antenna_sel_tx == 0) ?
                2 : info->antenna_sel_tx - 1;
-       txhdr->output_power = 0x7f; // HW Maximum
+       txhdr->output_power = priv->output_power;
        txhdr->cts_rate = (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
                          0 : cts_rate;
        if (padding)
@@ -1154,6 +1154,7 @@ static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
        mutex_lock(&priv->conf_mutex);
        priv->rx_antenna = (conf->antenna_sel_rx == 0) ?
                2 : conf->antenna_sel_tx - 1;
+       priv->output_power = conf->power_level << 2;
        ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq));
        p54_set_vdcf(dev);
        mutex_unlock(&priv->conf_mutex);