ath5k: fix enabling 5/10 mhz channel bandwidth support
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 39758
This commit is contained in:
		@@ -11,7 +11,7 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/debug.c
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/debug.c
 | 
			
		||||
@@ -821,6 +821,89 @@ static const struct file_operations fops
 | 
			
		||||
@@ -821,6 +821,97 @@ static const struct file_operations fops
 | 
			
		||||
 	.llseek = default_llseek,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
 | 
			
		||||
+	char buf[15];
 | 
			
		||||
+	unsigned int len = 0;
 | 
			
		||||
+
 | 
			
		||||
+	int cur_ah_bwmode = ah->ah_bwmode;
 | 
			
		||||
+	int cur_ah_bwmode = ah->ah_bwmode_debug;
 | 
			
		||||
+
 | 
			
		||||
+#define print_selected(MODE, LABEL) \
 | 
			
		||||
+	if (cur_ah_bwmode == MODE) \
 | 
			
		||||
@@ -77,16 +77,24 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
 | 
			
		||||
+		bw, tobwmode);
 | 
			
		||||
+
 | 
			
		||||
+	switch (ah->ah_radio) {
 | 
			
		||||
+		/* TODO: only define radios that actually support 5/10mhz channels */
 | 
			
		||||
+		case AR5K_RF5413: case AR5K_RF5110: case AR5K_RF5111: case AR5K_RF5112: case AR5K_RF2413: case AR5K_RF2316: case AR5K_RF2317: case AR5K_RF2425:
 | 
			
		||||
+			if(ah->ah_bwmode != tobwmode) {
 | 
			
		||||
+				mutex_lock(&ah->lock);
 | 
			
		||||
+				ah->ah_bwmode = tobwmode;
 | 
			
		||||
+				mutex_unlock(&ah->lock);
 | 
			
		||||
+			}
 | 
			
		||||
+			break;
 | 
			
		||||
+		default:
 | 
			
		||||
+			return -EOPNOTSUPP;
 | 
			
		||||
+	/* TODO: only define radios that actually support 5/10mhz channels */
 | 
			
		||||
+	case AR5K_RF5413:
 | 
			
		||||
+	case AR5K_RF5110:
 | 
			
		||||
+	case AR5K_RF5111:
 | 
			
		||||
+	case AR5K_RF5112:
 | 
			
		||||
+	case AR5K_RF2413:
 | 
			
		||||
+	case AR5K_RF2316:
 | 
			
		||||
+	case AR5K_RF2317:
 | 
			
		||||
+	case AR5K_RF2425:
 | 
			
		||||
+		if(ah->ah_bwmode_debug != tobwmode) {
 | 
			
		||||
+			mutex_lock(&ah->lock);
 | 
			
		||||
+			ah->ah_bwmode = tobwmode;
 | 
			
		||||
+			ah->ah_bwmode_debug = tobwmode;
 | 
			
		||||
+			mutex_unlock(&ah->lock);
 | 
			
		||||
+		}
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		return -EOPNOTSUPP;
 | 
			
		||||
+	}
 | 
			
		||||
+	return count;
 | 
			
		||||
+}
 | 
			
		||||
@@ -101,7 +109,7 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
 | 
			
		||||
 
 | 
			
		||||
 /* debugfs: queues etc */
 | 
			
		||||
 
 | 
			
		||||
@@ -914,6 +997,9 @@ ath5k_debug_init_device(struct ath5k_hw 
 | 
			
		||||
@@ -914,6 +1005,9 @@ ath5k_debug_init_device(struct ath5k_hw 
 | 
			
		||||
 	debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, ah,
 | 
			
		||||
 			    &fops_beacon);
 | 
			
		||||
 
 | 
			
		||||
@@ -111,3 +119,25 @@ drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++
 | 
			
		||||
 	debugfs_create_file("reset", S_IWUSR, phydir, ah, &fops_reset);
 | 
			
		||||
 
 | 
			
		||||
 	debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
 | 
			
		||||
@@ -1369,6 +1369,7 @@ struct ath5k_hw {
 | 
			
		||||
 	u8			ah_coverage_class;
 | 
			
		||||
 	bool			ah_ack_bitrate_high;
 | 
			
		||||
 	u8			ah_bwmode;
 | 
			
		||||
+	u8			ah_bwmode_debug;
 | 
			
		||||
 	bool			ah_short_slot;
 | 
			
		||||
 
 | 
			
		||||
 	/* Antenna Control */
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/base.c
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/base.c
 | 
			
		||||
@@ -466,6 +466,9 @@ ath5k_chan_set(struct ath5k_hw *ah, stru
 | 
			
		||||
 		return -EINVAL;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (ah->ah_bwmode_debug != AR5K_BWMODE_DEFAULT)
 | 
			
		||||
+		ah->ah_bwmode = ah->ah_bwmode_debug;
 | 
			
		||||
+
 | 
			
		||||
 	/*
 | 
			
		||||
 	 * To switch channels clear any pending DMA operations;
 | 
			
		||||
 	 * wait long enough for the RX fifo to drain, reset the
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user