2 * USB LED driver for the NETGEAR WNDR3700
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
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.
11 #include <linux/leds.h>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
16 #include <asm/mach-ath79/ath79.h>
18 #define DRIVER_NAME "wndr3700-led-usb"
20 static void wndr3700_usb_led_set(struct led_classdev *cdev,
21 enum led_brightness brightness)
24 ath79_device_reset_clear(AR71XX_RESET_GE1_PHY);
26 ath79_device_reset_set(AR71XX_RESET_GE1_PHY);
29 static enum led_brightness wndr3700_usb_led_get(struct led_classdev *cdev)
31 return ath79_device_reset_get(AR71XX_RESET_GE1_PHY) ? LED_OFF : LED_FULL;
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,
40 static int __devinit wndr3700_usb_led_probe(struct platform_device *pdev)
42 return led_classdev_register(&pdev->dev, &wndr3700_usb_led);
45 static int __devexit wndr3700_usb_led_remove(struct platform_device *pdev)
47 led_classdev_unregister(&wndr3700_usb_led);
51 static struct platform_driver wndr3700_usb_led_driver = {
52 .probe = wndr3700_usb_led_probe,
53 .remove = __devexit_p(wndr3700_usb_led_remove),
60 static int __init wndr3700_usb_led_init(void)
62 return platform_driver_register(&wndr3700_usb_led_driver);
65 static void __exit wndr3700_usb_led_exit(void)
67 platform_driver_unregister(&wndr3700_usb_led_driver);
70 module_init(wndr3700_usb_led_init);
71 module_exit(wndr3700_usb_led_exit);
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);