2 * ADM5120 LED (GPIO) driver
4 * Copyright (C) Jeroen Vreeken (pe1rxq@amsat.org), 2005
5 * Copyright (C) OpenWrt.org, Florian Fainelli <florian@openwrt.org>, 2007
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * 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>
17 #define GPIO_IO ((unsigned long *)0xb20000b8)
19 static void adm5120_led_set(struct led_classdev
*led_cdev
, enum led_brightness brightness
)
22 *GPIO_IO
=(*GPIO_IO
& 0x00ffffff) | (brightness
<< 24);
24 *GPIO_IO
=(*GPIO_IO
& 0x00ffffff) | (0 << 24);
27 static struct led_classdev adm5120_gpio_led
= {
28 .name
= "adm5120:led",
29 .brightness_set
= adm5120_led_set
,
32 static int __init
adm5120_led_init(void)
34 int ret
= led_classdev_register(NULL
, &adm5120_gpio_led
);
37 printk(KERN_WARNING
"adm5120: unable to register LED device\n");
42 static void __exit
adm5120_led_exit(void)
44 led_classdev_unregister(&adm5120_gpio_led
);
47 module_init(adm5120_led_init
);
48 module_exit(adm5120_led_exit
);
50 MODULE_DESCRIPTION("ADM5120 LED driver");
51 MODULE_AUTHOR("Jeroen Vreeken, OpenWrt.org");
52 MODULE_LICENSE("GPL");