diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/input.c | 37 | ||||
-rw-r--r-- | drivers/input/keyboard/Kconfig | 10 | ||||
-rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 6 | ||||
-rw-r--r-- | drivers/input/keyboard/tegra-kbc.c | 727 | ||||
-rw-r--r-- | drivers/input/keyboard/tnetv107x-keypad.c | 5 | ||||
-rw-r--r-- | drivers/input/misc/ixp4xx-beeper.c | 6 | ||||
-rw-r--r-- | drivers/input/misc/rotary_encoder.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 32 | ||||
-rw-r--r-- | drivers/input/serio/ct82c710.c | 8 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 11 | ||||
-rw-r--r-- | drivers/input/serio/serport.c | 24 | ||||
-rw-r--r-- | drivers/input/sparse-keymap.c | 1 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 2 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 27 | ||||
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 38 | ||||
-rw-r--r-- | drivers/input/touchscreen/bu21013_ts.c | 39 | ||||
-rw-r--r-- | drivers/input/touchscreen/tnetv107x-ts.c | 5 | ||||
-rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 13 |
19 files changed, 913 insertions, 83 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7985114beac7..11905b6a3023 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -75,7 +75,6 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz) | |||
75 | * dev->event_lock held and interrupts disabled. | 75 | * dev->event_lock held and interrupts disabled. |
76 | */ | 76 | */ |
77 | static void input_pass_event(struct input_dev *dev, | 77 | static void input_pass_event(struct input_dev *dev, |
78 | struct input_handler *src_handler, | ||
79 | unsigned int type, unsigned int code, int value) | 78 | unsigned int type, unsigned int code, int value) |
80 | { | 79 | { |
81 | struct input_handler *handler; | 80 | struct input_handler *handler; |
@@ -94,15 +93,6 @@ static void input_pass_event(struct input_dev *dev, | |||
94 | continue; | 93 | continue; |
95 | 94 | ||
96 | handler = handle->handler; | 95 | handler = handle->handler; |
97 | |||
98 | /* | ||
99 | * If this is the handler that injected this | ||
100 | * particular event we want to skip it to avoid | ||
101 | * filters firing again and again. | ||
102 | */ | ||
103 | if (handler == src_handler) | ||
104 | continue; | ||
105 | |||
106 | if (!handler->filter) { | 96 | if (!handler->filter) { |
107 | if (filtered) | 97 | if (filtered) |
108 | break; | 98 | break; |
@@ -132,7 +122,7 @@ static void input_repeat_key(unsigned long data) | |||
132 | if (test_bit(dev->repeat_key, dev->key) && | 122 | if (test_bit(dev->repeat_key, dev->key) && |
133 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { | 123 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { |
134 | 124 | ||
135 | input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2); | 125 | input_pass_event(dev, EV_KEY, dev->repeat_key, 2); |
136 | 126 | ||
137 | if (dev->sync) { | 127 | if (dev->sync) { |
138 | /* | 128 | /* |
@@ -141,7 +131,7 @@ static void input_repeat_key(unsigned long data) | |||
141 | * Otherwise assume that the driver will send | 131 | * Otherwise assume that the driver will send |
142 | * SYN_REPORT once it's done. | 132 | * SYN_REPORT once it's done. |
143 | */ | 133 | */ |
144 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 134 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
145 | } | 135 | } |
146 | 136 | ||
147 | if (dev->rep[REP_PERIOD]) | 137 | if (dev->rep[REP_PERIOD]) |
@@ -174,7 +164,6 @@ static void input_stop_autorepeat(struct input_dev *dev) | |||
174 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) | 164 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) |
175 | 165 | ||
176 | static int input_handle_abs_event(struct input_dev *dev, | 166 | static int input_handle_abs_event(struct input_dev *dev, |
177 | struct input_handler *src_handler, | ||
178 | unsigned int code, int *pval) | 167 | unsigned int code, int *pval) |
179 | { | 168 | { |
180 | bool is_mt_event; | 169 | bool is_mt_event; |
@@ -218,15 +207,13 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
218 | /* Flush pending "slot" event */ | 207 | /* Flush pending "slot" event */ |
219 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { | 208 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { |
220 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); | 209 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); |
221 | input_pass_event(dev, src_handler, | 210 | input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); |
222 | EV_ABS, ABS_MT_SLOT, dev->slot); | ||
223 | } | 211 | } |
224 | 212 | ||
225 | return INPUT_PASS_TO_HANDLERS; | 213 | return INPUT_PASS_TO_HANDLERS; |
226 | } | 214 | } |
227 | 215 | ||
228 | static void input_handle_event(struct input_dev *dev, | 216 | static void input_handle_event(struct input_dev *dev, |
229 | struct input_handler *src_handler, | ||
230 | unsigned int type, unsigned int code, int value) | 217 | unsigned int type, unsigned int code, int value) |
231 | { | 218 | { |
232 | int disposition = INPUT_IGNORE_EVENT; | 219 | int disposition = INPUT_IGNORE_EVENT; |
@@ -279,8 +266,7 @@ static void input_handle_event(struct input_dev *dev, | |||
279 | 266 | ||
280 | case EV_ABS: | 267 | case EV_ABS: |
281 | if (is_event_supported(code, dev->absbit, ABS_MAX)) | 268 | if (is_event_supported(code, dev->absbit, ABS_MAX)) |
282 | disposition = input_handle_abs_event(dev, src_handler, | 269 | disposition = input_handle_abs_event(dev, code, &value); |
283 | code, &value); | ||
284 | 270 | ||
285 | break; | 271 | break; |
286 | 272 | ||
@@ -338,7 +324,7 @@ static void input_handle_event(struct input_dev *dev, | |||
338 | dev->event(dev, type, code, value); | 324 | dev->event(dev, type, code, value); |
339 | 325 | ||
340 | if (disposition & INPUT_PASS_TO_HANDLERS) | 326 | if (disposition & INPUT_PASS_TO_HANDLERS) |
341 | input_pass_event(dev, src_handler, type, code, value); | 327 | input_pass_event(dev, type, code, value); |
342 | } | 328 | } |
343 | 329 | ||
344 | /** | 330 | /** |
@@ -367,7 +353,7 @@ void input_event(struct input_dev *dev, | |||
367 | 353 | ||
368 | spin_lock_irqsave(&dev->event_lock, flags); | 354 | spin_lock_irqsave(&dev->event_lock, flags); |
369 | add_input_randomness(type, code, value); | 355 | add_input_randomness(type, code, value); |
370 | input_handle_event(dev, NULL, type, code, value); | 356 | input_handle_event(dev, type, code, value); |
371 | spin_unlock_irqrestore(&dev->event_lock, flags); | 357 | spin_unlock_irqrestore(&dev->event_lock, flags); |
372 | } | 358 | } |
373 | } | 359 | } |
@@ -397,8 +383,7 @@ void input_inject_event(struct input_handle *handle, | |||
397 | rcu_read_lock(); | 383 | rcu_read_lock(); |
398 | grab = rcu_dereference(dev->grab); | 384 | grab = rcu_dereference(dev->grab); |
399 | if (!grab || grab == handle) | 385 | if (!grab || grab == handle) |
400 | input_handle_event(dev, handle->handler, | 386 | input_handle_event(dev, type, code, value); |
401 | type, code, value); | ||
402 | rcu_read_unlock(); | 387 | rcu_read_unlock(); |
403 | 388 | ||
404 | spin_unlock_irqrestore(&dev->event_lock, flags); | 389 | spin_unlock_irqrestore(&dev->event_lock, flags); |
@@ -611,10 +596,10 @@ static void input_dev_release_keys(struct input_dev *dev) | |||
611 | for (code = 0; code <= KEY_MAX; code++) { | 596 | for (code = 0; code <= KEY_MAX; code++) { |
612 | if (is_event_supported(code, dev->keybit, KEY_MAX) && | 597 | if (is_event_supported(code, dev->keybit, KEY_MAX) && |
613 | __test_and_clear_bit(code, dev->key)) { | 598 | __test_and_clear_bit(code, dev->key)) { |
614 | input_pass_event(dev, NULL, EV_KEY, code, 0); | 599 | input_pass_event(dev, EV_KEY, code, 0); |
615 | } | 600 | } |
616 | } | 601 | } |
617 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 602 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
618 | } | 603 | } |
619 | } | 604 | } |
620 | 605 | ||
@@ -889,9 +874,9 @@ int input_set_keycode(struct input_dev *dev, | |||
889 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && | 874 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
890 | __test_and_clear_bit(old_keycode, dev->key)) { | 875 | __test_and_clear_bit(old_keycode, dev->key)) { |
891 | 876 | ||
892 | input_pass_event(dev, NULL, EV_KEY, old_keycode, 0); | 877 | input_pass_event(dev, EV_KEY, old_keycode, 0); |
893 | if (dev->sync) | 878 | if (dev->sync) |
894 | input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); | 879 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
895 | } | 880 | } |
896 | 881 | ||
897 | out: | 882 | out: |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 417507348bab..c7a92028f450 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -343,6 +343,16 @@ config KEYBOARD_NOMADIK | |||
343 | To compile this driver as a module, choose M here: the | 343 | To compile this driver as a module, choose M here: the |
344 | module will be called nmk-ske-keypad. | 344 | module will be called nmk-ske-keypad. |
345 | 345 | ||
346 | config KEYBOARD_TEGRA | ||
347 | tristate "NVIDIA Tegra internal matrix keyboard controller support" | ||
348 | depends on ARCH_TEGRA | ||
349 | help | ||
350 | Say Y here if you want to use a matrix keyboard connected directly | ||
351 | to the internal keyboard controller on Tegra SoCs. | ||
352 | |||
353 | To compile this driver as a module, choose M here: the | ||
354 | module will be called tegra-kbc. | ||
355 | |||
346 | config KEYBOARD_OPENCORES | 356 | config KEYBOARD_OPENCORES |
347 | tristate "OpenCores Keyboard Controller" | 357 | tristate "OpenCores Keyboard Controller" |
348 | help | 358 | help |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 4e5571b72cda..468c627a2844 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o | |||
42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | 42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o |
43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | 43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o |
44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o | 44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o |
45 | obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o | ||
45 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o | 46 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o |
46 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o | 47 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o |
47 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | 48 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6069abe31e42..eb3006361ee4 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -322,7 +322,7 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata) | |||
322 | struct gpio_keys_button *button = bdata->button; | 322 | struct gpio_keys_button *button = bdata->button; |
323 | struct input_dev *input = bdata->input; | 323 | struct input_dev *input = bdata->input; |
324 | unsigned int type = button->type ?: EV_KEY; | 324 | unsigned int type = button->type ?: EV_KEY; |
325 | int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; | 325 | int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; |
326 | 326 | ||
327 | input_event(input, type, button->code, !!state); | 327 | input_event(input, type, button->code, !!state); |
328 | input_sync(input); | 328 | input_sync(input); |
@@ -410,8 +410,8 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev, | |||
410 | if (!button->can_disable) | 410 | if (!button->can_disable) |
411 | irqflags |= IRQF_SHARED; | 411 | irqflags |= IRQF_SHARED; |
412 | 412 | ||
413 | error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); | 413 | error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata); |
414 | if (error) { | 414 | if (error < 0) { |
415 | dev_err(dev, "Unable to claim irq %d; error %d\n", | 415 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
416 | irq, error); | 416 | irq, error); |
417 | goto fail3; | 417 | goto fail3; |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c new file mode 100644 index 000000000000..ac471b77c18e --- /dev/null +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -0,0 +1,727 @@ | |||
1 | /* | ||
2 | * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix | ||
3 | * keyboard controller | ||
4 | * | ||
5 | * Copyright (c) 2009-2011, NVIDIA Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/clk.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <mach/clk.h> | ||
31 | #include <mach/kbc.h> | ||
32 | |||
33 | #define KBC_MAX_DEBOUNCE_CNT 0x3ffu | ||
34 | |||
35 | /* KBC row scan time and delay for beginning the row scan. */ | ||
36 | #define KBC_ROW_SCAN_TIME 16 | ||
37 | #define KBC_ROW_SCAN_DLY 5 | ||
38 | |||
39 | /* KBC uses a 32KHz clock so a cycle = 1/32Khz */ | ||
40 | #define KBC_CYCLE_USEC 32 | ||
41 | |||
42 | /* KBC Registers */ | ||
43 | |||
44 | /* KBC Control Register */ | ||
45 | #define KBC_CONTROL_0 0x0 | ||
46 | #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) | ||
47 | #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) | ||
48 | #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) | ||
49 | #define KBC_CONTROL_KBC_EN (1 << 0) | ||
50 | |||
51 | /* KBC Interrupt Register */ | ||
52 | #define KBC_INT_0 0x4 | ||
53 | #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) | ||
54 | |||
55 | #define KBC_ROW_CFG0_0 0x8 | ||
56 | #define KBC_COL_CFG0_0 0x18 | ||
57 | #define KBC_INIT_DLY_0 0x28 | ||
58 | #define KBC_RPT_DLY_0 0x2c | ||
59 | #define KBC_KP_ENT0_0 0x30 | ||
60 | #define KBC_KP_ENT1_0 0x34 | ||
61 | #define KBC_ROW0_MASK_0 0x38 | ||
62 | |||
63 | #define KBC_ROW_SHIFT 3 | ||
64 | |||
65 | struct tegra_kbc { | ||
66 | void __iomem *mmio; | ||
67 | struct input_dev *idev; | ||
68 | unsigned int irq; | ||
69 | unsigned int wake_enable_rows; | ||
70 | unsigned int wake_enable_cols; | ||
71 | spinlock_t lock; | ||
72 | unsigned int repoll_dly; | ||
73 | unsigned long cp_dly_jiffies; | ||
74 | const struct tegra_kbc_platform_data *pdata; | ||
75 | unsigned short keycode[KBC_MAX_KEY]; | ||
76 | unsigned short current_keys[KBC_MAX_KPENT]; | ||
77 | unsigned int num_pressed_keys; | ||
78 | struct timer_list timer; | ||
79 | struct clk *clk; | ||
80 | }; | ||
81 | |||
82 | static const u32 tegra_kbc_default_keymap[] = { | ||
83 | KEY(0, 2, KEY_W), | ||
84 | KEY(0, 3, KEY_S), | ||
85 | KEY(0, 4, KEY_A), | ||
86 | KEY(0, 5, KEY_Z), | ||
87 | KEY(0, 7, KEY_FN), | ||
88 | |||
89 | KEY(1, 7, KEY_LEFTMETA), | ||
90 | |||
91 | KEY(2, 6, KEY_RIGHTALT), | ||
92 | KEY(2, 7, KEY_LEFTALT), | ||
93 | |||
94 | KEY(3, 0, KEY_5), | ||
95 | KEY(3, 1, KEY_4), | ||
96 | KEY(3, 2, KEY_R), | ||
97 | KEY(3, 3, KEY_E), | ||
98 | KEY(3, 4, KEY_F), | ||
99 | KEY(3, 5, KEY_D), | ||
100 | KEY(3, 6, KEY_X), | ||
101 | |||
102 | KEY(4, 0, KEY_7), | ||
103 | KEY(4, 1, KEY_6), | ||
104 | KEY(4, 2, KEY_T), | ||
105 | KEY(4, 3, KEY_H), | ||
106 | KEY(4, 4, KEY_G), | ||
107 | KEY(4, 5, KEY_V), | ||
108 | KEY(4, 6, KEY_C), | ||
109 | KEY(4, 7, KEY_SPACE), | ||
110 | |||
111 | KEY(5, 0, KEY_9), | ||
112 | KEY(5, 1, KEY_8), | ||
113 | KEY(5, 2, KEY_U), | ||
114 | KEY(5, 3, KEY_Y), | ||
115 | KEY(5, 4, KEY_J), | ||
116 | KEY(5, 5, KEY_N), | ||
117 | KEY(5, 6, KEY_B), | ||
118 | KEY(5, 7, KEY_BACKSLASH), | ||
119 | |||
120 | KEY(6, 0, KEY_MINUS), | ||
121 | KEY(6, 1, KEY_0), | ||
122 | KEY(6, 2, KEY_O), | ||
123 | KEY(6, 3, KEY_I), | ||
124 | KEY(6, 4, KEY_L), | ||
125 | KEY(6, 5, KEY_K), | ||
126 | KEY(6, 6, KEY_COMMA), | ||
127 | KEY(6, 7, KEY_M), | ||
128 | |||
129 | KEY(7, 1, KEY_EQUAL), | ||
130 | KEY(7, 2, KEY_RIGHTBRACE), | ||
131 | KEY(7, 3, KEY_ENTER), | ||
132 | KEY(7, 7, KEY_MENU), | ||
133 | |||
134 | KEY(8, 4, KEY_RIGHTSHIFT), | ||
135 | KEY(8, 5, KEY_LEFTSHIFT), | ||
136 | |||
137 | KEY(9, 5, KEY_RIGHTCTRL), | ||
138 | KEY(9, 7, KEY_LEFTCTRL), | ||
139 | |||
140 | KEY(11, 0, KEY_LEFTBRACE), | ||
141 | KEY(11, 1, KEY_P), | ||
142 | KEY(11, 2, KEY_APOSTROPHE), | ||
143 | KEY(11, 3, KEY_SEMICOLON), | ||
144 | KEY(11, 4, KEY_SLASH), | ||
145 | KEY(11, 5, KEY_DOT), | ||
146 | |||
147 | KEY(12, 0, KEY_F10), | ||
148 | KEY(12, 1, KEY_F9), | ||
149 | KEY(12, 2, KEY_BACKSPACE), | ||
150 | KEY(12, 3, KEY_3), | ||
151 | KEY(12, 4, KEY_2), | ||
152 | KEY(12, 5, KEY_UP), | ||
153 | KEY(12, 6, KEY_PRINT), | ||
154 | KEY(12, 7, KEY_PAUSE), | ||
155 | |||
156 | KEY(13, 0, KEY_INSERT), | ||
157 | KEY(13, 1, KEY_DELETE), | ||
158 | KEY(13, 3, KEY_PAGEUP), | ||
159 | KEY(13, 4, KEY_PAGEDOWN), | ||
160 | KEY(13, 5, KEY_RIGHT), | ||
161 | KEY(13, 6, KEY_DOWN), | ||
162 | KEY(13, 7, KEY_LEFT), | ||
163 | |||
164 | KEY(14, 0, KEY_F11), | ||
165 | KEY(14, 1, KEY_F12), | ||
166 | KEY(14, 2, KEY_F8), | ||
167 | KEY(14, 3, KEY_Q), | ||
168 | KEY(14, 4, KEY_F4), | ||
169 | KEY(14, 5, KEY_F3), | ||
170 | KEY(14, 6, KEY_1), | ||
171 | KEY(14, 7, KEY_F7), | ||
172 | |||
173 | KEY(15, 0, KEY_ESC), | ||
174 | KEY(15, 1, KEY_GRAVE), | ||
175 | KEY(15, 2, KEY_F5), | ||
176 | KEY(15, 3, KEY_TAB), | ||
177 | KEY(15, 4, KEY_F1), | ||
178 | KEY(15, 5, KEY_F2), | ||
179 | KEY(15, 6, KEY_CAPSLOCK), | ||
180 | KEY(15, 7, KEY_F6), | ||
181 | }; | ||
182 | |||
183 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | ||
184 | .keymap = tegra_kbc_default_keymap, | ||
185 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | ||
186 | }; | ||
187 | |||
188 | static void tegra_kbc_report_released_keys(struct input_dev *input, | ||
189 | unsigned short old_keycodes[], | ||
190 | unsigned int old_num_keys, | ||
191 | unsigned short new_keycodes[], | ||
192 | unsigned int new_num_keys) | ||
193 | { | ||
194 | unsigned int i, j; | ||
195 | |||
196 | for (i = 0; i < old_num_keys; i++) { | ||
197 | for (j = 0; j < new_num_keys; j++) | ||
198 | if (old_keycodes[i] == new_keycodes[j]) | ||
199 | break; | ||
200 | |||
201 | if (j == new_num_keys) | ||
202 | input_report_key(input, old_keycodes[i], 0); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | static void tegra_kbc_report_pressed_keys(struct input_dev *input, | ||
207 | unsigned char scancodes[], | ||
208 | unsigned short keycodes[], | ||
209 | unsigned int num_pressed_keys) | ||
210 | { | ||
211 | unsigned int i; | ||
212 | |||
213 | for (i = 0; i < num_pressed_keys; i++) { | ||
214 | input_event(input, EV_MSC, MSC_SCAN, scancodes[i]); | ||
215 | input_report_key(input, keycodes[i], 1); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | ||
220 | { | ||
221 | unsigned char scancodes[KBC_MAX_KPENT]; | ||
222 | unsigned short keycodes[KBC_MAX_KPENT]; | ||
223 | u32 val = 0; | ||
224 | unsigned int i; | ||
225 | unsigned int num_down = 0; | ||
226 | unsigned long flags; | ||
227 | |||
228 | spin_lock_irqsave(&kbc->lock, flags); | ||
229 | for (i = 0; i < KBC_MAX_KPENT; i++) { | ||
230 | if ((i % 4) == 0) | ||
231 | val = readl(kbc->mmio + KBC_KP_ENT0_0 + i); | ||
232 | |||
233 | if (val & 0x80) { | ||
234 | unsigned int col = val & 0x07; | ||
235 | unsigned int row = (val >> 3) & 0x0f; | ||
236 | unsigned char scancode = | ||
237 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); | ||
238 | |||
239 | scancodes[num_down] = scancode; | ||
240 | keycodes[num_down++] = kbc->keycode[scancode]; | ||
241 | } | ||
242 | |||
243 | val >>= 8; | ||
244 | } | ||
245 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
246 | |||
247 | tegra_kbc_report_released_keys(kbc->idev, | ||
248 | kbc->current_keys, kbc->num_pressed_keys, | ||
249 | keycodes, num_down); | ||
250 | tegra_kbc_report_pressed_keys(kbc->idev, scancodes, keycodes, num_down); | ||
251 | input_sync(kbc->idev); | ||
252 | |||
253 | memcpy(kbc->current_keys, keycodes, sizeof(kbc->current_keys)); | ||
254 | kbc->num_pressed_keys = num_down; | ||
255 | } | ||
256 | |||
257 | static void tegra_kbc_keypress_timer(unsigned long data) | ||
258 | { | ||
259 | struct tegra_kbc *kbc = (struct tegra_kbc *)data; | ||
260 | unsigned long flags; | ||
261 | u32 val; | ||
262 | unsigned int i; | ||
263 | |||
264 | val = (readl(kbc->mmio + KBC_INT_0) >> 4) & 0xf; | ||
265 | if (val) { | ||
266 | unsigned long dly; | ||
267 | |||
268 | tegra_kbc_report_keys(kbc); | ||
269 | |||
270 | /* | ||
271 | * If more than one keys are pressed we need not wait | ||
272 | * for the repoll delay. | ||
273 | */ | ||
274 | dly = (val == 1) ? kbc->repoll_dly : 1; | ||
275 | mod_timer(&kbc->timer, jiffies + msecs_to_jiffies(dly)); | ||
276 | } else { | ||
277 | /* Release any pressed keys and exit the polling loop */ | ||
278 | for (i = 0; i < kbc->num_pressed_keys; i++) | ||
279 | input_report_key(kbc->idev, kbc->current_keys[i], 0); | ||
280 | input_sync(kbc->idev); | ||
281 | |||
282 | kbc->num_pressed_keys = 0; | ||
283 | |||
284 | /* All keys are released so enable the keypress interrupt */ | ||
285 | spin_lock_irqsave(&kbc->lock, flags); | ||
286 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
287 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
288 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
289 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static irqreturn_t tegra_kbc_isr(int irq, void *args) | ||
294 | { | ||
295 | struct tegra_kbc *kbc = args; | ||
296 | u32 val, ctl; | ||
297 | |||
298 | /* | ||
299 | * Until all keys are released, defer further processing to | ||
300 | * the polling loop in tegra_kbc_keypress_timer | ||
301 | */ | ||
302 | ctl = readl(kbc->mmio + KBC_CONTROL_0); | ||
303 | ctl &= ~KBC_CONTROL_FIFO_CNT_INT_EN; | ||
304 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
305 | |||
306 | /* | ||
307 | * Quickly bail out & reenable interrupts if the fifo threshold | ||
308 | * count interrupt wasn't the interrupt source | ||
309 | */ | ||
310 | val = readl(kbc->mmio + KBC_INT_0); | ||
311 | writel(val, kbc->mmio + KBC_INT_0); | ||
312 | |||
313 | if (val & KBC_INT_FIFO_CNT_INT_STATUS) { | ||
314 | /* | ||
315 | * Schedule timer to run when hardware is in continuous | ||
316 | * polling mode. | ||
317 | */ | ||
318 | mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); | ||
319 | } else { | ||
320 | ctl |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
321 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
322 | } | ||
323 | |||
324 | return IRQ_HANDLED; | ||
325 | } | ||
326 | |||
327 | static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter) | ||
328 | { | ||
329 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
330 | int i; | ||
331 | unsigned int rst_val; | ||
332 | |||
333 | BUG_ON(pdata->wake_cnt > KBC_MAX_KEY); | ||
334 | rst_val = (filter && pdata->wake_cnt) ? ~0 : 0; | ||
335 | |||
336 | for (i = 0; i < KBC_MAX_ROW; i++) | ||
337 | writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4); | ||
338 | |||
339 | if (filter) { | ||
340 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
341 | u32 val, addr; | ||
342 | addr = pdata->wake_cfg[i].row * 4 + KBC_ROW0_MASK_0; | ||
343 | val = readl(kbc->mmio + addr); | ||
344 | val &= ~(1 << pdata->wake_cfg[i].col); | ||
345 | writel(val, kbc->mmio + addr); | ||
346 | } | ||
347 | } | ||
348 | } | ||
349 | |||
350 | static void tegra_kbc_config_pins(struct tegra_kbc *kbc) | ||
351 | { | ||
352 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
353 | int i; | ||
354 | |||
355 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
356 | u32 r_shft = 5 * (i % 6); | ||
357 | u32 c_shft = 4 * (i % 8); | ||
358 | u32 r_mask = 0x1f << r_shft; | ||
359 | u32 c_mask = 0x0f << c_shft; | ||
360 | u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; | ||
361 | u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; | ||
362 | u32 row_cfg = readl(kbc->mmio + r_offs); | ||
363 | u32 col_cfg = readl(kbc->mmio + c_offs); | ||
364 | |||
365 | row_cfg &= ~r_mask; | ||
366 | col_cfg &= ~c_mask; | ||
367 | |||
368 | if (pdata->pin_cfg[i].is_row) | ||
369 | row_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << r_shft; | ||
370 | else | ||
371 | col_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << c_shft; | ||
372 | |||
373 | writel(row_cfg, kbc->mmio + r_offs); | ||
374 | writel(col_cfg, kbc->mmio + c_offs); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | static int tegra_kbc_start(struct tegra_kbc *kbc) | ||
379 | { | ||
380 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
381 | unsigned long flags; | ||
382 | unsigned int debounce_cnt; | ||
383 | u32 val = 0; | ||
384 | |||
385 | clk_enable(kbc->clk); | ||
386 | |||
387 | /* Reset the KBC controller to clear all previous status.*/ | ||
388 | tegra_periph_reset_assert(kbc->clk); | ||
389 | udelay(100); | ||
390 | tegra_periph_reset_deassert(kbc->clk); | ||
391 | udelay(100); | ||
392 | |||
393 | tegra_kbc_config_pins(kbc); | ||
394 | tegra_kbc_setup_wakekeys(kbc, false); | ||
395 | |||
396 | writel(pdata->repeat_cnt, kbc->mmio + KBC_RPT_DLY_0); | ||
397 | |||
398 | /* Keyboard debounce count is maximum of 12 bits. */ | ||
399 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
400 | val = KBC_DEBOUNCE_CNT_SHIFT(debounce_cnt); | ||
401 | val |= KBC_FIFO_TH_CNT_SHIFT(1); /* set fifo interrupt threshold to 1 */ | ||
402 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; /* interrupt on FIFO threshold */ | ||
403 | val |= KBC_CONTROL_KBC_EN; /* enable */ | ||
404 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
405 | |||
406 | /* | ||
407 | * Compute the delay(ns) from interrupt mode to continuous polling | ||
408 | * mode so the timer routine is scheduled appropriately. | ||
409 | */ | ||
410 | val = readl(kbc->mmio + KBC_INIT_DLY_0); | ||
411 | kbc->cp_dly_jiffies = usecs_to_jiffies((val & 0xfffff) * 32); | ||
412 | |||
413 | kbc->num_pressed_keys = 0; | ||
414 | |||
415 | /* | ||
416 | * Atomically clear out any remaining entries in the key FIFO | ||
417 | * and enable keyboard interrupts. | ||
418 | */ | ||
419 | spin_lock_irqsave(&kbc->lock, flags); | ||
420 | while (1) { | ||
421 | val = readl(kbc->mmio + KBC_INT_0); | ||
422 | val >>= 4; | ||
423 | if (!val) | ||
424 | break; | ||
425 | |||
426 | val = readl(kbc->mmio + KBC_KP_ENT0_0); | ||
427 | val = readl(kbc->mmio + KBC_KP_ENT1_0); | ||
428 | } | ||
429 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
430 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
431 | |||
432 | enable_irq(kbc->irq); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static void tegra_kbc_stop(struct tegra_kbc *kbc) | ||
438 | { | ||
439 | unsigned long flags; | ||
440 | u32 val; | ||
441 | |||
442 | spin_lock_irqsave(&kbc->lock, flags); | ||
443 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
444 | val &= ~1; | ||
445 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
446 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
447 | |||
448 | disable_irq(kbc->irq); | ||
449 | del_timer_sync(&kbc->timer); | ||
450 | |||
451 | clk_disable(kbc->clk); | ||
452 | } | ||
453 | |||
454 | static int tegra_kbc_open(struct input_dev *dev) | ||
455 | { | ||
456 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
457 | |||
458 | return tegra_kbc_start(kbc); | ||
459 | } | ||
460 | |||
461 | static void tegra_kbc_close(struct input_dev *dev) | ||
462 | { | ||
463 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
464 | |||
465 | return tegra_kbc_stop(kbc); | ||
466 | } | ||
467 | |||
468 | static bool __devinit | ||
469 | tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | ||
470 | struct device *dev, unsigned int *num_rows) | ||
471 | { | ||
472 | int i; | ||
473 | |||
474 | *num_rows = 0; | ||
475 | |||
476 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
477 | const struct tegra_kbc_pin_cfg *pin_cfg = &pdata->pin_cfg[i]; | ||
478 | |||
479 | if (pin_cfg->is_row) { | ||
480 | if (pin_cfg->num >= KBC_MAX_ROW) { | ||
481 | dev_err(dev, | ||
482 | "pin_cfg[%d]: invalid row number %d\n", | ||
483 | i, pin_cfg->num); | ||
484 | return false; | ||
485 | } | ||
486 | (*num_rows)++; | ||
487 | } else { | ||
488 | if (pin_cfg->num >= KBC_MAX_COL) { | ||
489 | dev_err(dev, | ||
490 | "pin_cfg[%d]: invalid column number %d\n", | ||
491 | i, pin_cfg->num); | ||
492 | return false; | ||
493 | } | ||
494 | } | ||
495 | } | ||
496 | |||
497 | return true; | ||
498 | } | ||
499 | |||
500 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) | ||
501 | { | ||
502 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | ||
503 | const struct matrix_keymap_data *keymap_data; | ||
504 | struct tegra_kbc *kbc; | ||
505 | struct input_dev *input_dev; | ||
506 | struct resource *res; | ||
507 | int irq; | ||
508 | int err; | ||
509 | int i; | ||
510 | int num_rows = 0; | ||
511 | unsigned int debounce_cnt; | ||
512 | unsigned int scan_time_rows; | ||
513 | |||
514 | if (!pdata) | ||
515 | return -EINVAL; | ||
516 | |||
517 | if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) | ||
518 | return -EINVAL; | ||
519 | |||
520 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
521 | if (!res) { | ||
522 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | ||
523 | return -ENXIO; | ||
524 | } | ||
525 | |||
526 | irq = platform_get_irq(pdev, 0); | ||
527 | if (irq < 0) { | ||
528 | dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); | ||
529 | return -ENXIO; | ||
530 | } | ||
531 | |||
532 | kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); | ||
533 | input_dev = input_allocate_device(); | ||
534 | if (!kbc || !input_dev) { | ||
535 | err = -ENOMEM; | ||
536 | goto err_free_mem; | ||
537 | } | ||
538 | |||
539 | kbc->pdata = pdata; | ||
540 | kbc->idev = input_dev; | ||
541 | kbc->irq = irq; | ||
542 | spin_lock_init(&kbc->lock); | ||
543 | setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); | ||
544 | |||
545 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
546 | if (!res) { | ||
547 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
548 | err = -EBUSY; | ||
549 | goto err_free_mem; | ||
550 | } | ||
551 | |||
552 | kbc->mmio = ioremap(res->start, resource_size(res)); | ||
553 | if (!kbc->mmio) { | ||
554 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
555 | err = -ENXIO; | ||
556 | goto err_free_mem_region; | ||
557 | } | ||
558 | |||
559 | kbc->clk = clk_get(&pdev->dev, NULL); | ||
560 | if (IS_ERR(kbc->clk)) { | ||
561 | dev_err(&pdev->dev, "failed to get keyboard clock\n"); | ||
562 | err = PTR_ERR(kbc->clk); | ||
563 | goto err_iounmap; | ||
564 | } | ||
565 | |||
566 | kbc->wake_enable_rows = 0; | ||
567 | kbc->wake_enable_cols = 0; | ||
568 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
569 | kbc->wake_enable_rows |= (1 << pdata->wake_cfg[i].row); | ||
570 | kbc->wake_enable_cols |= (1 << pdata->wake_cfg[i].col); | ||
571 | } | ||
572 | |||
573 | /* | ||
574 | * The time delay between two consecutive reads of the FIFO is | ||
575 | * the sum of the repeat time and the time taken for scanning | ||
576 | * the rows. There is an additional delay before the row scanning | ||
577 | * starts. The repoll delay is computed in milliseconds. | ||
578 | */ | ||
579 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
580 | scan_time_rows = (KBC_ROW_SCAN_TIME + debounce_cnt) * num_rows; | ||
581 | kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt; | ||
582 | kbc->repoll_dly = ((kbc->repoll_dly * KBC_CYCLE_USEC) + 999) / 1000; | ||
583 | |||
584 | input_dev->name = pdev->name; | ||
585 | input_dev->id.bustype = BUS_HOST; | ||
586 | input_dev->dev.parent = &pdev->dev; | ||
587 | input_dev->open = tegra_kbc_open; | ||
588 | input_dev->close = tegra_kbc_close; | ||
589 | |||
590 | input_set_drvdata(input_dev, kbc); | ||
591 | |||
592 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
593 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
594 | |||
595 | input_dev->keycode = kbc->keycode; | ||
596 | input_dev->keycodesize = sizeof(kbc->keycode[0]); | ||
597 | input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); | ||
598 | |||
599 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | ||
600 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | ||
601 | input_dev->keycode, input_dev->keybit); | ||
602 | |||
603 | err = request_irq(kbc->irq, tegra_kbc_isr, IRQF_TRIGGER_HIGH, | ||
604 | pdev->name, kbc); | ||
605 | if (err) { | ||
606 | dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); | ||
607 | goto err_put_clk; | ||
608 | } | ||
609 | |||
610 | disable_irq(kbc->irq); | ||
611 | |||
612 | err = input_register_device(kbc->idev); | ||
613 | if (err) { | ||
614 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
615 | goto err_free_irq; | ||
616 | } | ||
617 | |||
618 | platform_set_drvdata(pdev, kbc); | ||
619 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
620 | |||
621 | return 0; | ||
622 | |||
623 | err_free_irq: | ||
624 | free_irq(kbc->irq, pdev); | ||
625 | err_put_clk: | ||
626 | clk_put(kbc->clk); | ||
627 | err_iounmap: | ||
628 | iounmap(kbc->mmio); | ||
629 | err_free_mem_region: | ||
630 | release_mem_region(res->start, resource_size(res)); | ||
631 | err_free_mem: | ||
632 | input_free_device(kbc->idev); | ||
633 | kfree(kbc); | ||
634 | |||
635 | return err; | ||
636 | } | ||
637 | |||
638 | static int __devexit tegra_kbc_remove(struct platform_device *pdev) | ||
639 | { | ||
640 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
641 | struct resource *res; | ||
642 | |||
643 | free_irq(kbc->irq, pdev); | ||
644 | clk_put(kbc->clk); | ||
645 | |||
646 | input_unregister_device(kbc->idev); | ||
647 | iounmap(kbc->mmio); | ||
648 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
649 | release_mem_region(res->start, resource_size(res)); | ||
650 | |||
651 | kfree(kbc); | ||
652 | |||
653 | platform_set_drvdata(pdev, NULL); | ||
654 | |||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | #ifdef CONFIG_PM_SLEEP | ||
659 | static int tegra_kbc_suspend(struct device *dev) | ||
660 | { | ||
661 | struct platform_device *pdev = to_platform_device(dev); | ||
662 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
663 | |||
664 | if (device_may_wakeup(&pdev->dev)) { | ||
665 | tegra_kbc_setup_wakekeys(kbc, true); | ||
666 | enable_irq_wake(kbc->irq); | ||
667 | /* Forcefully clear the interrupt status */ | ||
668 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
669 | msleep(30); | ||
670 | } else { | ||
671 | mutex_lock(&kbc->idev->mutex); | ||
672 | if (kbc->idev->users) | ||
673 | tegra_kbc_stop(kbc); | ||
674 | mutex_unlock(&kbc->idev->mutex); | ||
675 | } | ||
676 | |||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | static int tegra_kbc_resume(struct device *dev) | ||
681 | { | ||
682 | struct platform_device *pdev = to_platform_device(dev); | ||
683 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
684 | int err = 0; | ||
685 | |||
686 | if (device_may_wakeup(&pdev->dev)) { | ||
687 | disable_irq_wake(kbc->irq); | ||
688 | tegra_kbc_setup_wakekeys(kbc, false); | ||
689 | } else { | ||
690 | mutex_lock(&kbc->idev->mutex); | ||
691 | if (kbc->idev->users) | ||
692 | err = tegra_kbc_start(kbc); | ||
693 | mutex_unlock(&kbc->idev->mutex); | ||
694 | } | ||
695 | |||
696 | return err; | ||
697 | } | ||
698 | #endif | ||
699 | |||
700 | static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); | ||
701 | |||
702 | static struct platform_driver tegra_kbc_driver = { | ||
703 | .probe = tegra_kbc_probe, | ||
704 | .remove = __devexit_p(tegra_kbc_remove), | ||
705 | .driver = { | ||
706 | .name = "tegra-kbc", | ||
707 | .owner = THIS_MODULE, | ||
708 | .pm = &tegra_kbc_pm_ops, | ||
709 | }, | ||
710 | }; | ||
711 | |||
712 | static void __exit tegra_kbc_exit(void) | ||
713 | { | ||
714 | platform_driver_unregister(&tegra_kbc_driver); | ||
715 | } | ||
716 | module_exit(tegra_kbc_exit); | ||
717 | |||
718 | static int __init tegra_kbc_init(void) | ||
719 | { | ||
720 | return platform_driver_register(&tegra_kbc_driver); | ||
721 | } | ||
722 | module_init(tegra_kbc_init); | ||
723 | |||
724 | MODULE_LICENSE("GPL"); | ||
725 | MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); | ||
726 | MODULE_DESCRIPTION("Tegra matrix keyboard controller driver"); | ||
727 | MODULE_ALIAS("platform:tegra-kbc"); | ||
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index b4a81ebfab92..c8f097a15d89 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -219,9 +220,9 @@ static int __devinit keypad_probe(struct platform_device *pdev) | |||
219 | } | 220 | } |
220 | 221 | ||
221 | kp->clk = clk_get(dev, NULL); | 222 | kp->clk = clk_get(dev, NULL); |
222 | if (!kp->clk) { | 223 | if (IS_ERR(kp->clk)) { |
223 | dev_err(dev, "cannot claim device clock\n"); | 224 | dev_err(dev, "cannot claim device clock\n"); |
224 | error = -EINVAL; | 225 | error = PTR_ERR(kp->clk); |
225 | goto error_clk; | 226 | goto error_clk; |
226 | } | 227 | } |
227 | 228 | ||
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 9dfd6e5f786f..1f38302a5951 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -69,11 +69,7 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned | |||
69 | } | 69 | } |
70 | 70 | ||
71 | if (value > 20 && value < 32767) | 71 | if (value > 20 && value < 32767) |
72 | #ifndef FREQ | 72 | count = (IXP4XX_TIMER_FREQ / (value * 4)) - 1; |
73 | count = (ixp4xx_get_board_tick_rate() / (value * 4)) - 1; | ||
74 | #else | ||
75 | count = (FREQ / (value * 4)) - 1; | ||
76 | #endif | ||
77 | 73 | ||
78 | ixp4xx_spkr_control(pin, count); | 74 | ixp4xx_spkr_control(pin, count); |
79 | 75 | ||
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 1f8e0108962e..7e64d01da2be 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -176,7 +176,7 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
176 | 176 | ||
177 | /* request the IRQs */ | 177 | /* request the IRQs */ |
178 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, | 178 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, |
179 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, | 179 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
180 | DRV_NAME, encoder); | 180 | DRV_NAME, encoder); |
181 | if (err) { | 181 | if (err) { |
182 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 182 | dev_err(&pdev->dev, "unable to request IRQ %d\n", |
@@ -185,7 +185,7 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | err = request_irq(encoder->irq_b, &rotary_encoder_irq, | 187 | err = request_irq(encoder->irq_b, &rotary_encoder_irq, |
188 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, | 188 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
189 | DRV_NAME, encoder); | 189 | DRV_NAME, encoder); |
190 | if (err) { | 190 | if (err) { |
191 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 191 | dev_err(&pdev->dev, "unable to request IRQ %d\n", |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index da392c22fc6c..aa186cf6c514 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -755,23 +755,26 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
755 | { | 755 | { |
756 | struct synaptics_data *priv = psmouse->private; | 756 | struct synaptics_data *priv = psmouse->private; |
757 | struct synaptics_data old_priv = *priv; | 757 | struct synaptics_data old_priv = *priv; |
758 | int retry = 0; | ||
759 | int error; | ||
758 | 760 | ||
759 | psmouse_reset(psmouse); | 761 | do { |
762 | psmouse_reset(psmouse); | ||
763 | error = synaptics_detect(psmouse, 0); | ||
764 | } while (error && ++retry < 3); | ||
760 | 765 | ||
761 | if (synaptics_detect(psmouse, 0)) | 766 | if (error) |
762 | return -1; | 767 | return -1; |
763 | 768 | ||
769 | if (retry > 1) | ||
770 | printk(KERN_DEBUG "Synaptics reconnected after %d tries\n", | ||
771 | retry); | ||
772 | |||
764 | if (synaptics_query_hardware(psmouse)) { | 773 | if (synaptics_query_hardware(psmouse)) { |
765 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); | 774 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); |
766 | return -1; | 775 | return -1; |
767 | } | 776 | } |
768 | 777 | ||
769 | if (old_priv.identity != priv->identity || | ||
770 | old_priv.model_id != priv->model_id || | ||
771 | old_priv.capabilities != priv->capabilities || | ||
772 | old_priv.ext_cap != priv->ext_cap) | ||
773 | return -1; | ||
774 | |||
775 | if (synaptics_set_absolute_mode(psmouse)) { | 778 | if (synaptics_set_absolute_mode(psmouse)) { |
776 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); | 779 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); |
777 | return -1; | 780 | return -1; |
@@ -782,6 +785,19 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
782 | return -1; | 785 | return -1; |
783 | } | 786 | } |
784 | 787 | ||
788 | if (old_priv.identity != priv->identity || | ||
789 | old_priv.model_id != priv->model_id || | ||
790 | old_priv.capabilities != priv->capabilities || | ||
791 | old_priv.ext_cap != priv->ext_cap) { | ||
792 | printk(KERN_ERR "Synaptics hardware appears to be different: " | ||
793 | "id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n", | ||
794 | old_priv.identity, priv->identity, | ||
795 | old_priv.model_id, priv->model_id, | ||
796 | old_priv.capabilities, priv->capabilities, | ||
797 | old_priv.ext_cap, priv->ext_cap); | ||
798 | return -1; | ||
799 | } | ||
800 | |||
785 | return 0; | 801 | return 0; |
786 | } | 802 | } |
787 | 803 | ||
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 448c7724beb9..852816567241 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c | |||
@@ -111,9 +111,11 @@ static void ct82c710_close(struct serio *serio) | |||
111 | static int ct82c710_open(struct serio *serio) | 111 | static int ct82c710_open(struct serio *serio) |
112 | { | 112 | { |
113 | unsigned char status; | 113 | unsigned char status; |
114 | int err; | ||
114 | 115 | ||
115 | if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) | 116 | err = request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL); |
116 | return -1; | 117 | if (err) |
118 | return err; | ||
117 | 119 | ||
118 | status = inb_p(CT82C710_STATUS); | 120 | status = inb_p(CT82C710_STATUS); |
119 | 121 | ||
@@ -131,7 +133,7 @@ static int ct82c710_open(struct serio *serio) | |||
131 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); | 133 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); |
132 | outb_p(status, CT82C710_STATUS); | 134 | outb_p(status, CT82C710_STATUS); |
133 | free_irq(CT82C710_IRQ, NULL); | 135 | free_irq(CT82C710_IRQ, NULL); |
134 | return -1; | 136 | return -EBUSY; |
135 | } | 137 | } |
136 | 138 | ||
137 | return 0; | 139 | return 0; |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index db5b0bca1a1a..7c38d1fbabf2 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -188,7 +188,8 @@ static void serio_free_event(struct serio_event *event) | |||
188 | kfree(event); | 188 | kfree(event); |
189 | } | 189 | } |
190 | 190 | ||
191 | static void serio_remove_duplicate_events(struct serio_event *event) | 191 | static void serio_remove_duplicate_events(void *object, |
192 | enum serio_event_type type) | ||
192 | { | 193 | { |
193 | struct serio_event *e, *next; | 194 | struct serio_event *e, *next; |
194 | unsigned long flags; | 195 | unsigned long flags; |
@@ -196,13 +197,13 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
196 | spin_lock_irqsave(&serio_event_lock, flags); | 197 | spin_lock_irqsave(&serio_event_lock, flags); |
197 | 198 | ||
198 | list_for_each_entry_safe(e, next, &serio_event_list, node) { | 199 | list_for_each_entry_safe(e, next, &serio_event_list, node) { |
199 | if (event->object == e->object) { | 200 | if (object == e->object) { |
200 | /* | 201 | /* |
201 | * If this event is of different type we should not | 202 | * If this event is of different type we should not |
202 | * look further - we only suppress duplicate events | 203 | * look further - we only suppress duplicate events |
203 | * that were sent back-to-back. | 204 | * that were sent back-to-back. |
204 | */ | 205 | */ |
205 | if (event->type != e->type) | 206 | if (type != e->type) |
206 | break; | 207 | break; |
207 | 208 | ||
208 | list_del_init(&e->node); | 209 | list_del_init(&e->node); |
@@ -245,7 +246,7 @@ static void serio_handle_event(struct work_struct *work) | |||
245 | break; | 246 | break; |
246 | } | 247 | } |
247 | 248 | ||
248 | serio_remove_duplicate_events(event); | 249 | serio_remove_duplicate_events(event->object, event->type); |
249 | serio_free_event(event); | 250 | serio_free_event(event); |
250 | } | 251 | } |
251 | 252 | ||
@@ -436,10 +437,12 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute * | |||
436 | } else if (!strncmp(buf, "rescan", count)) { | 437 | } else if (!strncmp(buf, "rescan", count)) { |
437 | serio_disconnect_port(serio); | 438 | serio_disconnect_port(serio); |
438 | serio_find_driver(serio); | 439 | serio_find_driver(serio); |
440 | serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); | ||
439 | } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { | 441 | } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { |
440 | serio_disconnect_port(serio); | 442 | serio_disconnect_port(serio); |
441 | error = serio_bind_driver(serio, to_serio_driver(drv)); | 443 | error = serio_bind_driver(serio, to_serio_driver(drv)); |
442 | put_driver(drv); | 444 | put_driver(drv); |
445 | serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); | ||
443 | } else { | 446 | } else { |
444 | error = -EINVAL; | 447 | error = -EINVAL; |
445 | } | 448 | } |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 6e362de3f412..8755f5f3ad37 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -116,14 +116,15 @@ static void serport_ldisc_close(struct tty_struct *tty) | |||
116 | 116 | ||
117 | /* | 117 | /* |
118 | * serport_ldisc_receive() is called by the low level tty driver when characters | 118 | * serport_ldisc_receive() is called by the low level tty driver when characters |
119 | * are ready for us. We forward the characters, one by one to the 'interrupt' | 119 | * are ready for us. We forward the characters and flags, one by one to the |
120 | * routine. | 120 | * 'interrupt' routine. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) | 123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) |
124 | { | 124 | { |
125 | struct serport *serport = (struct serport*) tty->disc_data; | 125 | struct serport *serport = (struct serport*) tty->disc_data; |
126 | unsigned long flags; | 126 | unsigned long flags; |
127 | unsigned int ch_flags; | ||
127 | int i; | 128 | int i; |
128 | 129 | ||
129 | spin_lock_irqsave(&serport->lock, flags); | 130 | spin_lock_irqsave(&serport->lock, flags); |
@@ -131,8 +132,23 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c | |||
131 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) | 132 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
132 | goto out; | 133 | goto out; |
133 | 134 | ||
134 | for (i = 0; i < count; i++) | 135 | for (i = 0; i < count; i++) { |
135 | serio_interrupt(serport->serio, cp[i], 0); | 136 | switch (fp[i]) { |
137 | case TTY_FRAME: | ||
138 | ch_flags = SERIO_FRAME; | ||
139 | break; | ||
140 | |||
141 | case TTY_PARITY: | ||
142 | ch_flags = SERIO_PARITY; | ||
143 | break; | ||
144 | |||
145 | default: | ||
146 | ch_flags = 0; | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | serio_interrupt(serport->serio, cp[i], ch_flags); | ||
151 | } | ||
136 | 152 | ||
137 | out: | 153 | out: |
138 | spin_unlock_irqrestore(&serport->lock, flags); | 154 | spin_unlock_irqrestore(&serport->lock, flags); |
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index a29a7812bd46..7729e547ba65 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c | |||
@@ -201,6 +201,7 @@ int sparse_keymap_setup(struct input_dev *dev, | |||
201 | break; | 201 | break; |
202 | 202 | ||
203 | case KE_SW: | 203 | case KE_SW: |
204 | case KE_VSW: | ||
204 | __set_bit(EV_SW, dev->evbit); | 205 | __set_bit(EV_SW, dev->evbit); |
205 | __set_bit(entry->sw.code, dev->swbit); | 206 | __set_bit(entry->sw.code, dev->swbit); |
206 | break; | 207 | break; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index fc381498b798..cf8fb9f5d4a8 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -519,7 +519,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
519 | /* Retrieve the physical and logical size for OEM devices */ | 519 | /* Retrieve the physical and logical size for OEM devices */ |
520 | error = wacom_retrieve_hid_descriptor(intf, features); | 520 | error = wacom_retrieve_hid_descriptor(intf, features); |
521 | if (error) | 521 | if (error) |
522 | goto fail2; | 522 | goto fail3; |
523 | 523 | ||
524 | wacom_setup_device_quirks(features); | 524 | wacom_setup_device_quirks(features); |
525 | 525 | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 518782999fea..367fa82a607e 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1101,6 +1101,13 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static unsigned int wacom_calculate_touch_res(unsigned int logical_max, | ||
1105 | unsigned int physical_max) | ||
1106 | { | ||
1107 | /* Touch physical dimensions are in 100th of mm */ | ||
1108 | return (logical_max * 100) / physical_max; | ||
1109 | } | ||
1110 | |||
1104 | void wacom_setup_input_capabilities(struct input_dev *input_dev, | 1111 | void wacom_setup_input_capabilities(struct input_dev *input_dev, |
1105 | struct wacom_wac *wacom_wac) | 1112 | struct wacom_wac *wacom_wac) |
1106 | { | 1113 | { |
@@ -1228,8 +1235,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1228 | case TABLETPC: | 1235 | case TABLETPC: |
1229 | if (features->device_type == BTN_TOOL_DOUBLETAP || | 1236 | if (features->device_type == BTN_TOOL_DOUBLETAP || |
1230 | features->device_type == BTN_TOOL_TRIPLETAP) { | 1237 | features->device_type == BTN_TOOL_TRIPLETAP) { |
1231 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); | 1238 | input_abs_set_res(input_dev, ABS_X, |
1232 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | 1239 | wacom_calculate_touch_res(features->x_max, |
1240 | features->x_phy)); | ||
1241 | input_abs_set_res(input_dev, ABS_Y, | ||
1242 | wacom_calculate_touch_res(features->y_max, | ||
1243 | features->y_phy)); | ||
1233 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1244 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
1234 | } | 1245 | } |
1235 | 1246 | ||
@@ -1272,6 +1283,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1272 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, | 1283 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, |
1273 | 0, features->pressure_max, | 1284 | 0, features->pressure_max, |
1274 | features->pressure_fuzz, 0); | 1285 | features->pressure_fuzz, 0); |
1286 | input_abs_set_res(input_dev, ABS_X, | ||
1287 | wacom_calculate_touch_res(features->x_max, | ||
1288 | features->x_phy)); | ||
1289 | input_abs_set_res(input_dev, ABS_Y, | ||
1290 | wacom_calculate_touch_res(features->y_max, | ||
1291 | features->y_phy)); | ||
1275 | } else if (features->device_type == BTN_TOOL_PEN) { | 1292 | } else if (features->device_type == BTN_TOOL_PEN) { |
1276 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1293 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1277 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1294 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
@@ -1426,6 +1443,10 @@ static struct wacom_features wacom_features_0xD3 = | |||
1426 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1443 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1427 | static const struct wacom_features wacom_features_0xD4 = | 1444 | static const struct wacom_features wacom_features_0xD4 = |
1428 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; | 1445 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; |
1446 | static struct wacom_features wacom_features_0xD6 = | ||
1447 | { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1448 | static struct wacom_features wacom_features_0xD7 = | ||
1449 | { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1429 | static struct wacom_features wacom_features_0xD8 = | 1450 | static struct wacom_features wacom_features_0xD8 = |
1430 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1451 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1431 | static struct wacom_features wacom_features_0xDA = | 1452 | static struct wacom_features wacom_features_0xDA = |
@@ -1507,6 +1528,8 @@ const struct usb_device_id wacom_ids[] = { | |||
1507 | { USB_DEVICE_WACOM(0xD2) }, | 1528 | { USB_DEVICE_WACOM(0xD2) }, |
1508 | { USB_DEVICE_WACOM(0xD3) }, | 1529 | { USB_DEVICE_WACOM(0xD3) }, |
1509 | { USB_DEVICE_WACOM(0xD4) }, | 1530 | { USB_DEVICE_WACOM(0xD4) }, |
1531 | { USB_DEVICE_WACOM(0xD6) }, | ||
1532 | { USB_DEVICE_WACOM(0xD7) }, | ||
1510 | { USB_DEVICE_WACOM(0xD8) }, | 1533 | { USB_DEVICE_WACOM(0xD8) }, |
1511 | { USB_DEVICE_WACOM(0xDA) }, | 1534 | { USB_DEVICE_WACOM(0xDA) }, |
1512 | { USB_DEVICE_WACOM(0xDB) }, | 1535 | { USB_DEVICE_WACOM(0xDB) }, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 14ea54b78e46..4bf2316e3284 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -941,28 +941,29 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 | |||
941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; | 941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; |
942 | int err; | 942 | int err; |
943 | 943 | ||
944 | /* REVISIT when the irq can be triggered active-low, or if for some | 944 | /* |
945 | * REVISIT when the irq can be triggered active-low, or if for some | ||
945 | * reason the touchscreen isn't hooked up, we don't need to access | 946 | * reason the touchscreen isn't hooked up, we don't need to access |
946 | * the pendown state. | 947 | * the pendown state. |
947 | */ | 948 | */ |
948 | if (!pdata->get_pendown_state && !gpio_is_valid(pdata->gpio_pendown)) { | ||
949 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
950 | return -EINVAL; | ||
951 | } | ||
952 | 949 | ||
953 | if (pdata->get_pendown_state) { | 950 | if (pdata->get_pendown_state) { |
954 | ts->get_pendown_state = pdata->get_pendown_state; | 951 | ts->get_pendown_state = pdata->get_pendown_state; |
955 | return 0; | 952 | } else if (gpio_is_valid(pdata->gpio_pendown)) { |
956 | } | ||
957 | 953 | ||
958 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); | 954 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); |
959 | if (err) { | 955 | if (err) { |
960 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", | 956 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", |
961 | pdata->gpio_pendown); | 957 | pdata->gpio_pendown); |
962 | return err; | 958 | return err; |
963 | } | 959 | } |
964 | 960 | ||
965 | ts->gpio_pendown = pdata->gpio_pendown; | 961 | ts->gpio_pendown = pdata->gpio_pendown; |
962 | |||
963 | } else { | ||
964 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
965 | return -EINVAL; | ||
966 | } | ||
966 | 967 | ||
967 | return 0; | 968 | return 0; |
968 | } | 969 | } |
@@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1353 | err_put_regulator: | 1354 | err_put_regulator: |
1354 | regulator_put(ts->reg); | 1355 | regulator_put(ts->reg); |
1355 | err_free_gpio: | 1356 | err_free_gpio: |
1356 | if (ts->gpio_pendown != -1) | 1357 | if (!ts->get_pendown_state) |
1357 | gpio_free(ts->gpio_pendown); | 1358 | gpio_free(ts->gpio_pendown); |
1358 | err_cleanup_filter: | 1359 | err_cleanup_filter: |
1359 | if (ts->filter_cleanup) | 1360 | if (ts->filter_cleanup) |
@@ -1383,8 +1384,13 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
1383 | regulator_disable(ts->reg); | 1384 | regulator_disable(ts->reg); |
1384 | regulator_put(ts->reg); | 1385 | regulator_put(ts->reg); |
1385 | 1386 | ||
1386 | if (ts->gpio_pendown != -1) | 1387 | if (!ts->get_pendown_state) { |
1388 | /* | ||
1389 | * If we are not using specialized pendown method we must | ||
1390 | * have been relying on gpio we set up ourselves. | ||
1391 | */ | ||
1387 | gpio_free(ts->gpio_pendown); | 1392 | gpio_free(ts->gpio_pendown); |
1393 | } | ||
1388 | 1394 | ||
1389 | if (ts->filter_cleanup) | 1395 | if (ts->filter_cleanup) |
1390 | ts->filter_cleanup(ts->filter_data); | 1396 | ts->filter_cleanup(ts->filter_data); |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f7fa9ef4cd65..1507ce108d5b 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/input.h> | 12 | #include <linux/input.h> |
13 | #include <linux/input/bu21013.h> | 13 | #include <linux/input/bu21013.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/regulator/consumer.h> | ||
15 | 16 | ||
16 | #define PEN_DOWN_INTR 0 | 17 | #define PEN_DOWN_INTR 0 |
17 | #define MAX_FINGERS 2 | 18 | #define MAX_FINGERS 2 |
@@ -139,6 +140,7 @@ | |||
139 | * @chip: pointer to the touch panel controller | 140 | * @chip: pointer to the touch panel controller |
140 | * @in_dev: pointer to the input device structure | 141 | * @in_dev: pointer to the input device structure |
141 | * @intr_pin: interrupt pin value | 142 | * @intr_pin: interrupt pin value |
143 | * @regulator: pointer to the Regulator used for touch screen | ||
142 | * | 144 | * |
143 | * Touch panel device data structure | 145 | * Touch panel device data structure |
144 | */ | 146 | */ |
@@ -149,6 +151,7 @@ struct bu21013_ts_data { | |||
149 | const struct bu21013_platform_device *chip; | 151 | const struct bu21013_platform_device *chip; |
150 | struct input_dev *in_dev; | 152 | struct input_dev *in_dev; |
151 | unsigned int intr_pin; | 153 | unsigned int intr_pin; |
154 | struct regulator *regulator; | ||
152 | }; | 155 | }; |
153 | 156 | ||
154 | /** | 157 | /** |
@@ -456,6 +459,20 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
456 | bu21013_data->in_dev = in_dev; | 459 | bu21013_data->in_dev = in_dev; |
457 | bu21013_data->chip = pdata; | 460 | bu21013_data->chip = pdata; |
458 | bu21013_data->client = client; | 461 | bu21013_data->client = client; |
462 | |||
463 | bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); | ||
464 | if (IS_ERR(bu21013_data->regulator)) { | ||
465 | dev_err(&client->dev, "regulator_get failed\n"); | ||
466 | error = PTR_ERR(bu21013_data->regulator); | ||
467 | goto err_free_mem; | ||
468 | } | ||
469 | |||
470 | error = regulator_enable(bu21013_data->regulator); | ||
471 | if (error < 0) { | ||
472 | dev_err(&client->dev, "regulator enable failed\n"); | ||
473 | goto err_put_regulator; | ||
474 | } | ||
475 | |||
459 | bu21013_data->touch_stopped = false; | 476 | bu21013_data->touch_stopped = false; |
460 | init_waitqueue_head(&bu21013_data->wait); | 477 | init_waitqueue_head(&bu21013_data->wait); |
461 | 478 | ||
@@ -464,7 +481,7 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
464 | error = pdata->cs_en(pdata->cs_pin); | 481 | error = pdata->cs_en(pdata->cs_pin); |
465 | if (error < 0) { | 482 | if (error < 0) { |
466 | dev_err(&client->dev, "chip init failed\n"); | 483 | dev_err(&client->dev, "chip init failed\n"); |
467 | goto err_free_mem; | 484 | goto err_disable_regulator; |
468 | } | 485 | } |
469 | } | 486 | } |
470 | 487 | ||
@@ -485,9 +502,9 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
485 | __set_bit(EV_ABS, in_dev->evbit); | 502 | __set_bit(EV_ABS, in_dev->evbit); |
486 | 503 | ||
487 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, | 504 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, |
488 | pdata->x_max_res, 0, 0); | 505 | pdata->touch_x_max, 0, 0); |
489 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, | 506 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, |
490 | pdata->y_max_res, 0, 0); | 507 | pdata->touch_y_max, 0, 0); |
491 | input_set_drvdata(in_dev, bu21013_data); | 508 | input_set_drvdata(in_dev, bu21013_data); |
492 | 509 | ||
493 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 510 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
@@ -513,6 +530,10 @@ err_free_irq: | |||
513 | bu21013_free_irq(bu21013_data); | 530 | bu21013_free_irq(bu21013_data); |
514 | err_cs_disable: | 531 | err_cs_disable: |
515 | pdata->cs_dis(pdata->cs_pin); | 532 | pdata->cs_dis(pdata->cs_pin); |
533 | err_disable_regulator: | ||
534 | regulator_disable(bu21013_data->regulator); | ||
535 | err_put_regulator: | ||
536 | regulator_put(bu21013_data->regulator); | ||
516 | err_free_mem: | 537 | err_free_mem: |
517 | input_free_device(in_dev); | 538 | input_free_device(in_dev); |
518 | kfree(bu21013_data); | 539 | kfree(bu21013_data); |
@@ -535,6 +556,10 @@ static int __devexit bu21013_remove(struct i2c_client *client) | |||
535 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); | 556 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); |
536 | 557 | ||
537 | input_unregister_device(bu21013_data->in_dev); | 558 | input_unregister_device(bu21013_data->in_dev); |
559 | |||
560 | regulator_disable(bu21013_data->regulator); | ||
561 | regulator_put(bu21013_data->regulator); | ||
562 | |||
538 | kfree(bu21013_data); | 563 | kfree(bu21013_data); |
539 | 564 | ||
540 | device_init_wakeup(&client->dev, false); | 565 | device_init_wakeup(&client->dev, false); |
@@ -561,6 +586,8 @@ static int bu21013_suspend(struct device *dev) | |||
561 | else | 586 | else |
562 | disable_irq(bu21013_data->chip->irq); | 587 | disable_irq(bu21013_data->chip->irq); |
563 | 588 | ||
589 | regulator_disable(bu21013_data->regulator); | ||
590 | |||
564 | return 0; | 591 | return 0; |
565 | } | 592 | } |
566 | 593 | ||
@@ -577,6 +604,12 @@ static int bu21013_resume(struct device *dev) | |||
577 | struct i2c_client *client = bu21013_data->client; | 604 | struct i2c_client *client = bu21013_data->client; |
578 | int retval; | 605 | int retval; |
579 | 606 | ||
607 | retval = regulator_enable(bu21013_data->regulator); | ||
608 | if (retval < 0) { | ||
609 | dev_err(&client->dev, "bu21013 regulator enable failed\n"); | ||
610 | return retval; | ||
611 | } | ||
612 | |||
580 | retval = bu21013_init_chip(bu21013_data); | 613 | retval = bu21013_init_chip(bu21013_data); |
581 | if (retval < 0) { | 614 | if (retval < 0) { |
582 | dev_err(&client->dev, "bu21013 controller config failed\n"); | 615 | dev_err(&client->dev, "bu21013 controller config failed\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index cf1dba2e267c..22a3411e93c5 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -289,9 +290,9 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
289 | } | 290 | } |
290 | 291 | ||
291 | ts->clk = clk_get(dev, NULL); | 292 | ts->clk = clk_get(dev, NULL); |
292 | if (!ts->clk) { | 293 | if (IS_ERR(ts->clk)) { |
293 | dev_err(dev, "cannot claim device clock\n"); | 294 | dev_err(dev, "cannot claim device clock\n"); |
294 | error = -EINVAL; | 295 | error = PTR_ERR(ts->clk); |
295 | goto error_clk; | 296 | goto error_clk; |
296 | } | 297 | } |
297 | 298 | ||
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449c909d..c14412ef4648 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
@@ -51,6 +51,10 @@ MODULE_LICENSE("GPL"); | |||
51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ | 51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ |
52 | #define W8001_PKTLEN_TOUCH2FG 13 | 52 | #define W8001_PKTLEN_TOUCH2FG 13 |
53 | 53 | ||
54 | /* resolution in points/mm */ | ||
55 | #define W8001_PEN_RESOLUTION 100 | ||
56 | #define W8001_TOUCH_RESOLUTION 10 | ||
57 | |||
54 | struct w8001_coord { | 58 | struct w8001_coord { |
55 | u8 rdy; | 59 | u8 rdy; |
56 | u8 tsw; | 60 | u8 tsw; |
@@ -198,7 +202,7 @@ static void parse_touchquery(u8 *data, struct w8001_touch_query *query) | |||
198 | query->y = 1024; | 202 | query->y = 1024; |
199 | if (query->panel_res) | 203 | if (query->panel_res) |
200 | query->x = query->y = (1 << query->panel_res); | 204 | query->x = query->y = (1 << query->panel_res); |
201 | query->panel_res = 10; | 205 | query->panel_res = W8001_TOUCH_RESOLUTION; |
202 | } | 206 | } |
203 | } | 207 | } |
204 | 208 | ||
@@ -394,6 +398,8 @@ static int w8001_setup(struct w8001 *w8001) | |||
394 | 398 | ||
395 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); | 399 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); |
396 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); | 400 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); |
401 | input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); | ||
402 | input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); | ||
397 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); | 403 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); |
398 | if (coord.tilt_x && coord.tilt_y) { | 404 | if (coord.tilt_x && coord.tilt_y) { |
399 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); | 405 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); |
@@ -418,14 +424,17 @@ static int w8001_setup(struct w8001 *w8001) | |||
418 | w8001->max_touch_x = touch.x; | 424 | w8001->max_touch_x = touch.x; |
419 | w8001->max_touch_y = touch.y; | 425 | w8001->max_touch_y = touch.y; |
420 | 426 | ||
421 | /* scale to pen maximum */ | ||
422 | if (w8001->max_pen_x && w8001->max_pen_y) { | 427 | if (w8001->max_pen_x && w8001->max_pen_y) { |
428 | /* if pen is supported scale to pen maximum */ | ||
423 | touch.x = w8001->max_pen_x; | 429 | touch.x = w8001->max_pen_x; |
424 | touch.y = w8001->max_pen_y; | 430 | touch.y = w8001->max_pen_y; |
431 | touch.panel_res = W8001_PEN_RESOLUTION; | ||
425 | } | 432 | } |
426 | 433 | ||
427 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); | 434 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); |
428 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); | 435 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); |
436 | input_abs_set_res(dev, ABS_X, touch.panel_res); | ||
437 | input_abs_set_res(dev, ABS_Y, touch.panel_res); | ||
429 | 438 | ||
430 | switch (touch.sensor_id) { | 439 | switch (touch.sensor_id) { |
431 | case 0: | 440 | case 0: |