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-ar71xx/ar71xx.h>
17 #define DRIVER_NAME "wndr3700-led-usb"
19 static void wndr3700_usb_led_set(struct led_classdev
*cdev
,
20 enum led_brightness brightness
)
23 ar71xx_device_start(RESET_MODULE_GE1_PHY
);
25 ar71xx_device_stop(RESET_MODULE_GE1_PHY
);
28 static enum led_brightness
wndr3700_usb_led_get(struct led_classdev
*cdev
)
30 return ar71xx_device_stopped(RESET_MODULE_GE1_PHY
) ? LED_OFF
: LED_FULL
;
33 static struct led_classdev wndr3700_usb_led
= {
34 .name
= "wndr3700:green:usb",
35 .brightness_set
= wndr3700_usb_led_set
,
36 .brightness_get
= wndr3700_usb_led_get
,
39 static int __devinit
wndr3700_usb_led_probe(struct platform_device
*pdev
)
41 return led_classdev_register(&pdev
->dev
, &wndr3700_usb_led
);
44 static int __devexit
wndr3700_usb_led_remove(struct platform_device
*pdev
)
46 led_classdev_unregister(&wndr3700_usb_led
);
50 static struct platform_driver wndr3700_usb_led_driver
= {
51 .probe
= wndr3700_usb_led_probe
,
52 .remove
= __devexit_p(wndr3700_usb_led_remove
),
59 static int __init
wndr3700_usb_led_init(void)
61 return platform_driver_register(&wndr3700_usb_led_driver
);
64 static void __exit
wndr3700_usb_led_exit(void)
66 platform_driver_unregister(&wndr3700_usb_led_driver
);
69 module_init(wndr3700_usb_led_init
);
70 module_exit(wndr3700_usb_led_exit
);
72 MODULE_DESCRIPTION("USB LED driver for the NETGEAR WNDR3700");
73 MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
74 MODULE_LICENSE("GPL v2");
75 MODULE_ALIAS("platform:" DRIVER_NAME
);