diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-08 09:34:02 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-08 09:34:02 -0500 |
| commit | f8f5d4f11dc7d321fb372b09fc8767069a18bf30 (patch) | |
| tree | cc615bcdfd5c4b8f5b643785b17c728e3d88769a | |
| parent | 2cedcc4f122934c3ad38dfb2a400b98a62703e6d (diff) | |
| parent | 47d092352c132a2d0ee4156b5dca263eaad2c17f (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: wacom - add new Bamboo PT (0xdb)
Input: add input driver for polled GPIO buttons
Input: turbografx - fix reference counting
Input: synaptics - fix handling of 2-button ClickPads
Input: wacom - add IDs for two new Bamboo PTs
Input: document struct input_absinfo
Input: add keycodes for touchpad on/off keys
Input: usbtouchscreen - add support for LG Flatron T1710B
| -rw-r--r-- | drivers/input/joystick/turbografx.c | 1 | ||||
| -rw-r--r-- | drivers/input/keyboard/Kconfig | 16 | ||||
| -rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/keyboard/gpio_keys_polled.c | 261 | ||||
| -rw-r--r-- | drivers/input/mouse/synaptics.h | 3 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.c | 9 | ||||
| -rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 1 | ||||
| -rw-r--r-- | include/linux/gpio_keys.h | 2 | ||||
| -rw-r--r-- | include/linux/input.h | 25 |
9 files changed, 317 insertions, 2 deletions
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index d53b9e900234..27b6a3ce18ca 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
| @@ -245,6 +245,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
| 245 | goto err_free_tgfx; | 245 | goto err_free_tgfx; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | parport_put_port(pp); | ||
| 248 | return tgfx; | 249 | return tgfx; |
| 249 | 250 | ||
| 250 | err_free_dev: | 251 | err_free_dev: |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index b8c51b9781db..3a87f3ba5f75 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
| @@ -179,6 +179,22 @@ config KEYBOARD_GPIO | |||
| 179 | To compile this driver as a module, choose M here: the | 179 | To compile this driver as a module, choose M here: the |
| 180 | module will be called gpio_keys. | 180 | module will be called gpio_keys. |
| 181 | 181 | ||
| 182 | config KEYBOARD_GPIO_POLLED | ||
| 183 | tristate "Polled GPIO buttons" | ||
| 184 | depends on GENERIC_GPIO | ||
| 185 | select INPUT_POLLDEV | ||
| 186 | help | ||
| 187 | This driver implements support for buttons connected | ||
| 188 | to GPIO pins that are not capable of generating interrupts. | ||
| 189 | |||
| 190 | Say Y here if your device has buttons connected | ||
| 191 | directly to such GPIO pins. Your board-specific | ||
| 192 | setup logic must also provide a platform device, | ||
| 193 | with configuration data saying which GPIOs are used. | ||
| 194 | |||
| 195 | To compile this driver as a module, choose M here: the | ||
| 196 | module will be called gpio_keys_polled. | ||
| 197 | |||
| 182 | config KEYBOARD_TCA6416 | 198 | config KEYBOARD_TCA6416 |
| 183 | tristate "TCA6416 Keypad Support" | 199 | tristate "TCA6416 Keypad Support" |
| 184 | depends on I2C | 200 | depends on I2C |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index a34452e8ebe2..622de73a445d 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
| @@ -14,6 +14,7 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o | |||
| 14 | obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o | 14 | obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o |
| 15 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | 15 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o |
| 16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
| 17 | obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o | ||
| 17 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o | 18 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o |
| 18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 19 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
| 19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 20 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c new file mode 100644 index 000000000000..4c17aff20657 --- /dev/null +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
| @@ -0,0 +1,261 @@ | |||
| 1 | /* | ||
| 2 | * Driver for buttons on GPIO lines not capable of generating interrupts | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org> | ||
| 5 | * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com> | ||
| 6 | * | ||
| 7 | * This file was based on: /drivers/input/misc/cobalt_btns.c | ||
| 8 | * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | ||
| 9 | * | ||
| 10 | * also was based on: /drivers/input/keyboard/gpio_keys.c | ||
| 11 | * Copyright 2005 Phil Blundell | ||
| 12 | * | ||
| 13 | * This program is free software; you can redistribute it and/or modify | ||
| 14 | * it under the terms of the GNU General Public License version 2 as | ||
| 15 | * published by the Free Software Foundation. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <linux/kernel.h> | ||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | #include <linux/input.h> | ||
| 23 | #include <linux/input-polldev.h> | ||
| 24 | #include <linux/ioport.h> | ||
| 25 | #include <linux/platform_device.h> | ||
| 26 | #include <linux/gpio.h> | ||
| 27 | #include <linux/gpio_keys.h> | ||
| 28 | |||
| 29 | #define DRV_NAME "gpio-keys-polled" | ||
| 30 | |||
| 31 | struct gpio_keys_button_data { | ||
| 32 | int last_state; | ||
| 33 | int count; | ||
| 34 | int threshold; | ||
| 35 | int can_sleep; | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct gpio_keys_polled_dev { | ||
| 39 | struct input_polled_dev *poll_dev; | ||
| 40 | struct device *dev; | ||
| 41 | struct gpio_keys_platform_data *pdata; | ||
| 42 | struct gpio_keys_button_data data[0]; | ||
| 43 | }; | ||
| 44 | |||
| 45 | static void gpio_keys_polled_check_state(struct input_dev *input, | ||
| 46 | struct gpio_keys_button *button, | ||
| 47 | struct gpio_keys_button_data *bdata) | ||
| 48 | { | ||
| 49 | int state; | ||
| 50 | |||
| 51 | if (bdata->can_sleep) | ||
| 52 | state = !!gpio_get_value_cansleep(button->gpio); | ||
| 53 | else | ||
| 54 | state = !!gpio_get_value(button->gpio); | ||
| 55 | |||
| 56 | if (state != bdata->last_state) { | ||
| 57 | unsigned int type = button->type ?: EV_KEY; | ||
| 58 | |||
| 59 | input_event(input, type, button->code, | ||
| 60 | !!(state ^ button->active_low)); | ||
| 61 | input_sync(input); | ||
| 62 | bdata->count = 0; | ||
| 63 | bdata->last_state = state; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | static void gpio_keys_polled_poll(struct input_polled_dev *dev) | ||
| 68 | { | ||
| 69 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
| 70 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
| 71 | struct input_dev *input = dev->input; | ||
| 72 | int i; | ||
| 73 | |||
| 74 | for (i = 0; i < bdev->pdata->nbuttons; i++) { | ||
| 75 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | ||
| 76 | |||
| 77 | if (bdata->count < bdata->threshold) | ||
| 78 | bdata->count++; | ||
| 79 | else | ||
| 80 | gpio_keys_polled_check_state(input, &pdata->buttons[i], | ||
| 81 | bdata); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | static void gpio_keys_polled_open(struct input_polled_dev *dev) | ||
| 86 | { | ||
| 87 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
| 88 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
| 89 | |||
| 90 | if (pdata->enable) | ||
| 91 | pdata->enable(bdev->dev); | ||
| 92 | } | ||
| 93 | |||
| 94 | static void gpio_keys_polled_close(struct input_polled_dev *dev) | ||
| 95 | { | ||
| 96 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
| 97 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
| 98 | |||
| 99 | if (pdata->disable) | ||
| 100 | pdata->disable(bdev->dev); | ||
| 101 | } | ||
| 102 | |||
| 103 | static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | ||
| 104 | { | ||
| 105 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | ||
| 106 | struct device *dev = &pdev->dev; | ||
| 107 | struct gpio_keys_polled_dev *bdev; | ||
| 108 | struct input_polled_dev *poll_dev; | ||
| 109 | struct input_dev *input; | ||
| 110 | int error; | ||
| 111 | int i; | ||
| 112 | |||
| 113 | if (!pdata || !pdata->poll_interval) | ||
| 114 | return -EINVAL; | ||
| 115 | |||
| 116 | bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) + | ||
| 117 | pdata->nbuttons * sizeof(struct gpio_keys_button_data), | ||
| 118 | GFP_KERNEL); | ||
| 119 | if (!bdev) { | ||
| 120 | |||
