diff options
author | Phil Sutter <n0-1@freewrt.org> | 2009-03-05 02:27:15 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-03-09 23:10:12 -0400 |
commit | d9bdffd2102404e8ea5f71c5b88dad890984164d (patch) | |
tree | c8deba7479dc3ba6140dd6c55742dbb16f819db7 /arch | |
parent | 73969ff0eda233f140bcbed1251431387b43f383 (diff) |
Input: add driver for S1 button of rb532
Mikrotik's Routerboard 532 has two builtin buttons, from which one
triggers a hardware reset. The other one is accessible through GPIO
pin 1. Sadly, this pin is being multiplexed with UART0 input, so
enabling it as interrupt source (as implied by the gpio-keys driver)
is not possible unless UART0 has been turned off. The later one though
is a rather bad idea as the Routerboard is an embedded device with
only a single serial port, so it's almost always used as serial
console device.
This patch adds a driver based on INPUT_POLLDEV, which disables the
UART and reconfigures GPIO pin 1 temporarily while reading the button
state. This procedure works fine and has been tested as part of
another, unpublished driver for this device.
Signed-off-by: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/mach-rc32434/gpio.h | 3 | ||||
-rw-r--r-- | arch/mips/rb532/devices.c | 19 |
2 files changed, 4 insertions, 18 deletions
diff --git a/arch/mips/include/asm/mach-rc32434/gpio.h b/arch/mips/include/asm/mach-rc32434/gpio.h index 3cb50d17b62d..12ee8d510160 100644 --- a/arch/mips/include/asm/mach-rc32434/gpio.h +++ b/arch/mips/include/asm/mach-rc32434/gpio.h | |||
@@ -80,6 +80,9 @@ struct rb532_gpio_reg { | |||
80 | /* Compact Flash GPIO pin */ | 80 | /* Compact Flash GPIO pin */ |
81 | #define CF_GPIO_NUM 13 | 81 | #define CF_GPIO_NUM 13 |
82 | 82 | ||
83 | /* S1 button GPIO (shared with UART0_SIN) */ | ||
84 | #define GPIO_BTN_S1 1 | ||
85 | |||
83 | extern void rb532_gpio_set_ilevel(int bit, unsigned gpio); | 86 | extern void rb532_gpio_set_ilevel(int bit, unsigned gpio); |
84 | extern void rb532_gpio_set_istat(int bit, unsigned gpio); | 87 | extern void rb532_gpio_set_istat(int bit, unsigned gpio); |
85 | extern void rb532_gpio_set_func(unsigned gpio); | 88 | extern void rb532_gpio_set_func(unsigned gpio); |
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index 4a5f05b662ae..9f40e1ff9b4f 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c | |||
@@ -200,26 +200,9 @@ static struct platform_device rb532_led = { | |||
200 | .id = -1, | 200 | .id = -1, |
201 | }; | 201 | }; |
202 | 202 | ||
203 | static struct gpio_keys_button rb532_gpio_btn[] = { | ||
204 | { | ||
205 | .gpio = 1, | ||
206 | .code = BTN_0, | ||
207 | .desc = "S1", | ||
208 | .active_low = 1, | ||
209 | } | ||
210 | }; | ||
211 | |||
212 | static struct gpio_keys_platform_data rb532_gpio_btn_data = { | ||
213 | .buttons = rb532_gpio_btn, | ||
214 | .nbuttons = ARRAY_SIZE(rb532_gpio_btn), | ||
215 | }; | ||
216 | |||
217 | static struct platform_device rb532_button = { | 203 | static struct platform_device rb532_button = { |
218 | .name = "gpio-keys", | 204 | .name = "rb532-button", |
219 | .id = -1, | 205 | .id = -1, |
220 | .dev = { | ||
221 | .platform_data = &rb532_gpio_btn_data, | ||
222 | } | ||
223 | }; | 206 | }; |
224 | 207 | ||
225 | static struct resource rb532_wdt_res[] = { | 208 | static struct resource rb532_wdt_res[] = { |