3ab530a7589f58faeb955b8dbeef700e8a3996ab
[openwrt/staging/florian.git] / target / linux / rb532 / files-2.6.24 / drivers / leds / leds-rb500.c
1 /*
2 * linux/drivers/leds/leds-rb500.c
3 *
4 * Copyright (C) 2006
5 * Twente Institute for Wireless and Mobile Communications BV
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details (see file GPLv2).
16 *
17 * Author: Tjalling Hattink <tjalling.hattink@ti-wmc.nl>
18 */
19
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/leds.h>
24 #include <asm/rc32434/rb.h>
25
26 static void rb500led_amber_set(struct led_classdev *led_cdev, enum led_brightness value)
27 {
28 if (value)
29 changeLatchU5(LO_ULED, 0);
30 else
31 changeLatchU5(0, LO_ULED);
32 }
33
34 static struct led_classdev rb500_amber_led = {
35 .name = "rb500led:amber",
36 .default_trigger = "ide-disk",
37 .brightness_set = rb500led_amber_set,
38 };
39
40 static int rb500led_probe(struct platform_device *pdev)
41 {
42 int ret;
43
44 changeLatchU5(0, LO_ULED);
45
46 ret = led_classdev_register(&pdev->dev, &rb500_amber_led);
47
48 return ret;
49 }
50
51 static int rb500led_remove(struct platform_device *pdev)
52 {
53 led_classdev_unregister(&rb500_amber_led);
54
55 return 0;
56 }
57
58 static struct platform_driver rb500led_driver = {
59 .probe = rb500led_probe,
60 .remove = rb500led_remove,
61 .driver = {
62 .name = "rb500-led",
63 },
64 };
65
66 static int __init rb500led_init(void)
67 {
68 return platform_driver_register(&rb500led_driver);
69 }
70
71 static void __exit rb500led_exit(void)
72 {
73 platform_driver_unregister(&rb500led_driver);
74 }
75
76 module_init(rb500led_init);
77 module_exit(rb500led_exit);
78
79 MODULE_AUTHOR("tjalling.hattink@ti-wmc.nl");
80 MODULE_DESCRIPTION("Mikrotik RB500 LED driver");
81 MODULE_LICENSE("GPL");