2 * LED driver for RDC3211 boards
4 * Copyright 2007 Florian Fainelli <florian@openwrt.org>
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.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/leds.h>
16 #include <linux/err.h>
20 #define LED_VAL 0x8000384C // the data ofset of gpio 0~30
22 static struct platform_device
*pdev
;
24 static void rdc3211_led_set(struct led_classdev
*led_cdev
, enum led_brightness brightness
)
26 unsigned long ul_ledstat
= 0xffffffff;
27 unsigned long led_bit
= 1 << (led_cdev
->flags
);
30 ul_ledstat
&= ~led_bit
;
35 outl(ul_ledstat
, 0xcfc);
38 static struct led_classdev rdc3211_power_led
= {
39 .name
= "rdc3211:power",
41 .brightness_set
= rdc3211_led_set
,
44 static struct led_classdev rdc3211_dmz_led
= {
45 .name
= "rdc3211:dmz",
47 .brightness_set
= rdc3211_led_set
,
50 static int rdc3211_leds_probe(struct platform_device
*pdev
)
54 ret
= led_classdev_register(&pdev
->dev
, &rdc3211_power_led
);
58 ret
= led_classdev_register(&pdev
->dev
, &rdc3211_dmz_led
);
60 led_classdev_unregister(&rdc3211_power_led
);
65 static int rdc3211_leds_remove(struct platform_device
*pdev
)
67 led_classdev_unregister(&rdc3211_power_led
);
68 led_classdev_unregister(&rdc3211_dmz_led
);
72 static struct platform_driver rdc3211_leds_driver
= {
73 .probe
= rdc3211_leds_probe
,
74 .remove
= rdc3211_leds_remove
,
76 .name
= "rdc3211-leds",
80 static int __init
rdc3211_leds_init(void)
84 ret
= platform_driver_register(&rdc3211_leds_driver
);
88 pdev
= platform_device_register_simple("rdc3211-leds", -1, NULL
, 0);
91 platform_driver_unregister(&rdc3211_leds_driver
);
99 static void __exit
rdc3211_leds_exit(void)
101 platform_driver_unregister(&rdc3211_leds_driver
);
104 module_init(rdc3211_leds_init
);
105 module_exit(rdc3211_leds_exit
);
107 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
108 MODULE_DESCRIPTION("RDC3211 LED driver");
109 MODULE_LICENSE("GPL");