diff options
author | Eugene Konev <ejka@imfi.kspu.ru> | 2007-10-19 03:02:49 +0000 |
---|---|---|
committer | Eugene Konev <ejka@imfi.kspu.ru> | 2007-10-19 03:02:49 +0000 |
commit | 1e5a1f2aa5cb2f2574a9ad332ffda470d87b5f5f (patch) | |
tree | 5f5df6177d4b4726b43b4bb8cef2769cdea8b69f /target/linux/ar7 | |
parent | 32dc9ca55a4e4416a8c72fe5611440a1ce1f3e36 (diff) | |
download | mtk-20170518-1e5a1f2aa5cb2f2574a9ad332ffda470d87b5f5f.zip mtk-20170518-1e5a1f2aa5cb2f2574a9ad332ffda470d87b5f5f.tar.gz mtk-20170518-1e5a1f2aa5cb2f2574a9ad332ffda470d87b5f5f.tar.bz2 |
fritzbox leds detection (thanks Axel Gembe)
SVN-Revision: 9357
Diffstat (limited to 'target/linux/ar7')
-rw-r--r-- | target/linux/ar7/files/arch/mips/ar7/platform.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/target/linux/ar7/files/arch/mips/ar7/platform.c b/target/linux/ar7/files/arch/mips/ar7/platform.c index c262986..c1cd5f9 100644 --- a/target/linux/ar7/files/arch/mips/ar7/platform.c +++ b/target/linux/ar7/files/arch/mips/ar7/platform.c @@ -31,6 +31,7 @@ #include <linux/version.h> #include <linux/vlynq.h> #include <linux/leds.h> +#include <linux/string.h> #include <asm/addrspace.h> #include <asm/ar7/ar7.h> @@ -322,7 +323,7 @@ static struct gpio_led default_leds[] = { { .name = "status", .gpio = 8, .active_low = 1, }, }; -static struct gpio_led fb_leds[] = { +static struct gpio_led fb_sl_leds[] = { { .name = "1", .gpio = 7, }, { .name = "2", .gpio = 13, .active_low = 1, }, { .name = "3", .gpio = 10, .active_low = 1, }, @@ -389,6 +390,30 @@ static void cpmac_get_mac(int instance, unsigned char *dev_addr) char2hex(mac[i * 3 + 1]); } +static void __init detect_leds(void) +{ + char *prId; + + /* Default LEDs */ + ar7_led_data.num_leds = ARRAY_SIZE(default_leds); + ar7_led_data.leds = default_leds; + + /* FIXME: the whole thing is unreliable */ + prId = prom_getenv("ProductID"); + + /* If we can't get the product id from PROM, use the default LEDs */ + if (!prId) + return; + + if (strstr(prId, "Fritz_Box_FON")) { + ar7_led_data.num_leds = ARRAY_SIZE(fb_fon_leds); + ar7_led_data.leds = fb_fon_leds; + } else if (strstr(prId, "Fritz_Box_")) { + ar7_led_data.num_leds = ARRAY_SIZE(fb_sl_leds); + ar7_led_data.leds = fb_sl_leds; + } +} + static int __init ar7_register_devices(void) { int res; @@ -472,9 +497,7 @@ static int __init ar7_register_devices(void) if (res) return res; -#warning FIXME: add model detection - ar7_led_data.num_leds = ARRAY_SIZE(default_leds); - ar7_led_data.leds = default_leds; + detect_leds(); res = platform_device_register(&ar7_gpio_leds); if (res) return res; |