aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--drivers/leds/Kconfig7
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-net48xx.c115
4 files changed, 128 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 196a31c97524..c55f690d4030 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2666,6 +2666,11 @@ M: shemminger@osdl.org
2666L: netdev@vger.kernel.org 2666L: netdev@vger.kernel.org
2667S: Maintained 2667S: Maintained
2668 2668
2669SOEKRIS NET48XX LED SUPPORT
2670P: Chris Boot
2671M: bootc@bootc.net
2672S: Maintained
2673
2669SPARC (sparc32): 2674SPARC (sparc32):
2670P: William L. Irwin 2675P: William L. Irwin
2671M: wli@holomorphy.com 2676M: wli@holomorphy.com
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 96509989e921..9c39b98d5a5b 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -69,6 +69,13 @@ config LEDS_AMS_DELTA
69 help 69 help
70 This option enables support for the LEDs on Amstrad Delta (E3). 70 This option enables support for the LEDs on Amstrad Delta (E3).
71 71
72config LEDS_NET48XX
73 tristate "LED Support for Soekris net48xx series Error LED"
74 depends on LEDS_CLASS && SCx200_GPIO
75 help
76 This option enables support for the Soekris net4801 and net4826 error
77 LED.
78
72comment "LED Triggers" 79comment "LED Triggers"
73 80
74config LEDS_TRIGGERS 81config LEDS_TRIGGERS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 88d3b6eaa6a2..6aa2aed7539d 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o
12obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o 12obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o
13obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o 13obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
14obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o 14obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
15obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
15 16
16# LED Triggers 17# LED Triggers
17obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o 18obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
diff --git a/drivers/leds/leds-net48xx.c b/drivers/leds/leds-net48xx.c
new file mode 100644
index 000000000000..35ee52f9b79e
--- /dev/null
+++ b/drivers/leds/leds-net48xx.c
@@ -0,0 +1,115 @@
1/*
2 * LEDs driver for Soekris net48xx
3 *
4 * Copyright (C) 2006 Chris Boot <bootc@bootc.net>
5 *
6 * Based on leds-ams-delta.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/leds.h>
17#include <linux/err.h>
18#include <asm/io.h>
19#include <linux/scx200_gpio.h>
20
21#define NET48XX_ERROR_LED_GPIO 20
22
23static struct platform_device *pdev;
24
25static void net48xx_error_led_set(struct led_classdev *led_cdev,
26 enum led_brightness value)
27{
28 if (value)
29 scx200_gpio_set_high(NET48XX_ERROR_LED_GPIO);
30 else
31 scx200_gpio_set_low(NET48XX_ERROR_LED_GPIO);
32}
33
34static struct led_classdev net48xx_error_led = {
35 .name = "net48xx:error",
36 .brightness_set = net48xx_error_led_set,
37};
38
39#ifdef CONFIG_PM
40static int net48xx_led_suspend(struct platform_device *dev,
41 pm_message_t state)
42{
43 led_classdev_suspend(&net48xx_error_led);
44 return 0;
45}
46
47static int net48xx_led_resume(struct platform_device *dev)
48{
49 led_classdev_resume(&net48xx_error_led);
50 return 0;
51}
52#else
53#define net48xx_led_suspend NULL
54#define net48xx_led_resume NULL
55#endif
56
57static int net48xx_led_probe(struct platform_device *pdev)
58{
59 return led_classdev_register(&pdev->dev, &net48xx_error_led);
60}
61
62static int net48xx_led_remove(struct platform_device *pdev)
63{
64 led_classdev_unregister(&net48xx_error_led);
65 return 0;
66}
67
68static struct platform_driver net48xx_led_driver = {
69 .driver.owner = THIS_MODULE,
70 .probe = net48xx_led_probe,
71 .remove = net48xx_led_remove,
72 .suspend = net48xx_led_suspend,
73 .resume = net48xx_led_resume,
74 .driver = {
75 .name = "net48xx-led",
76 },
77};
78
79static int __init net48xx_led_init(void)
80{
81 int ret;
82
83 if (!scx200_gpio_present()) {
84 ret = -ENODEV;
85 goto out;
86 }
87
88 ret = platform_driver_register(&net48xx_led_driver);
89 if (ret < 0)
90 goto out;
91
92 pdev = platform_device_register_simple("net48xx-led", -1, NULL, 0);
93 if (IS_ERR(pdev)) {
94 ret = PTR_ERR(pdev);
95 platform_driver_unregister(&net48xx_led_driver);
96 goto out;
97 }
98
99out:
100 return ret;
101}
102
103static void __exit net48xx_led_exit(void)
104{
105 platform_device_unregister(pdev);
106 platform_driver_unregister(&net48xx_led_driver);
107}
108
109module_init(net48xx_led_init);
110module_exit(net48xx_led_exit);
111
112MODULE_AUTHOR("Chris Boot <bootc@bootc.net>");
113MODULE_DESCRIPTION("Soekris net48xx LED driver");
114MODULE_LICENSE("GPL");
115