[kernel] update to 2.6.27.8 and refresh patches
[openwrt-10.03/.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 --- a/arch/mips/au1000/mtx-1/platform.c
6 +++ b/arch/mips/au1000/mtx-1/platform.c
7 @@ -23,9 +23,32 @@
8  #include <linux/types.h>
9  #include <linux/platform_device.h>
10  #include <linux/leds.h>
11 +#include <linux/gpio_keys.h>
12 +#include <linux/input.h>
13  
14  #include <asm/gpio.h>
15  
16 +static struct gpio_keys_button mtx1_gpio_button[] = {
17 +       {
18 +               .gpio = 207,
19 +               .code = BTN_0,
20 +               .desc = "System button",
21 +       }
22 +};
23 +
24 +static struct gpio_keys_platform_data mtx1_buttons_data = {
25 +       .buttons = mtx1_gpio_button,
26 +       .nbuttons = ARRAY_SIZE(mtx1_gpio_button),
27 +};
28 +
29 +static struct platform_device mtx1_button = {
30 +       .name = "gpio-keys",
31 +       .id = -1,
32 +       .dev = {
33 +               .platform_data = &mtx1_buttons_data,
34 +       }
35 +};
36 +
37  static struct resource mtx1_wdt_res[] = {
38         [0] = {
39                 .start = 15,
40 @@ -62,11 +85,13 @@ static struct platform_device mtx1_gpio_
41  
42  static struct platform_device *mtx1_devs[] = {
43         &mtx1_gpio_leds,
44 -       &mtx1_wdt
45 +       &mtx1_wdt,
46 +       &mtx1_button
47  };
48  
49  static int __init mtx1_register_devices(void)
50  {
51 +       gpio_direction_input(207);
52         return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
53  }
54