ase wrote:I've tested these patches and they seem to work fine. Good job!
Could you include an example of configuring the wan led via the switch as well in the config file?
OK--submitted. We'll see what happens. Thanks for all of your work on the switch driver and finding the WLAN LEDs!
I noticed that juhosg's antenna patch is toggling some GPIOs to select a fixed antenna group. I thought it might be interesting to play with some of the other settings on those GPIOs to see if any other antenna group(s) might work better and/or differently.
If you add the following code as package/mac80211/patches/590-wndr3700-antenna.patch, you can then adjust the value of those four GPIOs using module parameters:
--- a/drivers/net/wireless/ath/ath9k/init.c 2010-01-18 14:11:59.943782130 -0200
+++ b/drivers/net/wireless/ath/ath9k/init.c 2010-01-18 14:12:59.015805947 -0200
@@ -32,6 +32,22 @@
module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
+static int modparam_as1 = 0;
+module_param_named(as1, modparam_as1, int, 0664);
+MODULE_PARM_DESC(as1, "WNDR3700 antenna select 1");
+
+static int modparam_as2 = 1;
+module_param_named(as2, modparam_as2, int, 0664);
+MODULE_PARM_DESC(as2, "WNDR3700 antenna select 2");
+
+static int modparam_as3 = 0;
+module_param_named(as3, modparam_as3, int, 0664);
+MODULE_PARM_DESC(as3, "WNDR3700 antenna select 3");
+
+static int modparam_as4 = 1;
+module_param_named(as4, modparam_as4, int, 0664);
+MODULE_PARM_DESC(as4, "WNDR3700 antenna select 4");
+
/* We use the hw_value as an index into our private channel structure */
#define CHAN2G(_freq, _idx) { \
@@ -682,10 +698,14 @@
ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
/* select the first antenna group */
- ath9k_hw_set_gpio(ah, 6, 0);
- ath9k_hw_set_gpio(ah, 7, 1);
- ath9k_hw_set_gpio(ah, 8, 0);
- ath9k_hw_set_gpio(ah, 9, 1);
+ ath9k_hw_set_gpio(ah, 6, modparam_as1);
+ ath9k_hw_set_gpio(ah, 7, modparam_as2);
+ ath9k_hw_set_gpio(ah, 8, modparam_as3);
+ ath9k_hw_set_gpio(ah, 9, modparam_as4);
+
+ ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
+ "WNDR3700 antenna configuration: %d %d %d %d\n",
+ modparam_as1, modparam_as2, modparam_as3, modparam_as4);
}
#else
static inline void wndr3700_init_antenna(struct ath_hw *ah) {}
After doing this, assuming that you built ath9k as a module, you can then edit /etc/modules.d/27-ath9k and adjust the file to look like this:
ath9k_hw
ath9k_common
ath9k as1=0 as2=1 as3=0 as4=1
You can then try varying the values of as1 through as4 to see what happens (with the above being the current default config). I was rebooting between changes--it should be testable, at least in theory, by doing rmmod followed by modprobe, but that seemed to confuse something in the wireless code--and you can confirm by looking for "WNDR3700" in dmesg to verify that your specified GPIOs were correctly configured.
I haven't had a lot of time to play with it yet, but if these settings turn out to do something useful that needs to be accessed from userspace, we could think about a /proc filesystem interface for it.