diff options
author | Bob Copeland <me@bobcopeland.com> | 2010-04-07 23:55:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-08 15:24:14 -0400 |
commit | 1968cc78d91c79857089713bf3f3cceb5e9c63ae (patch) | |
tree | feaad505977ddd15f930b0d9411b15e1d40e2163 | |
parent | b5878a2dc5e7e7f031a52c3e15b571224cb6b540 (diff) |
ath5k: correct channel setting for 2.5 mhz spacing
These channels aren't selectable anyway, but our calculations
for 2.5 mhz frequencies are incorrect. The value is supposed to
be:
(frequency - reference) * (10/25)
i.e., divide by 2.5, but we were instead doing:
(10 * frequency - reference) / 25.
Additionally, the check for (frequency % 5 == 2) had an extra
subtraction that wasn't in madwifi HAL.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index b6704c93f808..fcfc32d4da20 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -979,7 +979,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
979 | return -EINVAL; | 979 | return -EINVAL; |
980 | 980 | ||
981 | data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); | 981 | data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); |
982 | } else if ((c - (c % 5)) != 2 || c > 5435) { | 982 | } else if ((c % 5) != 2 || c > 5435) { |
983 | if (!(c % 20) && c >= 5120) { | 983 | if (!(c % 20) && c >= 5120) { |
984 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); | 984 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); |
985 | data2 = ath5k_hw_bitswap(3, 2); | 985 | data2 = ath5k_hw_bitswap(3, 2); |
@@ -992,7 +992,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
992 | } else | 992 | } else |
993 | return -EINVAL; | 993 | return -EINVAL; |
994 | } else { | 994 | } else { |
995 | data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); | 995 | data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8); |
996 | data2 = ath5k_hw_bitswap(0, 2); | 996 | data2 = ath5k_hw_bitswap(0, 2); |
997 | } | 997 | } |
998 | 998 | ||
@@ -1020,7 +1020,7 @@ static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah, | |||
1020 | data0 = ath5k_hw_bitswap((c - 2272), 8); | 1020 | data0 = ath5k_hw_bitswap((c - 2272), 8); |
1021 | data2 = 0; | 1021 | data2 = 0; |
1022 | /* ? 5GHz ? */ | 1022 | /* ? 5GHz ? */ |
1023 | } else if ((c - (c % 5)) != 2 || c > 5435) { | 1023 | } else if ((c % 5) != 2 || c > 5435) { |
1024 | if (!(c % 20) && c < 5120) | 1024 | if (!(c % 20) && c < 5120) |
1025 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); | 1025 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); |
1026 | else if (!(c % 10)) | 1026 | else if (!(c % 10)) |
@@ -1031,7 +1031,7 @@ static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah, | |||
1031 | return -EINVAL; | 1031 | return -EINVAL; |
1032 | data2 = ath5k_hw_bitswap(1, 2); | 1032 | data2 = ath5k_hw_bitswap(1, 2); |
1033 | } else { | 1033 | } else { |
1034 | data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); | 1034 | data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8); |
1035 | data2 = ath5k_hw_bitswap(0, 2); | 1035 | data2 = ath5k_hw_bitswap(0, 2); |
1036 | } | 1036 | } |
1037 | 1037 | ||