generic: rename ip175c driver to ip17xx on 2.6.35 as well
[openwrt.git] / target / linux / orion / patches-2.6.32 / 090-wrt350nv2_gpio_leds_buttons.patch
1 --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
2 +++ b/arch/arm/mach-orion5x/wrt350n-v2-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,80 @@
14 #include "common.h"
15 #include "mpp.h"
16
17 +/*
18 + * LEDs attached to GPIO
19 + */
20 +static struct gpio_led wrt350n_v2_led_pins[] = {
21 + {
22 + .name = "wrt350nv2:green:power",
23 + .gpio = 0,
24 + .active_low = 1,
25 + }, {
26 + .name = "wrt350nv2:green:security",
27 + .gpio = 1,
28 + .active_low = 1,
29 + }, {
30 + .name = "wrt350nv2:orange:power",
31 + .gpio = 5,
32 + .active_low = 1,
33 + }, {
34 + .name = "wrt350nv2:green:usb",
35 + .gpio = 6,
36 + .active_low = 1,
37 + }, {
38 + .name = "wrt350nv2:green:wireless",
39 + .gpio = 7,
40 + .active_low = 1,
41 + },
42 +};
43 +
44 +static struct gpio_led_platform_data wrt350n_v2_led_data = {
45 + .leds = wrt350n_v2_led_pins,
46 + .num_leds = ARRAY_SIZE(wrt350n_v2_led_pins),
47 +};
48 +
49 +static struct platform_device wrt350n_v2_leds = {
50 + .name = "leds-gpio",
51 + .id = -1,
52 + .dev = {
53 + .platform_data = &wrt350n_v2_led_data,
54 + },
55 +};
56 +
57 +/*
58 + * Buttons attached to GPIO
59 + */
60 +static struct gpio_keys_button wrt350n_v2_buttons[] = {
61 + {
62 + .code = KEY_RESTART,
63 + .gpio = 3,
64 + .desc = "Reset Button",
65 + .active_low = 1,
66 + }, {
67 + .code = KEY_WLAN,
68 + .gpio = 2,
69 + .desc = "WPS Button",
70 + .active_low = 1,
71 + },
72 +};
73 +
74 +static struct gpio_keys_platform_data wrt350n_v2_button_data = {
75 + .buttons = wrt350n_v2_buttons,
76 + .nbuttons = ARRAY_SIZE(wrt350n_v2_buttons),
77 +};
78 +
79 +static struct platform_device wrt350n_v2_button_device = {
80 + .name = "gpio-keys",
81 + .id = -1,
82 + .num_resources = 0,
83 + .dev = {
84 + .platform_data = &wrt350n_v2_button_data,
85 + },
86 +};
87 +
88 +/*
89 + * General setup
90 + */
91 static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
92 { 0, MPP_GPIO }, /* Power LED green (0=on) */
93 { 1, MPP_GPIO }, /* Security LED (0=on) */
94 @@ -140,6 +217,8 @@ static void __init wrt350n_v2_init(void)
95 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
96 WRT350N_V2_NOR_BOOT_SIZE);
97 platform_device_register(&wrt350n_v2_nor_flash);
98 + platform_device_register(&wrt350n_v2_button_device);
99 + platform_device_register(&wrt350n_v2_leds);
100 }
101
102 static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
This page took 0.045398 seconds and 5 git commands to generate.