aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/au1000-2.6
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2007-05-20 20:09:52 +0000
committerFlorian Fainelli <florian@openwrt.org>2007-05-20 20:09:52 +0000
commitdb534b4c0f16b36f4980d2a73eff1521b657ee17 (patch)
treefabd9b976f3ed311137607e9f999346982009e0b /target/linux/au1000-2.6
parentbc09d89f16878c82a6ca7d318b85619c616dd956 (diff)
downloadupstream-db534b4c0f16b36f4980d2a73eff1521b657ee17.tar.gz
upstream-db534b4c0f16b36f4980d2a73eff1521b657ee17.tar.bz2
upstream-db534b4c0f16b36f4980d2a73eff1521b657ee17.zip
Split the led driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7290 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/au1000-2.6')
-rw-r--r--target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c116
-rw-r--r--target/linux/au1000-2.6/patches/011-mtx1_leds.patch120
2 files changed, 116 insertions, 120 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
new file mode 100644
index 0000000000..86615f46b4
--- /dev/null
+++ b/target/linux/au1000-2.6/files/drivers/leds/leds-mtx1.c
@@ -0,0 +1,116 @@
+/*
+ * LED driver for MTX-1 boards
+ *
+ * Copyright 2007 Florian Fainelli <florian@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/err.h>
+#include <asm/mach-au1x00/au1000.h>
+
+static struct platform_device *pdev;
+
+static void mtx1_green_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);
+ }
+}
+
+static struct led_classdev mtx1_green_led = {
+ .name = "mtx1:green",
+ .brightness_set = mtx1_green_led_set,
+};
+
+static struct led_classdev mtx1_red_led = {
+ .name = "mtx1:red",
+ .flags = 12,
+ .brightness_set = mtx1_red_led_set,
+ .default_trigger = "ide-disk",
+};
+
+static int mtx1_leds_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ ret = led_classdev_register(&pdev->dev, &mtx1_green_led);
+ if (ret < 0)
+ goto out;
+
+ ret = led_classdev_register(&pdev->dev, &mtx1_red_led);
+ if (ret < 0)
+ led_classdev_unregister(&mtx1_green_led);
+
+out:
+ return ret;
+}
+
+static int mtx1_leds_remove(struct platform_device *pdev)
+{
+ led_classdev_unregister(&mtx1_green_led);
+ led_classdev_unregister(&mtx1_red_led);
+ return 0;
+}
+
+static struct platform_driver mtx1_leds_driver = {
+ .probe = mtx1_leds_probe,
+ .remove = mtx1_leds_remove,
+ .driver = {
+ .name = "mtx1-leds",
+ }
+};
+
+static int __init mtx1_leds_init(void)
+{
+ int ret;
+
+ ret = platform_driver_register(&mtx1_leds_driver);
+ if (ret < 0)
+ goto out;
+
+ pdev = platform_device_register_simple("mtx1-leds", -1, NULL, 0);
+ if (IS_ERR(pdev)) {
+ ret = PTR_ERR(pdev);
+ platform_driver_unregister(&mtx1_leds_driver);
+ goto out;
+ }
+
+out:
+ return ret;
+
+}
+
+static void __exit mtx1_leds_exit(void)
+{
+ platform_device_unregister(pdev);
+ platform_driver_unregister(&mtx1_leds_driver);
+}
+
+module_init(mtx1_leds_init);
+module_exit(mtx1_leds_exit);
+
+MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
+MODULE_DESCRIPTION("MTX-1 LED driver");
+MODULE_LICENSE("GPL");
diff --git a/target/linux/au1000-2.6/patches/011-mtx1_leds.patch b/target/linux/au1000-2.6/patches/011-mtx1_leds.patch
index 350c531fbe..a99377f815 100644
--- a/target/linux/au1000-2.6/patches/011-mtx1_leds.patch
+++ b/target/linux/au1000-2.6/patches/011-mtx1_leds.patch
@@ -26,123 +26,3 @@ diff -urN linux-2.6.19.2/drivers/leds/Makefile linux-2.6.19.2.new/drivers/leds/M
# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
-diff -urN linux-2.6.19.2/drivers/leds/leds-mtx1.c linux-2.6.19.2.new/drivers/leds/leds-mtx1.c
---- linux-2.6.19.2/drivers/leds/leds-mtx1.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.19.2.new/drivers/leds/leds-mtx1.c 2007-03-02 13:49:08.000000000 +0100
-@@ -0,0 +1,116 @@
-+/*
-+ * LED driver for MTX-1 boards
-+ *
-+ * Copyright 2007 Florian Fainelli <florian@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/leds.h>
-+#include <linux/err.h>
-+#include <asm/mach-au1x00/au1000.h>
-+
-+static struct platform_device *pdev;
-+
-+static void mtx1_green_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);
-+ }
-+}
-+
-+static struct led_classdev mtx1_green_led = {
-+ .name = "mtx1:green",
-+ .brightness_set = mtx1_green_led_set,
-+};
-+
-+static struct led_classdev mtx1_red_led = {
-+ .name = "mtx1:red",
-+ .flags = 12,
-+ .brightness_set = mtx1_red_led_set,
-+ .default_trigger = "ide-disk",
-+};
-+
-+static int mtx1_leds_probe(struct platform_device *pdev)
-+{
-+ int ret;
-+
-+ ret = led_classdev_register(&pdev->dev, &mtx1_green_led);
-+ if (ret < 0)
-+ goto out;
-+
-+ ret = led_classdev_register(&pdev->dev, &mtx1_red_led);
-+ if (ret < 0)
-+ led_classdev_unregister(&mtx1_green_led);
-+
-+out:
-+ return ret;
-+}
-+
-+static int mtx1_leds_remove(struct platform_device *pdev)
-+{
-+ led_classdev_unregister(&mtx1_green_led);
-+ led_classdev_unregister(&mtx1_red_led);
-+ return 0;
-+}
-+
-+static struct platform_driver mtx1_leds_driver = {
-+ .probe = mtx1_leds_probe,
-+ .remove = mtx1_leds_remove,
-+ .driver = {
-+ .name = "mtx1-leds",
-+ }
-+};
-+
-+static int __init mtx1_leds_init(void)
-+{
-+ int ret;
-+
-+ ret = platform_driver_register(&mtx1_leds_driver);
-+ if (ret < 0)
-+ goto out;
-+
-+ pdev = platform_device_register_simple("mtx1-leds", -1, NULL, 0);
-+ if (IS_ERR(pdev)) {
-+ ret = PTR_ERR(pdev);
-+ platform_driver_unregister(&mtx1_leds_driver);
-+ goto out;
-+ }
-+
-+out:
-+ return ret;
-+
-+}
-+
-+static void __exit mtx1_leds_exit(void)
-+{
-+ platform_device_unregister(pdev);
-+ platform_driver_unregister(&mtx1_leds_driver);
-+}
-+
-+module_init(mtx1_leds_init);
-+module_exit(mtx1_leds_exit);
-+
-+MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-+MODULE_DESCRIPTION("MTX-1 LED driver");
-+MODULE_LICENSE("GPL");