x86/amd-iommu: Add per IOMMU reference counting
[linux/fpc-iii.git] / drivers / leds / leds-rb532.c
blobc3525f37f73d6895c5abfd619af06c7164cf119f
1 /*
2 * LEDs driver for the "User LED" on Routerboard532
4 * Copyright (C) 2009 Phil Sutter <n0-1@freewrt.org>
6 * Based on leds-cobalt-qube.c by Florian Fainelly and
7 * rb-diag.c (my own standalone driver for both LED and
8 * button of Routerboard532).
9 */
11 #include <linux/leds.h>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
15 #include <asm/mach-rc32434/gpio.h>
16 #include <asm/mach-rc32434/rb.h>
18 static void rb532_led_set(struct led_classdev *cdev,
19 enum led_brightness brightness)
21 if (brightness)
22 set_latch_u5(LO_ULED, 0);
24 else
25 set_latch_u5(0, LO_ULED);
28 static enum led_brightness rb532_led_get(struct led_classdev *cdev)
30 return (get_latch_u5() & LO_ULED) ? LED_FULL : LED_OFF;
33 static struct led_classdev rb532_uled = {
34 .name = "uled",
35 .brightness_set = rb532_led_set,
36 .brightness_get = rb532_led_get,
37 .default_trigger = "nand-disk",
40 static int __devinit rb532_led_probe(struct platform_device *pdev)
42 return led_classdev_register(&pdev->dev, &rb532_uled);
45 static int __devexit rb532_led_remove(struct platform_device *pdev)
47 led_classdev_unregister(&rb532_uled);
48 return 0;
51 static struct platform_driver rb532_led_driver = {
52 .probe = rb532_led_probe,
53 .remove = __devexit_p(rb532_led_remove),
54 .driver = {
55 .name = "rb532-led",
56 .owner = THIS_MODULE,
60 static int __init rb532_led_init(void)
62 return platform_driver_register(&rb532_led_driver);
65 static void __exit rb532_led_exit(void)
67 platform_driver_unregister(&rb532_led_driver);
70 module_init(rb532_led_init);
71 module_exit(rb532_led_exit);
73 MODULE_ALIAS("platform:rb532-led");
75 MODULE_LICENSE("GPL");
76 MODULE_DESCRIPTION("User LED support for Routerboard532");
77 MODULE_AUTHOR("Phil Sutter <n0-1@freewrt.org>");