aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00ht.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00ht.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00ht.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
index 5a407602ce3e..c4b749da4302 100644
--- a/drivers/net/wireless/rt2x00/rt2x00ht.c
+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
@@ -84,3 +84,31 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
84 else 84 else
85 txdesc->txop = TXOP_HTTXOP; 85 txdesc->txop = TXOP_HTTXOP;
86} 86}
87
88u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
89 struct ieee80211_conf *conf)
90{
91 struct hw_mode_spec *spec = &rt2x00dev->spec;
92 int center_channel;
93 u16 i;
94
95 /*
96 * Initialize center channel to current channel.
97 */
98 center_channel = spec->channels[conf->channel->hw_value].channel;
99
100 /*
101 * Adjust center channel to HT40+ and HT40- operation.
102 */
103 if (conf_is_ht40_plus(conf))
104 center_channel += 2;
105 else if (conf_is_ht40_minus(conf))
106 center_channel -= (center_channel == 14) ? 1 : 2;
107
108 for (i = 0; i < spec->num_channels; i++)
109 if (spec->channels[i].channel == center_channel)
110 return i;
111
112 WARN_ON(1);
113 return conf->channel->hw_value;
114}