diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-05-24 23:30:35 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-05-24 23:30:35 +0000 |
commit | 336885694424dcaa837fd54c515bb74f4d4aa409 (patch) | |
tree | 990cfe1d4a3ef2290dbf89c60aeb5f5dc7f3c88c /target/linux/au1000-2.6/files/drivers | |
parent | 46f7d89f9cafe635d8d3abae28a78927ce2fd63d (diff) | |
download | upstream-336885694424dcaa837fd54c515bb74f4d4aa409.tar.gz upstream-336885694424dcaa837fd54c515bb74f4d4aa409.tar.bz2 upstream-336885694424dcaa837fd54c515bb74f4d4aa409.zip |
add generic GPIO to MIPS boards, use it for au1000 and for the MTX-1 led driver as well
SVN-Revision: 7334
Diffstat (limited to 'target/linux/au1000-2.6/files/drivers')
-rw-r--r-- | target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c b/target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c index 86615f46b4..4c2ab55fc3 100644 --- a/target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c +++ b/target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c @@ -14,41 +14,26 @@ #include <linux/platform_device.h> #include <linux/leds.h> #include <linux/err.h> -#include <asm/mach-au1x00/au1000.h> +#include <asm/gpio.h> static struct platform_device *pdev; -static void mtx1_green_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) +static void mtx1_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) { - /* The power LED cannot be controlled the same way as for the Status LED */ - if (brightness) { - au_writel( 0x18000800, GPIO2_OUTPUT ); - } else { - au_writel( 0x18000000, GPIO2_OUTPUT); - } -} - -static void mtx1_red_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) -{ - /* We store GPIO address (originally address - 200) in the "flags" field*/ - unsigned long pinmask = 1 << led_cdev->flags; - if (brightness) { - au_writel((pinmask << 16) | pinmask, GPIO2_OUTPUT); - } else { - au_writel((pinmask << 16) | 0, GPIO2_OUTPUT); - } + if (!strcmp("mtx1:green", led_cdev->name)) + gpio_set_value(211, brightness ? 1 : 0); + else + gpio_set_value(212, brightness ? 1 : 0); } static struct led_classdev mtx1_green_led = { .name = "mtx1:green", - .brightness_set = mtx1_green_led_set, + .brightness_set = mtx1_led_set, }; static struct led_classdev mtx1_red_led = { .name = "mtx1:red", - .flags = 12, - .brightness_set = mtx1_red_led_set, - .default_trigger = "ide-disk", + .brightness_set = mtx1_led_set, }; static int mtx1_leds_probe(struct platform_device *pdev) |