diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-05-24 23:30:35 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-05-24 23:30:35 +0000 |
commit | 740bd443bd87347bf636e6b24e3ae379dcf33c30 (patch) | |
tree | 522ec858997905e802594c857b8e4f41ba77f949 /target/linux/au1000-2.6/files/drivers/leds | |
parent | 2d84656963645199fb695344818787f2310da825 (diff) |
add generic GPIO to MIPS boards, use it for au1000 and for the MTX-1 led driver as well
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7334 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/au1000-2.6/files/drivers/leds')
-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) |