diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/leds/Kconfig | 7 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-rb532.c | 77 |
3 files changed, 85 insertions, 0 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 89ea7ef39fe4..db5e6a64c7cf 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -31,6 +31,13 @@ config LEDS_LOCOMO | |||
31 | This option enables support for the LEDs on Sharp Locomo. | 31 | This option enables support for the LEDs on Sharp Locomo. |
32 | Zaurus models SL-5500 and SL-5600. | 32 | Zaurus models SL-5500 and SL-5600. |
33 | 33 | ||
34 | config LEDS_MIKROTIK_RB532 | ||
35 | tristate "LED Support for Mikrotik Routerboard 532" | ||
36 | depends on LEDS_CLASS && MIKROTIK_RB532 | ||
37 | help | ||
38 | This option enables support for the so called "User LED" of | ||
39 | Mikrotik's Routerboard 532. | ||
40 | |||
34 | config LEDS_S3C24XX | 41 | config LEDS_S3C24XX |
35 | tristate "LED Support for Samsung S3C24XX GPIO LEDs" | 42 | tristate "LED Support for Samsung S3C24XX GPIO LEDs" |
36 | depends on LEDS_CLASS && ARCH_S3C2410 | 43 | depends on LEDS_CLASS && ARCH_S3C2410 |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 584a3f6c2530..017f69aa2ecd 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o | |||
7 | # LED Platform Drivers | 7 | # LED Platform Drivers |
8 | obj-$(CONFIG_LEDS_ATMEL_PWM) += leds-atmel-pwm.o | 8 | obj-$(CONFIG_LEDS_ATMEL_PWM) += leds-atmel-pwm.o |
9 | obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o | 9 | obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o |
10 | obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o | ||
10 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o | 11 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o |
11 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o | 12 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o |
12 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o | 13 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o |
diff --git a/drivers/leds/leds-rb532.c b/drivers/leds/leds-rb532.c new file mode 100644 index 000000000000..c3525f37f73d --- /dev/null +++ b/drivers/leds/leds-rb532.c | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * LEDs driver for the "User LED" on Routerboard532 | ||
3 | * | ||
4 | * Copyright (C) 2009 Phil Sutter <n0-1@freewrt.org> | ||
5 | * | ||
6 | * Based on leds-cobalt-qube.c by Florian Fainelly and | ||
7 | * rb-diag.c (my own standalone driver for both LED and | ||
8 | * button of Routerboard532). | ||
9 | */ | ||
10 | |||
11 | #include <linux/leds.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | |||
15 | #include <asm/mach-rc32434/gpio.h> | ||
16 | #include <asm/mach-rc32434/rb.h> | ||
17 | |||
18 | static void rb532_led_set(struct led_classdev *cdev, | ||
19 | enum led_brightness brightness) | ||
20 | { | ||
21 | if (brightness) | ||
22 | set_latch_u5(LO_ULED, 0); | ||
23 | |||
24 | else | ||
25 | set_latch_u5(0, LO_ULED); | ||
26 | } | ||
27 | |||
28 | static enum led_brightness rb532_led_get(struct led_classdev *cdev) | ||
29 | { | ||
30 | return (get_latch_u5() & LO_ULED) ? LED_FULL : LED_OFF; | ||
31 | } | ||
32 | |||
33 | static struct led_classdev rb532_uled = { | ||
34 | .name = "uled", | ||
35 | .brightness_set = rb532_led_set, | ||
36 | .brightness_get = rb532_led_get, | ||
37 | .default_trigger = "nand-disk", | ||
38 | }; | ||
39 | |||
40 | static int __devinit rb532_led_probe(struct platform_device *pdev) | ||
41 | { | ||
42 | return led_classdev_register(&pdev->dev, &rb532_uled); | ||
43 | } | ||
44 | |||
45 | static int __devexit rb532_led_remove(struct platform_device *pdev) | ||
46 | { | ||
47 | led_classdev_unregister(&rb532_uled); | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static struct platform_driver rb532_led_driver = { | ||
52 | .probe = rb532_led_probe, | ||
53 | .remove = __devexit_p(rb532_led_remove), | ||
54 | .driver = { | ||
55 | .name = "rb532-led", | ||
56 | .owner = THIS_MODULE, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static int __init rb532_led_init(void) | ||
61 | { | ||
62 | return platform_driver_register(&rb532_led_driver); | ||
63 | } | ||
64 | |||
65 | static void __exit rb532_led_exit(void) | ||
66 | { | ||
67 | platform_driver_unregister(&rb532_led_driver); | ||
68 | } | ||
69 | |||
70 | module_init(rb532_led_init); | ||
71 | module_exit(rb532_led_exit); | ||
72 | |||
73 | MODULE_ALIAS("platform:rb532-led"); | ||
74 | |||
75 | MODULE_LICENSE("GPL"); | ||
76 | MODULE_DESCRIPTION("User LED support for Routerboard532"); | ||
77 | MODULE_AUTHOR("Phil Sutter <n0-1@freewrt.org>"); | ||