1 diff -urN linux-2.6.19.2/drivers/leds/Kconfig linux-2.6.19.2.new/drivers/leds/Kconfig
2 --- linux-2.6.19.2/drivers/leds/Kconfig 2007-01-10 20:10:37.000000000 +0100
3 +++ linux-2.6.19.2.new/drivers/leds/Kconfig 2007-03-02 13:50:28.000000000 +0100
5 This option enables support for the Soekris net4801 and net4826 error
9 + tristate "LED Support for MTX-1 boards"
10 + depends on LEDS_CLASS && MIPS_MTX1
12 + This option enables support for the MTX-1 power and status LED.
15 comment "LED Triggers"
18 diff -urN linux-2.6.19.2/drivers/leds/Makefile linux-2.6.19.2.new/drivers/leds/Makefile
19 --- linux-2.6.19.2/drivers/leds/Makefile 2007-01-10 20:10:37.000000000 +0100
20 +++ linux-2.6.19.2.new/drivers/leds/Makefile 2007-03-02 13:49:35.000000000 +0100
22 obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
23 obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
24 obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
25 +obj-$(CONFIG_LEDS_MTX1) += leds-mtx1.o
28 obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
29 diff -urN linux-2.6.19.2/drivers/leds/leds-mtx1.c linux-2.6.19.2.new/drivers/leds/leds-mtx1.c
30 --- linux-2.6.19.2/drivers/leds/leds-mtx1.c 1970-01-01 01:00:00.000000000 +0100
31 +++ linux-2.6.19.2.new/drivers/leds/leds-mtx1.c 2007-03-02 13:49:08.000000000 +0100
34 + * LED driver for MTX-1 boards
36 + * Copyright 2007 Florian Fainelli <florian@openwrt.org>
38 + * This program is free software; you can redistribute it and/or modify
39 + * it under the terms of the GNU General Public License version 2 as
40 + * published by the Free Software Foundation.
44 +#include <linux/kernel.h>
45 +#include <linux/init.h>
46 +#include <linux/platform_device.h>
47 +#include <linux/leds.h>
48 +#include <linux/err.h>
49 +#include <asm/mach-au1x00/au1000.h>
51 +static struct platform_device *pdev;
53 +static void mtx1_green_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
55 + /* The power LED cannot be controlled the same way as for the Status LED */
57 + au_writel( 0x18000800, GPIO2_OUTPUT );
59 + au_writel( 0x18000000, GPIO2_OUTPUT);
63 +static void mtx1_red_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
65 + /* We store GPIO address (originally address - 200) in the "flags" field*/
66 + unsigned long pinmask = 1 << led_cdev->flags;
68 + au_writel((pinmask << 16) | pinmask, GPIO2_OUTPUT);
70 + au_writel((pinmask << 16) | 0, GPIO2_OUTPUT);
74 +static struct led_classdev mtx1_green_led = {
75 + .name = "mtx1:green",
76 + .brightness_set = mtx1_green_led_set,
79 +static struct led_classdev mtx1_red_led = {
82 + .brightness_set = mtx1_red_led_set,
83 + .default_trigger = "ide-disk",
86 +static int mtx1_leds_probe(struct platform_device *pdev)
90 + ret = led_classdev_register(&pdev->dev, &mtx1_green_led);
94 + ret = led_classdev_register(&pdev->dev, &mtx1_red_led);
96 + led_classdev_unregister(&mtx1_green_led);
102 +static int mtx1_leds_remove(struct platform_device *pdev)
104 + led_classdev_unregister(&mtx1_green_led);
105 + led_classdev_unregister(&mtx1_red_led);
109 +static struct platform_driver mtx1_leds_driver = {
110 + .probe = mtx1_leds_probe,
111 + .remove = mtx1_leds_remove,
113 + .name = "mtx1-leds",
117 +static int __init mtx1_leds_init(void)
121 + ret = platform_driver_register(&mtx1_leds_driver);
125 + pdev = platform_device_register_simple("mtx1-leds", -1, NULL, 0);
126 + if (IS_ERR(pdev)) {
127 + ret = PTR_ERR(pdev);
128 + platform_driver_unregister(&mtx1_leds_driver);
137 +static void __exit mtx1_leds_exit(void)
139 + platform_device_unregister(pdev);
140 + platform_driver_unregister(&mtx1_leds_driver);
143 +module_init(mtx1_leds_init);
144 +module_exit(mtx1_leds_exit);
146 +MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
147 +MODULE_DESCRIPTION("MTX-1 LED driver");
148 +MODULE_LICENSE("GPL");