atheros: add 3.14 configuration
[openwrt/svn-archive/archive.git] / target / linux / atheros / patches-3.10 / 210-reset_button.patch
1 --- a/arch/mips/ar231x/Makefile
2 +++ b/arch/mips/ar231x/Makefile
3 @@ -8,7 +8,7 @@
4 # Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org>
5 #
6
7 -obj-y += board.o prom.o devices.o
8 +obj-y += board.o prom.o devices.o reset.o
9
10 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
11
12 --- /dev/null
13 +++ b/arch/mips/ar231x/reset.c
14 @@ -0,0 +1,58 @@
15 +#include <linux/init.h>
16 +#include <linux/slab.h>
17 +#include <linux/platform_device.h>
18 +#include <linux/gpio_keys.h>
19 +#include <linux/input.h>
20 +#include <ar231x_platform.h>
21 +#include <ar231x.h>
22 +#include "devices.h"
23 +
24 +static int __init
25 +ar231x_init_reset(void)
26 +{
27 + struct platform_device *pdev;
28 + struct gpio_keys_platform_data pdata;
29 + struct gpio_keys_button *p;
30 + int err;
31 +
32 + if (ar231x_board.config->reset_config_gpio == 0xffff)
33 + return -ENODEV;
34 +
35 + p = kzalloc(sizeof(*p), GFP_KERNEL);
36 + if (!p)
37 + goto err;
38 +
39 + p->desc = "reset";
40 + p->type = EV_KEY;
41 + p->code = KEY_RESTART;
42 + p->debounce_interval = 60;
43 + p->gpio = ar231x_board.config->reset_config_gpio;
44 +
45 + memset(&pdata, 0, sizeof(pdata));
46 + pdata.poll_interval = 20;
47 + pdata.buttons = p;
48 + pdata.nbuttons = 1;
49 +
50 + pdev = platform_device_alloc("gpio-keys-polled", 0);
51 + if (!pdev)
52 + goto err_free;
53 +
54 + err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
55 + if (err)
56 + goto err_put_pdev;
57 +
58 + err = platform_device_add(pdev);
59 + if (err)
60 + goto err_put_pdev;
61 +
62 + return 0;
63 +
64 +err_put_pdev:
65 + platform_device_put(pdev);
66 +err_free:
67 + kfree(p);
68 +err:
69 + return -ENOMEM;
70 +}
71 +
72 +module_init(ar231x_init_reset);