strip the kernel version suffix from target directories, except for brcm-2.4 (the...
[15.05/openwrt.git] / target / linux / rdc / files / drivers / leds / leds-rdc3211.c
1 /*
2  * LED driver for RDC3211 boards
3  *
4  * Copyright 2007 Florian Fainelli <florian@openwrt.org>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/leds.h>
17 #include <linux/err.h>
18
19 #include <asm/gpio.h>
20
21 static void rdc321x_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
22 {
23         gpio_set_value(1, brightness ? 1 : 0);
24 }
25
26 /* The DMZ led is at GPIO line 1 */
27 static struct led_classdev rdc321x_dmz_led = {
28         .name = "rdc321x:dmz",
29         .brightness_set = rdc321x_led_set,
30 };
31
32 static int rdc321x_leds_probe(struct platform_device *pdev)
33 {
34         return led_classdev_register(&pdev->dev, &rdc321x_dmz_led);
35 }
36
37 static int rdc321x_leds_remove(struct platform_device *pdev)
38 {
39         led_classdev_unregister(&rdc321x_dmz_led);
40         return 0;
41 }
42
43 static struct platform_driver rdc321x_leds_driver = {
44         .probe = rdc321x_leds_probe,
45         .remove = rdc321x_leds_remove,
46         .driver = {
47                 .name = "rdc321x-leds",
48                 .owner = THIS_MODULE,
49         }
50 };
51
52 static int __init rdc321x_leds_init(void)
53 {
54         int ret;
55
56         ret = platform_driver_register(&rdc321x_leds_driver);
57
58         return ret;
59 }
60                 
61 static void __exit rdc321x_leds_exit(void)
62 {
63         platform_driver_unregister(&rdc321x_leds_driver);
64 }
65
66 module_init(rdc321x_leds_init);
67 module_exit(rdc321x_leds_exit);
68                 
69 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
70 MODULE_DESCRIPTION("RDC321x LED driver");
71 MODULE_LICENSE("GPL");