All pastes #1061453 Raw Edit

Something

public text v1 · immutable
#1061453 ·published 2008-07-03 17:08 UTC
rendered paste body
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index a43e9b2..d5d11c9 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -219,7 +219,7 @@ static int 	ath5k_attach(struct pci_dev *pdev,
 static void 	ath5k_detach(struct pci_dev *pdev,
 			struct ieee80211_hw *hw);
 /* Channel/mode setup */
-static inline short ath5k_ieee2mhz(short chan);
+static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
 static unsigned int ath5k_copy_rates(struct ieee80211_rate *rates,
 				const struct ath5k_rate_table *rt,
 				unsigned int max);
@@ -798,12 +798,15 @@ ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw)
  * Convert IEEE channel number to MHz frequency.
  */
 static inline short
-ath5k_ieee2mhz(short chan)
+ath5k_ieee2mhz(int chan, unsigned int chfreq)
 {
-	if (chan <= 14 || chan >= 27)
-		return ieee80211chan2mhz(chan);
+	if (chfreq == CHANNEL_5GHZ)
+		return (chan + 1000) * 5;
 	else
-		return 2212 + chan * 20;
+		if (chan <= 14 || chan >= 27)
+			return ieee80211chan2mhz(chan);
+		else
+			return 2212 + chan * 20;
 }
 
 static unsigned int
@@ -833,7 +836,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		unsigned int mode,
 		unsigned int max)
 {
-	unsigned int i, count, size, chfreq, freq, ch;
+	unsigned int i, count, size, chfreq, freq;
+       	int ch;
 
 	if (!test_bit(mode, ah->ah_modes))
 		return 0;
@@ -841,14 +845,17 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 	switch (mode) {
 	case AR5K_MODE_11A:
 	case AR5K_MODE_11A_TURBO:
-		/* 1..220, but 2GHz frequencies are filtered by check_channel */
-		size = 220 ;
+		/* -16..220 */
+		size = 237 ;
+		ch = -16;
 		chfreq = CHANNEL_5GHZ;
 		break;
 	case AR5K_MODE_11B:
 	case AR5K_MODE_11G:
 	case AR5K_MODE_11G_TURBO:
-		size = 26;
+		/* -19..26 */
+		size = 46;
+		ch = -19;
 		chfreq = CHANNEL_2GHZ;
 		break;
 	default:
@@ -856,9 +863,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		return 0;
 	}
 
-	for (i = 0, count = 0; i < size && max > 0; i++) {
-		ch = i + 1 ;
-		freq = ath5k_ieee2mhz(ch);
+	for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
+		freq = ath5k_ieee2mhz(ch,chfreq);
 
 		/* Check if channel is supported by the chipset */
 		if (!ath5k_channel_ok(ah, freq, chfreq))
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index c6d12c5..ba350e8 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -2258,7 +2258,7 @@ static int ath5k_hw_get_capabilities(struct ath5k_hw *ah)
 		 */
 
 		if (AR5K_EEPROM_HDR_11A(ee_header)) {
-			ah->ah_capabilities.cap_range.range_5ghz_min = 5005; /* 4920 */
+			ah->ah_capabilities.cap_range.range_5ghz_min = 4920; /* 4920 */
 			ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
 
 			/* Set supported modes */
@@ -2275,7 +2275,7 @@ static int ath5k_hw_get_capabilities(struct ath5k_hw *ah)
 		 * connected */
 		if (AR5K_EEPROM_HDR_11B(ee_header) ||
 				AR5K_EEPROM_HDR_11G(ee_header)) {
-			ah->ah_capabilities.cap_range.range_2ghz_min = 2412; /* 2312 */
+			ah->ah_capabilities.cap_range.range_2ghz_min = 2312; /* 2312 */
 			ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
 
 			if (AR5K_EEPROM_HDR_11B(ee_header))
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 855bff4..948390f 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -70,6 +70,14 @@ static const struct ieee80211_channel_range ieee80211_US_channels[] = {
 	RANGE_PWR(5745, 5825, 30, 6, 0),
 };
 
+static const struct ieee80211_channel_range ieee80211_DEBUG_channels[] = {
+	/* IEEE 802.11b/g, channels -19..26 */
+	RANGE_PWR(2312, 2732, 27, 6, 0),
+	/* IEEE 802.11a, channels -16..220, outdoor */
+	RANGE_PWR(4920, 6100, 30, 6, 0),
+};
+
+
 static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
 	/* IEEE 802.11b/g, channels 1..14 */
 	RANGE_PWR(2412, 2484, 20, 6, 0),
@@ -108,6 +116,7 @@ static const struct ieee80211_regdomain ieee80211_regdoms[] = {
 	REGDOM(US),
 	REGDOM(JP),
 	REGDOM(EU),
+	REGDOM(DEBUG),
 };
 
 
diff --git a/net/wireless/util.c b/net/wireless/util.c
index f544246..cab7b70 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -15,6 +15,9 @@ int ieee80211_channel_to_frequency(int chan)
 	if (chan == 14)
 		return 2484;
 
+	if (chan > 14 && chan <= 26)
+		return 2212 + chan * 20;
+
 	/* FIXME: 802.11j 17.3.8.3.2 */
 	return (chan + 1000) * 5;
 }
@@ -27,6 +30,9 @@ int ieee80211_frequency_to_channel(int freq)
 
 	if (freq < 2484)
 		return (freq - 2407) / 5;
+	
+	if (freq > 2484 && freq <= 2732) 
+		return (freq - 2212) / 20;
 
 	/* FIXME: 802.11j 17.3.8.3.2 */
 	return freq/5 - 1000;