aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-04-04 08:42:58 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-04-04 08:42:58 +0000
commit8e1a827487cd53e675cdd7714b60f83122ef21a8 (patch)
tree8964cee767e5f8c9a7112034cc89e8e2d8e3d815
parentdba1fdd47e7f6c9b07200f8ff0400f232ddbedf9 (diff)
downloadupstream-8e1a827487cd53e675cdd7714b60f83122ef21a8.tar.gz
upstream-8e1a827487cd53e675cdd7714b60f83122ef21a8.tar.bz2
upstream-8e1a827487cd53e675cdd7714b60f83122ef21a8.zip
mac80211: add WLAN LED support for Ralink RT305x SoC Devices
This patch adds WLAN LED support to the mac80211 driver for Ralink rt2x00/rt2800 (rt305x) SoC devices. The current driver in kmod-rt2800-lib is based upon PCI, not SoC. The WLAN LED drivers in rt2800lib.c set the LED brightness via an MCU request, but do nothing for SoC. This patch checks for SoC and sets the register to enable the WLAN LED (instead of an MCU request). This fixes the WLAN LED for RT305x devices (such as the HW550-3G). Signed-off-by: Layne Edwards <ledwards76@gmail.com> SVN-Revision: 26463
-rw-r--r--mac80211/patches/620-rt2x00_soc_led_support.patch75
-rw-r--r--package/mac80211/Makefile2
2 files changed, 76 insertions, 1 deletions
diff --git a/mac80211/patches/620-rt2x00_soc_led_support.patch b/mac80211/patches/620-rt2x00_soc_led_support.patch
new file mode 100644
index 0000000000..2b87b346d3
--- /dev/null
+++ b/mac80211/patches/620-rt2x00_soc_led_support.patch
@@ -0,0 +1,75 @@
+--- a/drivers/net/wireless/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/rt2x00/rt2800lib.c
+@@ -935,6 +935,7 @@
+ static void rt2800_brightness_set(struct led_classdev *led_cdev,
+ enum led_brightness brightness)
+ {
++ u32 reg;
+ struct rt2x00_led *led =
+ container_of(led_cdev, struct rt2x00_led, led_dev);
+ unsigned int enabled = brightness != LED_OFF;
+@@ -947,24 +948,46 @@
+ rt2x00_get_field16(led->rt2x00dev->led_mcu_reg,
+ EEPROM_FREQ_LED_MODE);
+
+- if (led->type == LED_TYPE_RADIO) {
+- rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
+- enabled ? 0x20 : 0);
+- } else if (led->type == LED_TYPE_ASSOC) {
+- rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
+- enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20);
+- } else if (led->type == LED_TYPE_QUALITY) {
+- /*
+- * The brightness is divided into 6 levels (0 - 5),
+- * The specs tell us the following levels:
+- * 0, 1 ,3, 7, 15, 31
+- * to determine the level in a simple way we can simply
+- * work with bitshifting:
+- * (1 << level) - 1
+- */
+- rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
+- (1 << brightness / (LED_FULL / 6)) - 1,
+- polarity);
++ /* Check for SoC (SOC devices don't support MCU requests) */
++ if (rt2x00_is_soc(led->rt2x00dev)) {
++ rt2800_register_read(led->rt2x00dev, LED_CFG, &reg);
++
++ /* Set LED Polarity */
++ rt2x00_set_field32(&reg, LED_CFG_LED_POLAR, polarity);
++
++ /* Set LED Mode */
++ if (led->type == LED_TYPE_RADIO) {
++ rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE,
++ enabled ? 3 : 0);
++ } else if (led->type == LED_TYPE_ASSOC) {
++ rt2x00_set_field32(&reg, LED_CFG_Y_LED_MODE,
++ enabled ? 3 : 0);
++ } else if (led->type == LED_TYPE_QUALITY) {
++ rt2x00_set_field32(&reg, LED_CFG_R_LED_MODE,
++ enabled ? 3 : 0);
++ }
++ rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
++ }
++ else {
++ if (led->type == LED_TYPE_RADIO) {
++ rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
++ enabled ? 0x20 : 0);
++ } else if (led->type == LED_TYPE_ASSOC) {
++ rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
++ enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20);
++ } else if (led->type == LED_TYPE_QUALITY) {
++ /*
++ * The brightness is divided into 6 levels (0 - 5),
++ * The specs tell us the following levels:
++ * 0, 1 ,3, 7, 15, 31
++ * to determine the level in a simple way we can simply
++ * work with bitshifting:
++ * (1 << level) - 1
++ */
++ rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
++ (1 << brightness / (LED_FULL / 6)) - 1,
++ polarity);
++ }
+ }
+ }
+
diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index 4c6e60a02a..b2f8a12fb0 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2011-03-24
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
PKG_MD5SUM:=f5713fb3ab59bdd3d0ce931b813ef960