ar71xx: ag71xx: add BQL support
[openwrt.git] / target / linux / ar71xx / files / drivers / leds / leds-wndr3700-usb.c
1 /*
2 * USB LED driver for the NETGEAR WNDR3700
3 *
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #include <linux/leds.h>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
14
15 #include <asm/mach-ath79/ar71xx_regs.h>
16 #include <asm/mach-ath79/ath79.h>
17
18 #define DRIVER_NAME "wndr3700-led-usb"
19
20 static void wndr3700_usb_led_set(struct led_classdev *cdev,
21 enum led_brightness brightness)
22 {
23 if (brightness)
24 ath79_device_reset_clear(AR71XX_RESET_GE1_PHY);
25 else
26 ath79_device_reset_set(AR71XX_RESET_GE1_PHY);
27 }
28
29 static enum led_brightness wndr3700_usb_led_get(struct led_classdev *cdev)
30 {
31 return ath79_device_reset_get(AR71XX_RESET_GE1_PHY) ? LED_OFF : LED_FULL;
32 }
33
34 static struct led_classdev wndr3700_usb_led = {
35 .name = "wndr3700:green:usb",
36 .brightness_set = wndr3700_usb_led_set,
37 .brightness_get = wndr3700_usb_led_get,
38 };
39
40 static int __devinit wndr3700_usb_led_probe(struct platform_device *pdev)
41 {
42 return led_classdev_register(&pdev->dev, &wndr3700_usb_led);
43 }
44
45 static int __devexit wndr3700_usb_led_remove(struct platform_device *pdev)
46 {
47 led_classdev_unregister(&wndr3700_usb_led);
48 return 0;
49 }
50
51 static struct platform_driver wndr3700_usb_led_driver = {
52 .probe = wndr3700_usb_led_probe,
53 .remove = __devexit_p(wndr3700_usb_led_remove),
54 .driver = {
55 .name = DRIVER_NAME,
56 .owner = THIS_MODULE,
57 },
58 };
59
60 static int __init wndr3700_usb_led_init(void)
61 {
62 return platform_driver_register(&wndr3700_usb_led_driver);
63 }
64
65 static void __exit wndr3700_usb_led_exit(void)
66 {
67 platform_driver_unregister(&wndr3700_usb_led_driver);
68 }
69
70 module_init(wndr3700_usb_led_init);
71 module_exit(wndr3700_usb_led_exit);
72
73 MODULE_DESCRIPTION("USB LED driver for the NETGEAR WNDR3700");
74 MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
75 MODULE_LICENSE("GPL v2");
76 MODULE_ALIAS("platform:" DRIVER_NAME);
This page took 0.041326 seconds and 5 git commands to generate.