--- linux-2.6.22.14/drivers/leds/leds-rb400.c 1970-01-01 03:00:00.000000000 +0300 +++ linux/drivers/leds/leds-rb400.c 2008-01-21 13:42:46.000000000 +0200 @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +#define REG_GPIO_OUTPUT KSEG1ADDR(0x18040008) +#define GPIO_LIGHT 0x010 + +static void rb400_led_set_user(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + uint8_t gpo = rb400_readl(REG_GPIO_OUTPUT); + if (brightness) + gpo |= GPIO_LIGHT; + else + gpo &= ~GPIO_LIGHT; + rb400_writel(gpo, REG_GPIO_OUTPUT); +} + +static struct led_classdev rb400_led = { + .name = "user-led", + .brightness_set = rb400_led_set_user, +}; + +static int rb400_led_probe(struct platform_device *pdev) +{ + return led_classdev_register(&pdev->dev, &rb400_led); +} + +static struct platform_driver rb400_led_driver = { + .probe = rb400_led_probe, + .driver = { + .name = "rb400-led", + .owner = THIS_MODULE, + }, +}; + +static int __init rb400_led_init(void) +{ + return platform_driver_register(&rb400_led_driver); +} + +static void __exit rb400_led_exit(void) +{ + platform_driver_unregister(&rb400_led_driver); +} + +module_init(rb400_led_init); +module_exit(rb400_led_exit);