diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-12-11 20:32:31 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-12-11 20:32:31 +0000 |
commit | 4734a69891c08771cd4a0f5f8d343d6c59da1084 (patch) | |
tree | 87abbaa36e2c6576a09304edcf2e00adc13901dc | |
parent | de8bfcaf383ec6f884e8f9e6953abdd449787607 (diff) | |
download | mtk-20170518-4734a69891c08771cd4a0f5f8d343d6c59da1084.zip mtk-20170518-4734a69891c08771cd4a0f5f8d343d6c59da1084.tar.gz mtk-20170518-4734a69891c08771cd4a0f5f8d343d6c59da1084.tar.bz2 |
ar71xx: add driver for the USB LED on the WNDR3700
SVN-Revision: 18758
8 files changed, 157 insertions, 0 deletions
diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 9b7e5fe..66b1b8f 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -113,6 +113,7 @@ CONFIG_INITRAMFS_SOURCE="../../root" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set # CONFIG_LEDS_GPIO is not set +# CONFIG_LEDS_WNDR3700_USB is not set # CONFIG_LEMOTE_FULONG is not set # CONFIG_M25PXX_USE_FAST_READ is not set # CONFIG_MACH_ALCHEMY is not set diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index a975cd7..b699e4b 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -116,6 +116,7 @@ CONFIG_INITRAMFS_SOURCE="../../root" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set # CONFIG_LEDS_GPIO is not set +# CONFIG_LEDS_WNDR3700_USB is not set # CONFIG_LEMOTE_FULONG is not set # CONFIG_M25PXX_USE_FAST_READ is not set CONFIG_MAC80211_DEFAULT_PS_VALUE=0 diff --git a/target/linux/ar71xx/config-2.6.32 b/target/linux/ar71xx/config-2.6.32 index 671002f..cedfa8e 100644 --- a/target/linux/ar71xx/config-2.6.32 +++ b/target/linux/ar71xx/config-2.6.32 @@ -118,6 +118,7 @@ CONFIG_INITRAMFS_SOURCE="../../root" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set # CONFIG_LEDS_GPIO is not set +# CONFIG_LEDS_WNDR3700_USB is not set # CONFIG_M25PXX_USE_FAST_READ is not set # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 25b5fc0..729267a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -325,6 +325,7 @@ static void __init wndr3700_setup(void) wndr3700_gpio_buttons); platform_device_register(&wndr3700_rtl8366_smi_device); + platform_device_register_simple("wndr3700-led-usb", -1, NULL, 0); wndr3700_pci_init(); } diff --git a/target/linux/ar71xx/files/drivers/leds/leds-wndr3700-usb.c b/target/linux/ar71xx/files/drivers/leds/leds-wndr3700-usb.c new file mode 100644 index 0000000..9f17861 --- /dev/null +++ b/target/linux/ar71xx/files/drivers/leds/leds-wndr3700-usb.c @@ -0,0 +1,75 @@ +/* + * USB LED driver for the NETGEAR WNDR3700 + * + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/platform_device.h> + +#include <asm/mach-ar71xx/ar71xx.h> + +#define DRIVER_NAME "wndr3700-led-usb" + +static void wndr3700_usb_led_set(struct led_classdev *cdev, + enum led_brightness brightness) +{ + if (brightness) + ar71xx_device_start(RESET_MODULE_GE1_PHY); + else + ar71xx_device_stop(RESET_MODULE_GE1_PHY); +} + +static enum led_brightness wndr3700_usb_led_get(struct led_classdev *cdev) +{ + return ar71xx_device_stopped(RESET_MODULE_GE1_PHY) ? LED_OFF : LED_FULL; +} + +static struct led_classdev wndr3700_usb_led = { + .name = "wndr3700:green:usb", + .brightness_set = wndr3700_usb_led_set, + .brightness_get = wndr3700_usb_led_get, +}; + +static int __devinit wndr3700_usb_led_probe(struct platform_device *pdev) +{ + return led_classdev_register(&pdev->dev, &wndr3700_usb_led); +} + +static int __devexit wndr3700_usb_led_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&wndr3700_usb_led); + return 0; +} + +static struct platform_driver wndr3700_usb_led_driver = { + .probe = wndr3700_usb_led_probe, + .remove = __devexit_p(wndr3700_usb_led_remove), + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, +}; + +static int __init wndr3700_usb_led_init(void) +{ + return platform_driver_register(&wndr3700_usb_led_driver); +} + +static void __exit wndr3700_usb_led_exit(void) +{ + platform_driver_unregister(&wndr3700_usb_led_driver); +} + +module_init(wndr3700_usb_led_init); +module_exit(wndr3700_usb_led_exit); + +MODULE_DESCRIPTION("USB LED driver for the NETGEAR WNDR3700"); +MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/target/linux/ar71xx/patches-2.6.30/205-wndr3700-usb-led-driver.patch b/target/linux/ar71xx/patches-2.6.30/205-wndr3700-usb-led-driver.patch new file mode 100644 index 0000000..53ece92 --- /dev/null +++ b/target/linux/ar71xx/patches-2.6.30/205-wndr3700-usb-led-driver.patch @@ -0,0 +1,26 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -227,6 +227,13 @@ + This option enables support for BD2802GU RGB LED driver chips + accessed via the I2C bus. + ++config LEDS_WNDR3700_USB ++ tristate "NETGEAR WNDR3700 USB LED driver" ++ depends on LEDS_CLASS && AR71XX_MACH_WNDR3700 ++ help ++ This option enables support for the USB LED found on the ++ NETGEAR WNDR3700 board. ++ + comment "LED Triggers" + + config LEDS_TRIGGERS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -27,6 +27,7 @@ + obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o + obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o ++obj-${CONFIG_LEDS_WNDR3700_USB} += leds-wndr3700-usb.o + + # LED SPI Drivers + obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/target/linux/ar71xx/patches-2.6.31/205-wndr3700-usb-led-driver.patch b/target/linux/ar71xx/patches-2.6.31/205-wndr3700-usb-led-driver.patch new file mode 100644 index 0000000..d9fba35 --- /dev/null +++ b/target/linux/ar71xx/patches-2.6.31/205-wndr3700-usb-led-driver.patch @@ -0,0 +1,26 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -229,6 +229,13 @@ config LEDS_BD2802 + This option enables support for BD2802GU RGB LED driver chips + accessed via the I2C bus. + ++config LEDS_WNDR3700_USB ++ tristate "NETGEAR WNDR3700 USB LED driver" ++ depends on LEDS_CLASS && AR71XX_MACH_WNDR3700 ++ help ++ This option enables support for the USB LED found on the ++ NETGEAR WNDR3700 board. ++ + comment "LED Triggers" + + config LEDS_TRIGGERS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_LEDS_PCA955X) += leds-pca9 + obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o + obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o ++obj-${CONFIG_LEDS_WNDR3700_USB} += leds-wndr3700-usb.o + + # LED SPI Drivers + obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/target/linux/ar71xx/patches-2.6.32/205-wndr3700-usb-led-driver.patch b/target/linux/ar71xx/patches-2.6.32/205-wndr3700-usb-led-driver.patch new file mode 100644 index 0000000..3f7c848 --- /dev/null +++ b/target/linux/ar71xx/patches-2.6.32/205-wndr3700-usb-led-driver.patch @@ -0,0 +1,26 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -236,6 +236,13 @@ config LEDS_BD2802 + This option enables support for BD2802GU RGB LED driver chips + accessed via the I2C bus. + ++config LEDS_WNDR3700_USB ++ tristate "NETGEAR WNDR3700 USB LED driver" ++ depends on LEDS_CLASS && AR71XX_MACH_WNDR3700 ++ help ++ This option enables support for the USB LED found on the ++ NETGEAR WNDR3700 board. ++ + comment "LED Triggers" + + config LEDS_TRIGGERS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -29,6 +29,7 @@ obj-$(CONFIG_LEDS_DA903X) += leds-da903 + obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o + obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o ++obj-${CONFIG_LEDS_WNDR3700_USB} += leds-wndr3700-usb.o + + # LED SPI Drivers + obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o |