diff options
author | Paul Mackerras <paulus@samba.org> | 2006-07-31 20:37:25 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-31 20:37:25 -0400 |
commit | 57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch) | |
tree | e9c790afb4286f78cb08d9664f58baa7e876fe55 /drivers/leds | |
parent | cb18bd40030c879cd93fef02fd579f74dbab473d (diff) | |
parent | 49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff) |
Merge branch 'merge'
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/Kconfig | 7 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-net48xx.c | 116 |
3 files changed, 124 insertions, 0 deletions
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 | ||
72 | config 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 | |||
72 | comment "LED Triggers" | 79 | comment "LED Triggers" |
73 | 80 | ||
74 | config LEDS_TRIGGERS | 81 | config 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 | |||
12 | obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o | 12 | obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o |
13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o | 13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o |
14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o | 14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o |
15 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o | ||
15 | 16 | ||
16 | # LED Triggers | 17 | # LED Triggers |
17 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 18 | obj-$(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..713c4a8aa77d --- /dev/null +++ b/drivers/leds/leds-net48xx.c | |||
@@ -0,0 +1,116 @@ | |||
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 DRVNAME "net48xx-led" | ||
22 | #define NET48XX_ERROR_LED_GPIO 20 | ||
23 | |||
24 | static struct platform_device *pdev; | ||
25 | |||
26 | static void net48xx_error_led_set(struct led_classdev *led_cdev, | ||
27 | enum led_brightness value) | ||
28 | { | ||
29 | if (value) | ||
30 | scx200_gpio_set_high(NET48XX_ERROR_LED_GPIO); | ||
31 | else | ||
32 | scx200_gpio_set_low(NET48XX_ERROR_LED_GPIO); | ||
33 | } | ||
34 | |||
35 | static struct led_classdev net48xx_error_led = { | ||
36 | .name = "net48xx:error", | ||
37 | .brightness_set = net48xx_error_led_set, | ||
38 | }; | ||
39 | |||
40 | #ifdef CONFIG_PM | ||
41 | static int net48xx_led_suspend(struct platform_device *dev, | ||
42 | pm_message_t state) | ||
43 | { | ||
44 | led_classdev_suspend(&net48xx_error_led); | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static int net48xx_led_resume(struct platform_device *dev) | ||
49 | { | ||
50 | led_classdev_resume(&net48xx_error_led); | ||
51 | return 0; | ||
52 | } | ||
53 | #else | ||
54 | #define net48xx_led_suspend NULL | ||
55 | #define net48xx_led_resume NULL | ||
56 | #endif | ||
57 | |||
58 | static int net48xx_led_probe(struct platform_device *pdev) | ||
59 | { | ||
60 | return led_classdev_register(&pdev->dev, &net48xx_error_led); | ||
61 | } | ||
62 | |||
63 | static int net48xx_led_remove(struct platform_device *pdev) | ||
64 | { | ||
65 | led_classdev_unregister(&net48xx_error_led); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static struct platform_driver net48xx_led_driver = { | ||
70 | .probe = net48xx_led_probe, | ||
71 | .remove = net48xx_led_remove, | ||
72 | .suspend = net48xx_led_suspend, | ||
73 | .resume = net48xx_led_resume, | ||
74 | .driver = { | ||
75 | .name = DRVNAME, | ||
76 | .owner = THIS_MODULE, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static int __init net48xx_led_init(void) | ||
81 | { | ||
82 | int ret; | ||
83 | |||
84 | if (!scx200_gpio_present()) { | ||
85 | ret = -ENODEV; | ||
86 | goto out; | ||
87 | } | ||
88 | |||
89 | ret = platform_driver_register(&net48xx_led_driver); | ||
90 | if (ret < 0) | ||
91 | goto out; | ||
92 | |||
93 | pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | ||
94 | if (IS_ERR(pdev)) { | ||
95 | ret = PTR_ERR(pdev); | ||
96 | platform_driver_unregister(&net48xx_led_driver); | ||
97 | goto out; | ||
98 | } | ||
99 | |||
100 | out: | ||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | static void __exit net48xx_led_exit(void) | ||
105 | { | ||
106 | platform_device_unregister(pdev); | ||
107 | platform_driver_unregister(&net48xx_led_driver); | ||
108 | } | ||
109 | |||
110 | module_init(net48xx_led_init); | ||
111 | module_exit(net48xx_led_exit); | ||
112 | |||
113 | MODULE_AUTHOR("Chris Boot <bootc@bootc.net>"); | ||
114 | MODULE_DESCRIPTION("Soekris net48xx LED driver"); | ||
115 | MODULE_LICENSE("GPL"); | ||
116 | |||