| | 1 | --- a/arch/arm/mach-orion5x/wnr854t-setup.c |
| | 2 | +++ b/arch/arm/mach-orion5x/wnr854t-setup.c |
| | 3 | @@ -15,6 +15,9 @@ |
| | 4 | #include <linux/mtd/physmap.h> |
| | 5 | #include <linux/mv643xx_eth.h> |
| | 6 | #include <linux/ethtool.h> |
| | 7 | +#include <linux/leds.h> |
| | 8 | +#include <linux/gpio_keys.h> |
| | 9 | +#include <linux/input.h> |
| | 10 | #include <net/dsa.h> |
| | 11 | #include <asm/mach-types.h> |
| | 12 | #include <asm/gpio.h> |
| | 13 | @@ -24,6 +27,63 @@ |
| | 14 | #include "common.h" |
| | 15 | #include "mpp.h" |
| | 16 | |
| | 17 | +/* |
| | 18 | + * LEDs attached to GPIO |
| | 19 | + */ |
| | 20 | +static struct gpio_led wrt854t_led_pins[] = { |
| | 21 | + { |
| | 22 | + .name = "wnr854t:green:power", |
| | 23 | + .gpio = 0, |
| | 24 | + .active_low = 1, |
| | 25 | + }, { |
| | 26 | + .name = "wnr854t:blink:power", |
| | 27 | + .gpio = 2, |
| | 28 | + .active_low = 1, |
| | 29 | + }, |
| | 30 | +}; |
| | 31 | + |
| | 32 | +static struct gpio_led_platform_data wnr854t_led_data = { |
| | 33 | + .leds = wrt854t_led_pins, |
| | 34 | + .num_leds = ARRAY_SIZE(wrt854t_led_pins), |
| | 35 | +}; |
| | 36 | + |
| | 37 | +static struct platform_device wnr854t_leds = { |
| | 38 | + .name = "leds-gpio", |
| | 39 | + .id = -1, |
| | 40 | + .dev = { |
| | 41 | + .platform_data = &wnr854t_led_data, |
| | 42 | + }, |
| | 43 | +}; |
| | 44 | + |
| | 45 | +/* |
| | 46 | + * Buttons attached to GPIO |
| | 47 | + */ |
| | 48 | +static struct gpio_keys_button wnr854t_buttons[] = { |
| | 49 | + { |
| | 50 | + .code = KEY_RESTART, |
| | 51 | + .gpio = 1, |
| | 52 | + .desc = "Reset Button", |
| | 53 | + .active_low = 1, |
| | 54 | + }, |
| | 55 | +}; |
| | 56 | + |
| | 57 | +static struct gpio_keys_platform_data wnr854t_button_data = { |
| | 58 | + .buttons = wnr854t_buttons, |
| | 59 | + .nbuttons = ARRAY_SIZE(wnr854t_buttons), |
| | 60 | +}; |
| | 61 | + |
| | 62 | +static struct platform_device wnr854t_button_device = { |
| | 63 | + .name = "gpio-keys", |
| | 64 | + .id = -1, |
| | 65 | + .num_resources = 0, |
| | 66 | + .dev = { |
| | 67 | + .platform_data = &wnr854t_button_data, |
| | 68 | + }, |
| | 69 | +}; |
| | 70 | + |
| | 71 | +/* |
| | 72 | + * General setup |
| | 73 | + */ |
| | 74 | static struct orion5x_mpp_mode wnr854t_mpp_modes[] __initdata = { |
| | 75 | { 0, MPP_GPIO }, /* Power LED green (0=on) */ |
| | 76 | { 1, MPP_GPIO }, /* Reset Button (0=off) */ |
| | 77 | @@ -135,6 +195,8 @@ |
| | 78 | orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE, |
| | 79 | WNR854T_NOR_BOOT_SIZE); |
| | 80 | platform_device_register(&wnr854t_nor_flash); |
| | 81 | + platform_device_register(&wnr854t_leds); |
| | 82 | + platform_device_register(&wnr854t_button_device); |
| | 83 | } |
| | 84 | |
| | 85 | static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |