Root/target/linux/brcm63xx/patches-3.6/300-reset_buttons.patch

1--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3@@ -12,6 +12,8 @@
4 #include <linux/string.h>
5 #include <linux/platform_device.h>
6 #include <linux/ssb/ssb.h>
7+#include <linux/gpio_keys.h>
8+#include <linux/input.h>
9 #include <asm/addrspace.h>
10 #include <bcm63xx_board.h>
11 #include <bcm63xx_cpu.h>
12@@ -28,6 +30,9 @@
13 
14 #define PFX "board_bcm963xx: "
15 
16+#define BCM963XX_KEYS_POLL_INTERVAL 20
17+#define BCM963XX_KEYS_DEBOUNCE_INTERVAL (BCM963XX_KEYS_POLL_INTERVAL * 3)
18+
19 static struct bcm963xx_nvram nvram;
20 static unsigned int mac_addr_used;
21 static struct board_info board;
22@@ -335,6 +340,16 @@ static struct board_info __initdata boar
23             .active_low = 1,
24         },
25     },
26+ .buttons = {
27+ {
28+ .desc = "reset",
29+ .gpio = 33,
30+ .active_low = 1,
31+ .type = EV_KEY,
32+ .code = KEY_RESTART,
33+ .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
34+ },
35+ },
36 };
37 
38 static struct board_info __initdata board_96348gw = {
39@@ -393,6 +408,16 @@ static struct board_info __initdata boar
40             .active_low = 1,
41         },
42     },
43+ .buttons = {
44+ {
45+ .desc = "reset",
46+ .gpio = 36,
47+ .active_low = 1,
48+ .type = EV_KEY,
49+ .code = KEY_RESTART,
50+ .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
51+ },
52+ },
53 };
54 
55 static struct board_info __initdata board_FAST2404 = {
56@@ -866,11 +891,23 @@ static struct platform_device bcm63xx_gp
57     .dev.platform_data = &bcm63xx_led_data,
58 };
59 
60+static struct gpio_keys_platform_data bcm63xx_gpio_keys_data = {
61+ .poll_interval = BCM963XX_KEYS_POLL_INTERVAL,
62+};
63+
64+static struct platform_device bcm63xx_gpio_keys_device = {
65+ .name = "gpio-keys-polled",
66+ .id = 0,
67+ .dev.platform_data = &bcm63xx_gpio_keys_data,
68+};
69+
70 /*
71  * third stage init callback, register all board devices.
72  */
73 int __init board_register_devices(void)
74 {
75+ int button_count = 0;
76+
77     if (board.has_uart0)
78         bcm63xx_uart_register(0);
79 
80@@ -913,5 +950,16 @@ int __init board_register_devices(void)
81 
82     platform_device_register(&bcm63xx_gpio_leds);
83 
84+ /* count number of BUTTONs defined by this device */
85+ while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
86+ button_count++;
87+
88+ if (button_count) {
89+ bcm63xx_gpio_keys_data.nbuttons = button_count;
90+ bcm63xx_gpio_keys_data.buttons = board.buttons;
91+
92+ platform_device_register(&bcm63xx_gpio_keys_device);
93+ }
94+
95     return 0;
96 }
97--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
98+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
99@@ -3,6 +3,7 @@
100 
101 #include <linux/types.h>
102 #include <linux/gpio.h>
103+#include <linux/gpio_keys.h>
104 #include <linux/leds.h>
105 #include <bcm63xx_dev_enet.h>
106 #include <bcm63xx_dev_dsp.h>
107@@ -57,6 +58,9 @@ struct board_info {
108 
109     /* GPIO LEDs */
110     struct gpio_led leds[5];
111+
112+ /* Buttons */
113+ struct gpio_keys_button buttons[4];
114 };
115 
116 #endif /* ! BOARD_BCM963XX_H_ */
117

Archive Download this file



interactive