]>
Commit | Line | Data |
---|---|---|
92b96797 FB |
1 | /* |
2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; if not, write to the Free Software Foundation, Inc., | |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | * | |
19 | * | |
20 | * File: channel.c | |
21 | * | |
bbc9a991 | 22 | * Purpose: Channel number mapping |
92b96797 FB |
23 | * |
24 | * Author: Lucas Lin | |
25 | * | |
26 | * Date: Dec 24, 2004 | |
27 | * | |
28 | * | |
29 | * | |
30 | * Revision History: | |
618d7d07 PST |
31 | * 01-18-2005 RobertYu: remove the for loop searching in |
32 | * ChannelValid, change ChannelRuleTab | |
33 | * to lookup-type, reorder table items. | |
92b96797 FB |
34 | * |
35 | * | |
36 | */ | |
37 | ||
110f97e9 | 38 | #include "device.h" |
92b96797 | 39 | #include "channel.h" |
92b96797 | 40 | #include "rf.h" |
92b96797 | 41 | |
110f97e9 MP |
42 | static struct ieee80211_rate vnt_rates_bg[] = { |
43 | { .bitrate = 10, .hw_value = RATE_1M }, | |
44 | { .bitrate = 20, .hw_value = RATE_2M }, | |
45 | { .bitrate = 55, .hw_value = RATE_5M }, | |
46 | { .bitrate = 110, .hw_value = RATE_11M }, | |
47 | { .bitrate = 60, .hw_value = RATE_6M }, | |
48 | { .bitrate = 90, .hw_value = RATE_9M }, | |
49 | { .bitrate = 120, .hw_value = RATE_12M }, | |
50 | { .bitrate = 180, .hw_value = RATE_18M }, | |
51 | { .bitrate = 240, .hw_value = RATE_24M }, | |
52 | { .bitrate = 360, .hw_value = RATE_36M }, | |
53 | { .bitrate = 480, .hw_value = RATE_48M }, | |
54 | { .bitrate = 540, .hw_value = RATE_54M }, | |
55 | }; | |
56 | ||
57 | static struct ieee80211_rate vnt_rates_a[] = { | |
58 | { .bitrate = 60, .hw_value = RATE_6M }, | |
59 | { .bitrate = 90, .hw_value = RATE_9M }, | |
60 | { .bitrate = 120, .hw_value = RATE_12M }, | |
61 | { .bitrate = 180, .hw_value = RATE_18M }, | |
62 | { .bitrate = 240, .hw_value = RATE_24M }, | |
63 | { .bitrate = 360, .hw_value = RATE_36M }, | |
64 | { .bitrate = 480, .hw_value = RATE_48M }, | |
65 | { .bitrate = 540, .hw_value = RATE_54M }, | |
66 | }; | |
67 | ||
68 | static struct ieee80211_channel vnt_channels_2ghz[] = { | |
69 | { .center_freq = 2412, .hw_value = 1 }, | |
70 | { .center_freq = 2417, .hw_value = 2 }, | |
71 | { .center_freq = 2422, .hw_value = 3 }, | |
72 | { .center_freq = 2427, .hw_value = 4 }, | |
73 | { .center_freq = 2432, .hw_value = 5 }, | |
74 | { .center_freq = 2437, .hw_value = 6 }, | |
75 | { .center_freq = 2442, .hw_value = 7 }, | |
76 | { .center_freq = 2447, .hw_value = 8 }, | |
77 | { .center_freq = 2452, .hw_value = 9 }, | |
78 | { .center_freq = 2457, .hw_value = 10 }, | |
79 | { .center_freq = 2462, .hw_value = 11 }, | |
80 | { .center_freq = 2467, .hw_value = 12 }, | |
81 | { .center_freq = 2472, .hw_value = 13 }, | |
82 | { .center_freq = 2484, .hw_value = 14 } | |
83 | }; | |
84 | ||
85 | static struct ieee80211_channel vnt_channels_5ghz[] = { | |
86 | { .center_freq = 4915, .hw_value = 15 }, | |
87 | { .center_freq = 4920, .hw_value = 16 }, | |
88 | { .center_freq = 4925, .hw_value = 17 }, | |
89 | { .center_freq = 4935, .hw_value = 18 }, | |
90 | { .center_freq = 4940, .hw_value = 19 }, | |
91 | { .center_freq = 4945, .hw_value = 20 }, | |
92 | { .center_freq = 4960, .hw_value = 21 }, | |
93 | { .center_freq = 4980, .hw_value = 22 }, | |
94 | { .center_freq = 5035, .hw_value = 23 }, | |
95 | { .center_freq = 5040, .hw_value = 24 }, | |
96 | { .center_freq = 5045, .hw_value = 25 }, | |
97 | { .center_freq = 5055, .hw_value = 26 }, | |
98 | { .center_freq = 5060, .hw_value = 27 }, | |
99 | { .center_freq = 5080, .hw_value = 28 }, | |
100 | { .center_freq = 5170, .hw_value = 29 }, | |
101 | { .center_freq = 5180, .hw_value = 30 }, | |
102 | { .center_freq = 5190, .hw_value = 31 }, | |
103 | { .center_freq = 5200, .hw_value = 32 }, | |
104 | { .center_freq = 5210, .hw_value = 33 }, | |
105 | { .center_freq = 5220, .hw_value = 34 }, | |
106 | { .center_freq = 5230, .hw_value = 35 }, | |
107 | { .center_freq = 5240, .hw_value = 36 }, | |
108 | { .center_freq = 5260, .hw_value = 37 }, | |
109 | { .center_freq = 5280, .hw_value = 38 }, | |
110 | { .center_freq = 5300, .hw_value = 39 }, | |
111 | { .center_freq = 5320, .hw_value = 40 }, | |
112 | { .center_freq = 5500, .hw_value = 41 }, | |
113 | { .center_freq = 5520, .hw_value = 42 }, | |
114 | { .center_freq = 5540, .hw_value = 43 }, | |
115 | { .center_freq = 5560, .hw_value = 44 }, | |
116 | { .center_freq = 5580, .hw_value = 45 }, | |
117 | { .center_freq = 5600, .hw_value = 46 }, | |
118 | { .center_freq = 5620, .hw_value = 47 }, | |
119 | { .center_freq = 5640, .hw_value = 48 }, | |
120 | { .center_freq = 5660, .hw_value = 49 }, | |
121 | { .center_freq = 5680, .hw_value = 50 }, | |
122 | { .center_freq = 5700, .hw_value = 51 }, | |
123 | { .center_freq = 5745, .hw_value = 52 }, | |
124 | { .center_freq = 5765, .hw_value = 53 }, | |
125 | { .center_freq = 5785, .hw_value = 54 }, | |
126 | { .center_freq = 5805, .hw_value = 55 }, | |
127 | { .center_freq = 5825, .hw_value = 56 } | |
128 | }; | |
129 | ||
130 | static struct ieee80211_supported_band vnt_supported_2ghz_band = { | |
131 | .channels = vnt_channels_2ghz, | |
132 | .n_channels = ARRAY_SIZE(vnt_channels_2ghz), | |
133 | .bitrates = vnt_rates_bg, | |
134 | .n_bitrates = ARRAY_SIZE(vnt_rates_bg), | |
135 | }; | |
136 | ||
137 | static struct ieee80211_supported_band vnt_supported_5ghz_band = { | |
138 | .channels = vnt_channels_5ghz, | |
139 | .n_channels = ARRAY_SIZE(vnt_channels_5ghz), | |
140 | .bitrates = vnt_rates_a, | |
141 | .n_bitrates = ARRAY_SIZE(vnt_rates_a), | |
142 | }; | |
143 | ||
144 | void vnt_init_bands(struct vnt_private *priv) | |
145 | { | |
146 | struct ieee80211_channel *ch; | |
147 | int i; | |
148 | ||
6242ecae | 149 | switch (priv->rf_type) { |
110f97e9 MP |
150 | case RF_AIROHA7230: |
151 | case RF_VT3342A0: | |
b63d6ed6 | 152 | default: |
110f97e9 MP |
153 | ch = vnt_channels_5ghz; |
154 | ||
155 | for (i = 0; i < ARRAY_SIZE(vnt_channels_5ghz); i++) { | |
156 | ch[i].max_power = VNT_RF_MAX_POWER; | |
157 | ch[i].flags = IEEE80211_CHAN_NO_HT40; | |
158 | } | |
159 | ||
160 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | |
161 | &vnt_supported_5ghz_band; | |
162 | /* fallthrough */ | |
163 | case RF_AL2230: | |
164 | case RF_AL2230S: | |
165 | case RF_VT3226: | |
166 | case RF_VT3226D0: | |
167 | ch = vnt_channels_2ghz; | |
168 | ||
169 | for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) { | |
170 | ch[i].max_power = VNT_RF_MAX_POWER; | |
171 | ch[i].flags = IEEE80211_CHAN_NO_HT40; | |
172 | } | |
173 | ||
174 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | |
175 | &vnt_supported_2ghz_band; | |
176 | break; | |
177 | } | |
178 | } |