Replace system button patch with its correspondant API
[openwrt/svn-archive/archive.git] / target / linux / au1000 / patches / 002-sys_btn_gpio.patch
1 This patch adds support for the GPIO connected system button on the MTX-1 boards. Default configuration is updated accordingly.
2
3 Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
4 ---
5 diff --git a/arch/mips/au1000/mtx-1/platform.c b/arch/mips/au1000/mtx-1/platform.c
6 index 49c0fb4..ce8637b 100644
7 --- a/arch/mips/au1000/mtx-1/platform.c
8 +++ b/arch/mips/au1000/mtx-1/platform.c
9 @@ -22,9 +22,32 @@
10 #include <linux/types.h>
11 #include <linux/platform_device.h>
12 #include <linux/leds.h>
13 +#include <linux/gpio_keys.h>
14 +#include <linux/input.h>
15
16 #include <asm/gpio.h>
17
18 +static struct gpio_keys_button mtx1_gpio_button[] = {
19 + {
20 + .gpio = 207,
21 + .code = BTN_0,
22 + .desc = "System button",
23 + }
24 +};
25 +
26 +static struct gpio_keys_platform_data mtx1_buttons_data = {
27 + .buttons = mtx1_gpio_button,
28 + .nbuttons = ARRAY_SIZE(mtx1_gpio_button),
29 +};
30 +
31 +static struct platform_device mtx1_button = {
32 + .name = "gpio-keys",
33 + .id = -1,
34 + .dev = {
35 + .platform_data = &mtx1_buttons_data,
36 + }
37 +};
38 +
39 static struct resource mtx1_wdt_res[] = {
40 [0] = {
41 .start = 15,
42 @@ -66,11 +89,13 @@ static struct platform_device mtx1_gpio_leds = {
43
44 static struct __initdata platform_device * mtx1_devs[] = {
45 &mtx1_gpio_leds,
46 - &mtx1_wdt
47 + &mtx1_wdt,
48 + &mtx1_button
49 };
50
51 static int __init mtx1_register_devices(void)
52 {
53 + gpio_direction_input(207);
54 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
55 }
56