1 --- a/arch/mips/lantiq/Makefile
2 +++ b/arch/mips/lantiq/Makefile
4 # under the terms of the GNU General Public License version 2 as published
5 # by the Free Software Foundation.
7 -obj-y := irq.o setup.o clk.o prom.o devices.o
8 +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o
10 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
13 +++ b/arch/mips/lantiq/dev-gpio-buttons.c
16 + * Lantiq GPIO button support
18 + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
19 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
21 + * This program is free software; you can redistribute it and/or modify it
22 + * under the terms of the GNU General Public License version 2 as published
23 + * by the Free Software Foundation.
26 +#include "linux/init.h"
27 +#include "linux/slab.h"
28 +#include <linux/platform_device.h>
30 +#include "dev-gpio-buttons.h"
32 +void __init ltq_register_gpio_keys_polled(int id,
33 + unsigned poll_interval,
35 + struct gpio_keys_button *buttons)
37 + struct platform_device *pdev;
38 + struct gpio_keys_platform_data pdata;
39 + struct gpio_keys_button *p;
42 + p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
46 + memcpy(p, buttons, nbuttons * sizeof(*p));
48 + pdev = platform_device_alloc("gpio-keys-polled", id);
50 + goto err_free_buttons;
52 + memset(&pdata, 0, sizeof(pdata));
53 + pdata.poll_interval = poll_interval;
54 + pdata.nbuttons = nbuttons;
57 + err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
61 + err = platform_device_add(pdev);
68 + platform_device_put(pdev);
74 +++ b/arch/mips/lantiq/dev-gpio-buttons.h
77 + * Lantiq GPIO button support
79 + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
80 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
82 + * This program is free software; you can redistribute it and/or modify it
83 + * under the terms of the GNU General Public License version 2 as published
84 + * by the Free Software Foundation.
87 +#ifndef _LANTIQ_DEV_GPIO_BUTTONS_H
88 +#define _LANTIQ_DEV_GPIO_BUTTONS_H
90 +#include <linux/input.h>
91 +#include <linux/gpio_keys.h>
93 +#define LTQ_KEYS_POLL_INTERVAL 20 /* msecs */
94 +#define LTQ_KEYS_DEBOUNCE_INTERVAL (3 * LTQ_KEYS_POLL_INTERVAL)
96 +void ltq_register_gpio_keys_polled(int id,
97 + unsigned poll_interval,
99 + struct gpio_keys_button *buttons);
101 +#endif /* _LANTIQ_DEV_GPIO_BUTTONS_H */