aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 22:56:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 22:56:58 -0400
commit14738e03312ff1137109d68bcbf103c738af0f4a (patch)
tree11d123823ec212973f0a9149b0da8ced1c8b8e33
parent45471cd98decae5fced8b38e46c223f54a924814 (diff)
parentf7ebc4dcdeb1be7209d94a8c0dc602ab24e36ae1 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov: "Thanks to Samuel Thibault input device (keyboard) LEDs are no longer hardwired within the input core but use LED subsystem and so allow use of different triggers; Hans de Goede did a large update for the ALPS touchpad driver; we have new TI drv2665 haptics driver and DA9063 OnKey driver, and host of other drivers got various fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (55 commits) Input: pixcir_i2c_ts - fix receive error MAINTAINERS: remove non existent input mt git tree Input: improve usage of gpiod API tty/vt/keyboard: define LED triggers for VT keyboard lock states tty/vt/keyboard: define LED triggers for VT LED states Input: export LEDs as class devices in sysfs Input: cyttsp4 - use swap() in cyttsp4_get_touch() Input: goodix - do not explicitly set evbits in input device Input: goodix - export id and version read from device Input: goodix - fix variable length array warning Input: goodix - fix alignment issues Input: add OnKey driver for DA9063 MFD part Input: elan_i2c - add product IDs FW names Input: elan_i2c - add support for multi IC type and iap format Input: focaltech - report finger width to userspace tty: remove platform_sysrq_reset_seq Input: synaptics_i2c - use proper boolean values Input: psmouse - use true instead of 1 for boolean values Input: cyapa - fix a few typos in comments Input: stmpe-ts - enforce device tree only mode ...
-rw-r--r--Documentation/devicetree/bindings/i2c/trivial-devices.txt3
-rw-r--r--Documentation/devicetree/bindings/input/ti,drv2665.txt17
-rw-r--r--Documentation/leds/leds-class.txt3
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/input/Kconfig13
-rw-r--r--drivers/input/Makefile1
-rw-r--r--drivers/input/evdev.c5
-rw-r--r--drivers/input/ff-core.c4
-rw-r--r--drivers/input/input-leds.c212
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/input/keyboard/Kconfig1
-rw-r--r--drivers/input/keyboard/adp5589-keys.c6
-rw-r--r--drivers/input/keyboard/clps711x-keypad.c7
-rw-r--r--drivers/input/keyboard/max7359_keypad.c31
-rw-r--r--drivers/input/keyboard/samsung-keypad.c2
-rw-r--r--drivers/input/keyboard/spear-keyboard.c2
-rw-r--r--drivers/input/misc/Kconfig23
-rw-r--r--drivers/input/misc/Makefile2
-rw-r--r--drivers/input/misc/adxl34x-i2c.c21
-rw-r--r--drivers/input/misc/da9063_onkey.c226
-rw-r--r--drivers/input/misc/drv260x.c13
-rw-r--r--drivers/input/misc/drv2665.c322
-rw-r--r--drivers/input/misc/gpio-beeper.c7
-rw-r--r--drivers/input/misc/retu-pwrbutton.c3
-rw-r--r--drivers/input/misc/soc_button_array.c1
-rw-r--r--drivers/input/misc/twl4030-pwrbutton.c3
-rw-r--r--drivers/input/misc/twl6040-vibra.c3
-rw-r--r--drivers/input/misc/wm831x-on.c3
-rw-r--r--drivers/input/mouse/alps.c244
-rw-r--r--drivers/input/mouse/alps.h1
-rw-r--r--drivers/input/mouse/cyapa_gen3.c3
-rw-r--r--drivers/input/mouse/cyapa_gen5.c23
-rw-r--r--drivers/input/mouse/elan_i2c.h8
-rw-r--r--drivers/input/mouse/elan_i2c_core.c63
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c4
-rw-r--r--drivers/input/mouse/elan_i2c_smbus.c6
-rw-r--r--drivers/input/mouse/focaltech.c13
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mouse/sentelic.h4
-rw-r--r--drivers/input/mouse/synaptics_i2c.c6
-rw-r--r--drivers/input/touchscreen/Kconfig1
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c8
-rw-r--r--drivers/input/touchscreen/cyttsp4_core.c5
-rw-r--r--drivers/input/touchscreen/goodix.c58
-rw-r--r--drivers/input/touchscreen/pixcir_i2c_ts.c2
-rw-r--r--drivers/input/touchscreen/s3c2410_ts.c2
-rw-r--r--drivers/input/touchscreen/stmpe-ts.c37
-rw-r--r--drivers/input/touchscreen/zforce_ts.c1
-rw-r--r--drivers/leds/Kconfig3
-rw-r--r--drivers/tty/sysrq.c19
-rw-r--r--drivers/tty/vt/keyboard.c156
-rw-r--r--include/linux/mfd/da9063/pdata.h1
-rw-r--r--include/linux/mfd/stmpe.h44
-rw-r--r--include/linux/platform_data/keyboard-spear.h2
54 files changed, 1278 insertions, 375 deletions
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index ad0c4ac916dd..00f8652e193a 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -19,8 +19,7 @@ adi,adt7475 +/-1C TDM Extended Temp Range I.C
19adi,adt7476 +/-1C TDM Extended Temp Range I.C 19adi,adt7476 +/-1C TDM Extended Temp Range I.C
20adi,adt7490 +/-1C TDM Extended Temp Range I.C 20adi,adt7490 +/-1C TDM Extended Temp Range I.C
21adi,adxl345 Three-Axis Digital Accelerometer 21adi,adxl345 Three-Axis Digital Accelerometer
22adi,adxl346 Three-Axis Digital Accelerometer 22adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too)
23adi,adxl34x Three-Axis Digital Accelerometer
24at,24c08 i2c serial eeprom (24cxx) 23at,24c08 i2c serial eeprom (24cxx)
25atmel,24c00 i2c serial eeprom (24cxx) 24atmel,24c00 i2c serial eeprom (24cxx)
26atmel,24c01 i2c serial eeprom (24cxx) 25atmel,24c01 i2c serial eeprom (24cxx)
diff --git a/Documentation/devicetree/bindings/input/ti,drv2665.txt b/Documentation/devicetree/bindings/input/ti,drv2665.txt
new file mode 100644
index 000000000000..1ba97ac04305
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/ti,drv2665.txt
@@ -0,0 +1,17 @@
1* Texas Instruments - drv2665 Haptics driver
2
3Required properties:
4 - compatible - "ti,drv2665" - DRV2665
5 - reg - I2C slave address
6 - vbat-supply - Required supply regulator
7
8Example:
9
10haptics: haptics@59 {
11 compatible = "ti,drv2665";
12 reg = <0x59>;
13 vbat-supply = <&vbat>;
14};
15
16For more product information please see the link below:
17http://www.ti.com/product/drv2665
diff --git a/Documentation/leds/leds-class.txt b/Documentation/leds/leds-class.txt
index 79699c200766..62261c04060a 100644
--- a/Documentation/leds/leds-class.txt
+++ b/Documentation/leds/leds-class.txt
@@ -2,9 +2,6 @@
2LED handling under Linux 2LED handling under Linux
3======================== 3========================
4 4
5If you're reading this and thinking about keyboard leds, these are
6handled by the input subsystem and the led class is *not* needed.
7
8In its simplest form, the LED class just allows control of LEDs from 5In its simplest form, the LED class just allows control of LEDs from
9userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the 6userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the
10LED is defined in max_brightness file. The brightness file will set the brightness 7LED is defined in max_brightness file. The brightness file will set the brightness
diff --git a/MAINTAINERS b/MAINTAINERS
index d7c53502aa86..246d9d841ad2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5171,7 +5171,6 @@ F: include/linux/input/
5171INPUT MULTITOUCH (MT) PROTOCOL 5171INPUT MULTITOUCH (MT) PROTOCOL
5172M: Henrik Rydberg <rydberg@bitmath.org> 5172M: Henrik Rydberg <rydberg@bitmath.org>
5173L: linux-input@vger.kernel.org 5173L: linux-input@vger.kernel.org
5174T: git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git
5175S: Odd fixes 5174S: Odd fixes
5176F: Documentation/input/multi-touch-protocol.txt 5175F: Documentation/input/multi-touch-protocol.txt
5177F: drivers/input/input-mt.c 5176F: drivers/input/input-mt.c
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index a11ff74a5127..a35532ec00e4 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -25,6 +25,19 @@ config INPUT
25 25
26if INPUT 26if INPUT
27 27
28config INPUT_LEDS
29 tristate "Export input device LEDs in sysfs"
30 depends on LEDS_CLASS
31 default INPUT
32 help
33 Say Y here if you would like to export LEDs on input devices
34 as standard LED class devices in sysfs.
35
36 If unsure, say Y.
37
38 To compile this driver as a module, choose M here: the
39 module will be called input-leds.
40
28config INPUT_FF_MEMLESS 41config INPUT_FF_MEMLESS
29 tristate "Support for memoryless force-feedback devices" 42 tristate "Support for memoryless force-feedback devices"
30 help 43 help
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 5ca3f631497f..0c9302ca9954 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
12obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o 12obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o
13obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o 13obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o
14 14
15obj-$(CONFIG_INPUT_LEDS) += input-leds.o
15obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o 16obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
16obj-$(CONFIG_INPUT_JOYDEV) += joydev.o 17obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
17obj-$(CONFIG_INPUT_EVDEV) += evdev.o 18obj-$(CONFIG_INPUT_EVDEV) += evdev.o
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a18f41b89b6a..9d35499faca4 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -422,10 +422,7 @@ static int evdev_release(struct inode *inode, struct file *file)
422 422
423 evdev_detach_client(evdev, client); 423 evdev_detach_client(evdev, client);
424 424
425 if (is_vmalloc_addr(client)) 425 kvfree(client);
426 vfree(client);
427 else
428 kfree(client);
429 426
430 evdev_close_device(evdev); 427 evdev_close_device(evdev);
431 428
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index b81c88c43452..8f4a30fccbb6 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -70,7 +70,7 @@ static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
70 return -EINVAL; 70 return -EINVAL;
71 71
72 /* 72 /*
73 * calculate manginude of sine wave as average of rumble's 73 * calculate magnitude of sine wave as average of rumble's
74 * 2/3 of strong magnitude and 1/3 of weak magnitude 74 * 2/3 of strong magnitude and 1/3 of weak magnitude
75 */ 75 */
76 magnitude = effect->u.rumble.strong_magnitude / 3 + 76 magnitude = effect->u.rumble.strong_magnitude / 3 +
@@ -213,7 +213,7 @@ static int erase_effect(struct input_dev *dev, int effect_id,
213/** 213/**
214 * input_ff_erase - erase a force-feedback effect from device 214 * input_ff_erase - erase a force-feedback effect from device
215 * @dev: input device to erase effect from 215 * @dev: input device to erase effect from
216 * @effect_id: id of the ffect to be erased 216 * @effect_id: id of the effect to be erased
217 * @file: purported owner of the request 217 * @file: purported owner of the request
218 * 218 *
219 * This function erases a force-feedback effect from specified device. 219 * This function erases a force-feedback effect from specified device.
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c
new file mode 100644
index 000000000000..074a65ed17bb
--- /dev/null
+++ b/drivers/input/input-leds.c
@@ -0,0 +1,212 @@
1/*
2 * LED support for the input layer
3 *
4 * Copyright 2010-2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/leds.h>
16#include <linux/input.h>
17
18#if IS_ENABLED(CONFIG_VT)
19#define VT_TRIGGER(_name) .trigger = _name
20#else
21#define VT_TRIGGER(_name) .trigger = NULL
22#endif
23
24static const struct {
25 const char *name;
26 const char *trigger;
27} input_led_info[LED_CNT] = {
28 [LED_NUML] = { "numlock", VT_TRIGGER("kbd-numlock") },
29 [LED_CAPSL] = { "capslock", VT_TRIGGER("kbd-capslock") },
30 [LED_SCROLLL] = { "scrolllock", VT_TRIGGER("kbd-scrolllock") },
31 [LED_COMPOSE] = { "compose" },
32 [LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") },
33 [LED_SLEEP] = { "sleep" } ,
34 [LED_SUSPEND] = { "suspend" },
35 [LED_MUTE] = { "mute" },
36 [LED_MISC] = { "misc" },
37 [LED_MAIL] = { "mail" },
38 [LED_CHARGING] = { "charging" },
39};
40
41struct input_led {
42 struct led_classdev cdev;
43 struct input_handle *handle;
44 unsigned int code; /* One of LED_* constants */
45};
46
47struct input_leds {
48 struct input_handle handle;
49 unsigned int num_leds;
50 struct input_led leds[];
51};
52
53static enum led_brightness input_leds_brightness_get(struct led_classdev *cdev)
54{
55 struct input_led *led = container_of(cdev, struct input_led, cdev);
56 struct input_dev *input = led->handle->dev;
57
58 return test_bit(led->code, input->led) ? cdev->max_brightness : 0;
59}
60
61static void input_leds_brightness_set(struct led_classdev *cdev,
62 enum led_brightness brightness)
63{
64 struct input_led *led = container_of(cdev, struct input_led, cdev);
65
66 input_inject_event(led->handle, EV_LED, led->code, !!brightness);
67}
68
69static void input_leds_event(struct input_handle *handle, unsigned int type,
70 unsigned int code, int value)
71{
72}
73
74static int input_leds_connect(struct input_handler *handler,
75 struct input_dev *dev,
76 const struct input_device_id *id)
77{
78 struct input_leds *leds;
79 unsigned int num_leds;
80 unsigned int led_code;
81 int led_no;
82 int error;
83
84 num_leds = bitmap_weight(dev->ledbit, LED_CNT);
85 if (!num_leds)
86 return -ENXIO;
87
88 leds = kzalloc(sizeof(*leds) + num_leds * sizeof(*leds->leds),
89 GFP_KERNEL);
90 if (!leds)
91 return -ENOMEM;
92
93 leds->num_leds = num_leds;
94
95 leds->handle.dev = dev;
96 leds->handle.handler = handler;
97 leds->handle.name = "leds";
98 leds->handle.private = leds;
99
100 error = input_register_handle(&leds->handle);
101 if (error)
102 goto err_free_mem;
103
104 error = input_open_device(&leds->handle);
105 if (error)
106 goto err_unregister_handle;
107
108 led_no = 0;
109 for_each_set_bit(led_code, dev->ledbit, LED_CNT) {
110 struct input_led *led = &leds->leds[led_no];
111
112 led->handle = &leds->handle;
113 led->code = led_code;
114
115 if (WARN_ON(!input_led_info[led_code].name))
116 continue;
117
118 led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
119 dev_name(&dev->dev),
120 input_led_info[led_code].name);
121 if (!led->cdev.name) {
122 error = -ENOMEM;
123 goto err_unregister_leds;
124 }
125
126 led->cdev.max_brightness = 1;
127 led->cdev.brightness_get = input_leds_brightness_get;
128 led->cdev.brightness_set = input_leds_brightness_set;
129 led->cdev.default_trigger = input_led_info[led_code].trigger;
130
131 error = led_classdev_register(&dev->dev, &led->cdev);
132 if (error) {
133 dev_err(&dev->dev, "failed to register LED %s: %d\n",
134 led->cdev.name, error);
135 kfree(led->cdev.name);
136 goto err_unregister_leds;
137 }
138
139 led_no++;
140 }
141
142 return 0;
143
144err_unregister_leds:
145 while (--led_no >= 0) {
146 struct input_led *led = &leds->leds[led_no];
147
148 led_classdev_unregister(&led->cdev);
149 kfree(led->cdev.name);
150 }
151
152 input_close_device(&leds->handle);
153
154err_unregister_handle:
155 input_unregister_handle(&leds->handle);
156
157err_free_mem:
158 kfree(leds);
159 return error;
160}
161
162static void input_leds_disconnect(struct input_handle *handle)
163{
164 struct input_leds *leds = handle->private;
165 int i;
166
167 for (i = 0; i < leds->num_leds; i++) {
168 struct input_led *led = &leds->leds[i];
169
170 led_classdev_unregister(&led->cdev);
171 kfree(led->cdev.name);
172 }
173
174 input_close_device(handle);
175 input_unregister_handle(handle);
176
177 kfree(leds);
178}
179
180static const struct input_device_id input_leds_ids[] = {
181 {
182 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
183 .evbit = { BIT_MASK(EV_LED) },
184 },
185 { },
186};
187MODULE_DEVICE_TABLE(input, input_leds_ids);
188
189static struct input_handler input_leds_handler = {
190 .event = input_leds_event,
191 .connect = input_leds_connect,
192 .disconnect = input_leds_disconnect,
193 .name = "leds",
194 .id_table = input_leds_ids,
195};
196
197static int __init input_leds_init(void)
198{
199 return input_register_handler(&input_leds_handler);
200}
201module_init(input_leds_init);
202
203static void __exit input_leds_exit(void)
204{
205 input_unregister_handler(&input_leds_handler);
206}
207module_exit(input_leds_exit);
208
209MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>");
210MODULE_AUTHOR("Dmitry Torokhov <dmitry.torokhov@gmail.com>");
211MODULE_DESCRIPTION("Input -> LEDs Bridge");
212MODULE_LICENSE("GPL v2");
diff --git a/drivers/input/input.c b/drivers/input/input.c
index cc357f1516a7..f31578423636 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2262,7 +2262,7 @@ EXPORT_SYMBOL(input_unregister_handler);
2262 * 2262 *
2263 * Iterate over @bus's list of devices, and call @fn for each, passing 2263 * Iterate over @bus's list of devices, and call @fn for each, passing
2264 * it @data and stop when @fn returns a non-zero value. The function is 2264 * it @data and stop when @fn returns a non-zero value. The function is
2265 * using RCU to traverse the list and therefore may be usind in atonic 2265 * using RCU to traverse the list and therefore may be using in atomic
2266 * contexts. The @fn callback is invoked from RCU critical section and 2266 * contexts. The @fn callback is invoked from RCU critical section and
2267 * thus must not sleep. 2267 * thus must not sleep.
2268 */ 2268 */
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index e8eb60c6d83e..4cd94fd6cbad 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -367,6 +367,7 @@ config KEYBOARD_MAPLE
367 367
368config KEYBOARD_MAX7359 368config KEYBOARD_MAX7359
369 tristate "Maxim MAX7359 Key Switch Controller" 369 tristate "Maxim MAX7359 Key Switch Controller"
370 select INPUT_MATRIXKMAP
370 depends on I2C 371 depends on I2C
371 help 372 help
372 If you say yes here you get support for the Maxim MAX7359 Key 373 If you say yes here you get support for the Maxim MAX7359 Key
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index a45267729dfc..6ed83cf8b74e 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -180,7 +180,7 @@
180#define LOGIC2_STAT (1 << 7) /* ADP5589 only */ 180#define LOGIC2_STAT (1 << 7) /* ADP5589 only */
181#define LOGIC1_STAT (1 << 6) 181#define LOGIC1_STAT (1 << 6)
182#define LOCK_STAT (1 << 5) /* ADP5589 only */ 182#define LOCK_STAT (1 << 5) /* ADP5589 only */
183#define KEC 0xF 183#define KEC 0x1F
184 184
185/* PIN_CONFIG_D Register */ 185/* PIN_CONFIG_D Register */
186#define C4_EXTEND_CFG (1 << 6) /* RESET2 */ 186#define C4_EXTEND_CFG (1 << 6) /* RESET2 */
@@ -726,7 +726,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
726 726
727 pull_mask |= val << (2 * (i & 0x3)); 727 pull_mask |= val << (2 * (i & 0x3));
728 728
729 if (i == 3 || i == kpad->var->max_row_num) { 729 if (i % 4 == 3 || i == kpad->var->max_row_num) {
730 ret |= adp5589_write(client, reg(ADP5585_RPULL_CONFIG_A) 730 ret |= adp5589_write(client, reg(ADP5585_RPULL_CONFIG_A)
731 + (i >> 2), pull_mask); 731 + (i >> 2), pull_mask);
732 pull_mask = 0; 732 pull_mask = 0;
@@ -746,7 +746,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
746 746
747 pull_mask |= val << (2 * (i & 0x3)); 747 pull_mask |= val << (2 * (i & 0x3));
748 748
749 if (i == 3 || i == kpad->var->max_col_num) { 749 if (i % 4 == 3 || i == kpad->var->max_col_num) {
750 ret |= adp5589_write(client, 750 ret |= adp5589_write(client,
751 reg(ADP5585_RPULL_CONFIG_C) + 751 reg(ADP5585_RPULL_CONFIG_C) +
752 (i >> 2), pull_mask); 752 (i >> 2), pull_mask);
diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c
index 27ef29f8fe6a..b637f1af842e 100644
--- a/drivers/input/keyboard/clps711x-keypad.c
+++ b/drivers/input/keyboard/clps711x-keypad.c
@@ -120,14 +120,9 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
120 for (i = 0; i < priv->row_count; i++) { 120 for (i = 0; i < priv->row_count; i++) {
121 struct clps711x_gpio_data *data = &priv->gpio_data[i]; 121 struct clps711x_gpio_data *data = &priv->gpio_data[i];
122 122
123 data->desc = devm_gpiod_get_index(dev, "row", i); 123 data->desc = devm_gpiod_get_index(dev, "row", i, GPIOD_IN);
124 if (!data->desc)
125 return -EINVAL;
126
127 if (IS_ERR(data->desc)) 124 if (IS_ERR(data->desc))
128 return PTR_ERR(data->desc); 125 return PTR_ERR(data->desc);
129
130 gpiod_direction_input(data->desc);
131 } 126 }
132 127
133 err = of_property_read_u32(np, "poll-interval", &poll_interval); 128 err = of_property_read_u32(np, "poll-interval", &poll_interval);
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index faa6da53eba8..5091133b7b8e 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -84,26 +84,6 @@ static int max7359_read_reg(struct i2c_client *client, int reg)
84 return ret; 84 return ret;
85} 85}
86 86
87static void max7359_build_keycode(struct max7359_keypad *keypad,
88 const struct matrix_keymap_data *keymap_data)
89{
90 struct input_dev *input_dev = keypad->input_dev;
91 int i;
92
93 for (i = 0; i < keymap_data->keymap_size; i++) {
94 unsigned int key = keymap_data->keymap[i];
95 unsigned int row = KEY_ROW(key);
96 unsigned int col = KEY_COL(key);
97 unsigned int scancode = MATRIX_SCAN_CODE(row, col,
98 MAX7359_ROW_SHIFT);
99 unsigned short keycode = KEY_VAL(key);
100
101 keypad->keycodes[scancode] = keycode;
102 __set_bit(keycode, input_dev->keybit);
103 }
104 __clear_bit(KEY_RESERVED, input_dev->keybit);
105}
106
107/* runs in an IRQ thread -- can (and will!) sleep */ 87/* runs in an IRQ thread -- can (and will!) sleep */
108static irqreturn_t max7359_interrupt(int irq, void *dev_id) 88static irqreturn_t max7359_interrupt(int irq, void *dev_id)
109{ 89{
@@ -166,7 +146,6 @@ static void max7359_close(struct input_dev *dev)
166static void max7359_initialize(struct i2c_client *client) 146static void max7359_initialize(struct i2c_client *client)
167{ 147{
168 max7359_write_reg(client, MAX7359_REG_CONFIG, 148 max7359_write_reg(client, MAX7359_REG_CONFIG,
169 MAX7359_CFG_INTERRUPT | /* Irq clears after host read */
170 MAX7359_CFG_KEY_RELEASE | /* Key release enable */ 149 MAX7359_CFG_KEY_RELEASE | /* Key release enable */
171 MAX7359_CFG_WAKEUP); /* Key press wakeup enable */ 150 MAX7359_CFG_WAKEUP); /* Key press wakeup enable */
172 151
@@ -233,7 +212,15 @@ static int max7359_probe(struct i2c_client *client,
233 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 212 input_set_capability(input_dev, EV_MSC, MSC_SCAN);
234 input_set_drvdata(input_dev, keypad); 213 input_set_drvdata(input_dev, keypad);
235 214
236 max7359_build_keycode(keypad, keymap_data); 215 error = matrix_keypad_build_keymap(keymap_data, NULL,
216 MAX7359_MAX_KEY_ROWS,
217 MAX7359_MAX_KEY_COLS,
218 keypad->keycodes,
219 input_dev);
220 if (error) {
221 dev_err(&client->dev, "failed to build keymap\n");
222 return error;
223 }
237 224
238 error = devm_request_threaded_irq(&client->dev, client->irq, NULL, 225 error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
239 max7359_interrupt, 226 max7359_interrupt,
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 6b9fdf6cf8e8..43e48dac7687 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -585,7 +585,7 @@ static const struct of_device_id samsung_keypad_dt_match[] = {
585MODULE_DEVICE_TABLE(of, samsung_keypad_dt_match); 585MODULE_DEVICE_TABLE(of, samsung_keypad_dt_match);
586#endif 586#endif
587 587
588static struct platform_device_id samsung_keypad_driver_ids[] = { 588static const struct platform_device_id samsung_keypad_driver_ids[] = {
589 { 589 {
590 .name = "samsung-keypad", 590 .name = "samsung-keypad",
591 .driver_data = KEYPAD_TYPE_SAMSUNG, 591 .driver_data = KEYPAD_TYPE_SAMSUNG,
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index f42a543db043..623d451767e3 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -3,7 +3,7 @@
3 * Based on omap-keypad driver 3 * Based on omap-keypad driver
4 * 4 *
5 * Copyright (C) 2010 ST Microelectronics 5 * Copyright (C) 2010 ST Microelectronics
6 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 6 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 4436ab1b9735..d4f0a817e858 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -610,6 +610,16 @@ config INPUT_DA9055_ONKEY
610 To compile this driver as a module, choose M here: the module 610 To compile this driver as a module, choose M here: the module
611 will be called da9055_onkey. 611 will be called da9055_onkey.
612 612
613config INPUT_DA9063_ONKEY
614 tristate "Dialog DA9063 OnKey"
615 depends on MFD_DA9063
616 help
617 Support the ONKEY of Dialog DA9063 Power Management IC as an
618 input device reporting power button statue.
619
620 To compile this driver as a module, choose M here: the module
621 will be called da9063_onkey.
622
613config INPUT_DM355EVM 623config INPUT_DM355EVM
614 tristate "TI DaVinci DM355 EVM Keypad and IR Remote" 624 tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
615 depends on MFD_DM355EVM_MSP 625 depends on MFD_DM355EVM_MSP
@@ -775,6 +785,17 @@ config INPUT_DRV260X_HAPTICS
775 To compile this driver as a module, choose M here: the 785 To compile this driver as a module, choose M here: the
776 module will be called drv260x-haptics. 786 module will be called drv260x-haptics.
777 787
788config INPUT_DRV2665_HAPTICS
789 tristate "TI DRV2665 haptics support"
790 depends on INPUT && I2C
791 select INPUT_FF_MEMLESS
792 select REGMAP_I2C
793 help
794 Say Y to enable support for the TI DRV2665 haptics driver.
795
796 To compile this driver as a module, choose M here: the
797 module will be called drv2665-haptics.
798
778config INPUT_DRV2667_HAPTICS 799config INPUT_DRV2667_HAPTICS
779 tristate "TI DRV2667 haptics support" 800 tristate "TI DRV2667 haptics support"
780 depends on INPUT && I2C 801 depends on INPUT && I2C
@@ -784,6 +805,6 @@ config INPUT_DRV2667_HAPTICS
784 Say Y to enable support for the TI DRV2667 haptics driver. 805 Say Y to enable support for the TI DRV2667 haptics driver.
785 806
786 To compile this driver as a module, choose M here: the 807 To compile this driver as a module, choose M here: the
787 module will be called drv260x-haptics. 808 module will be called drv2667-haptics.
788 809
789endif 810endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 78ba4c1b8532..53df07dcc23c 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -25,9 +25,11 @@ obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o
25obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o 25obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o
26obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o 26obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o
27obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o 27obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o
28obj-$(CONFIG_INPUT_DA9063_ONKEY) += da9063_onkey.o
28obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o 29obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
29obj-$(CONFIG_INPUT_E3X0_BUTTON) += e3x0-button.o 30obj-$(CONFIG_INPUT_E3X0_BUTTON) += e3x0-button.o
30obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o 31obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o
32obj-$(CONFIG_INPUT_DRV2665_HAPTICS) += drv2665.o
31obj-$(CONFIG_INPUT_DRV2667_HAPTICS) += drv2667.o 33obj-$(CONFIG_INPUT_DRV2667_HAPTICS) += drv2667.o
32obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o 34obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o
33obj-$(CONFIG_INPUT_GPIO_BEEPER) += gpio-beeper.o 35obj-$(CONFIG_INPUT_GPIO_BEEPER) += gpio-beeper.o
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
index 470bfd6f0830..bdb5d03b296e 100644
--- a/drivers/input/misc/adxl34x-i2c.c
+++ b/drivers/input/misc/adxl34x-i2c.c
@@ -10,6 +10,7 @@
10#include <linux/input.h> /* BUS_I2C */ 10#include <linux/input.h> /* BUS_I2C */
11#include <linux/i2c.h> 11#include <linux/i2c.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/of.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <linux/pm.h> 15#include <linux/pm.h>
15#include "adxl34x.h" 16#include "adxl34x.h"
@@ -135,11 +136,31 @@ static const struct i2c_device_id adxl34x_id[] = {
135 136
136MODULE_DEVICE_TABLE(i2c, adxl34x_id); 137MODULE_DEVICE_TABLE(i2c, adxl34x_id);
137 138
139#ifdef CONFIG_OF
140static const struct of_device_id adxl34x_of_id[] = {
141 /*
142 * The ADXL346 is backward-compatible with the ADXL345. Differences are
143 * handled by runtime detection of the device model, there's thus no
144 * need for listing the "adi,adxl346" compatible value explicitly.
145 */
146 { .compatible = "adi,adxl345", },
147 /*
148 * Deprecated, DT nodes should use one or more of the device-specific
149 * compatible values "adi,adxl345" and "adi,adxl346".
150 */
151 { .compatible = "adi,adxl34x", },
152 { }
153};
154
155MODULE_DEVICE_TABLE(of, adxl34x_of_id);
156#endif
157
138static struct i2c_driver adxl34x_driver = { 158static struct i2c_driver adxl34x_driver = {
139 .driver = { 159 .driver = {
140 .name = "adxl34x", 160 .name = "adxl34x",
141 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
142 .pm = &adxl34x_i2c_pm, 162 .pm = &adxl34x_i2c_pm,
163 .of_match_table = of_match_ptr(adxl34x_of_id),
143 }, 164 },
144 .probe = adxl34x_i2c_probe, 165 .probe = adxl34x_i2c_probe,
145 .remove = adxl34x_i2c_remove, 166 .remove = adxl34x_i2c_remove,
diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
new file mode 100644
index 000000000000..f577585ef999
--- /dev/null
+++ b/drivers/input/misc/da9063_onkey.c
@@ -0,0 +1,226 @@
1/*
2 * OnKey device driver for DA9063
3 * Copyright (C) 2015 Dialog Semiconductor Ltd.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/module.h>
17#include <linux/errno.h>
18#include <linux/input.h>
19#include <linux/interrupt.h>
20#include <linux/platform_device.h>
21#include <linux/workqueue.h>
22#include <linux/regmap.h>
23#include <linux/of.h>
24#include <linux/mfd/da9063/core.h>
25#include <linux/mfd/da9063/pdata.h>
26#include <linux/mfd/da9063/registers.h>
27
28struct da9063_onkey {
29 struct da9063 *hw;
30 struct delayed_work work;
31 struct input_dev *input;
32 struct device *dev;
33 bool key_power;
34};
35
36static void da9063_poll_on(struct work_struct *work)
37{
38 struct da9063_onkey *onkey = container_of(work, struct da9063_onkey,
39 work.work);
40 unsigned int val;
41 int fault_log = 0;
42 bool poll = true;
43 int error;
44
45 /* Poll to see when the pin is released */
46 error = regmap_read(onkey->hw->regmap, DA9063_REG_STATUS_A, &val);
47 if (error) {
48 dev_err(onkey->dev,
49 "Failed to read ON status: %d\n", error);
50 goto err_poll;
51 }
52
53 if (!(val & DA9063_NONKEY)) {
54 error = regmap_update_bits(onkey->hw->regmap,
55 DA9063_REG_CONTROL_B,
56 DA9063_NONKEY_LOCK, 0);
57 if (error) {
58 dev_err(onkey->dev,
59 "Failed to reset the Key Delay %d\n", error);
60 goto err_poll;
61 }
62
63 input_report_key(onkey->input, KEY_POWER, 0);
64 input_sync(onkey->input);
65
66 poll = false;
67 }
68
69 /*
70 * If the fault log KEY_RESET is detected, then clear it
71 * and shut down the system.
72 */
73 error = regmap_read(onkey->hw->regmap,
74 DA9063_REG_FAULT_LOG, &fault_log);
75 if (error) {
76 dev_warn(&onkey->input->dev,
77 "Cannot read FAULT_LOG: %d\n", error);
78 } else if (fault_log & DA9063_KEY_RESET) {
79 error = regmap_write(onkey->hw->regmap,
80 DA9063_REG_FAULT_LOG,
81 DA9063_KEY_RESET);
82 if (error) {
83 dev_warn(&onkey->input->dev,
84 "Cannot reset KEY_RESET fault log: %d\n",
85 error);
86 } else {
87 /* at this point we do any S/W housekeeping
88 * and then send shutdown command
89 */
90 dev_dbg(&onkey->input->dev,
91 "Sending SHUTDOWN to DA9063 ...\n");
92 error = regmap_write(onkey->hw->regmap,
93 DA9063_REG_CONTROL_F,
94 DA9063_SHUTDOWN);
95 if (error)
96 dev_err(&onkey->input->dev,
97 "Cannot SHUTDOWN DA9063: %d\n",
98 error);
99 }
100 }
101
102err_poll:
103 if (poll)
104 schedule_delayed_work(&onkey->work, msecs_to_jiffies(50));
105}
106
107static irqreturn_t da9063_onkey_irq_handler(int irq, void *data)
108{
109 struct da9063_onkey *onkey = data;
110 unsigned int val;
111 int error;
112
113 error = regmap_read(onkey->hw->regmap, DA9063_REG_STATUS_A, &val);
114 if (onkey->key_power && !error && (val & DA9063_NONKEY)) {
115 input_report_key(onkey->input, KEY_POWER, 1);
116 input_sync(onkey->input);
117 schedule_delayed_work(&onkey->work, 0);
118 dev_dbg(onkey->dev, "KEY_POWER pressed.\n");
119 } else {
120 input_report_key(onkey->input, KEY_SLEEP, 1);
121 input_sync(onkey->input);
122 input_report_key(onkey->input, KEY_SLEEP, 0);
123 input_sync(onkey->input);
124 dev_dbg(onkey->dev, "KEY_SLEEP pressed.\n");
125 }
126
127 return IRQ_HANDLED;
128}
129
130static void da9063_cancel_poll(void *data)
131{
132 struct da9063_onkey *onkey = data;
133
134 cancel_delayed_work_sync(&onkey->work);
135}
136
137static int da9063_onkey_probe(struct platform_device *pdev)
138{
139 struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
140 struct da9063_pdata *pdata = dev_get_platdata(da9063->dev);
141 struct da9063_onkey *onkey;
142 int irq;
143 int error;
144
145 onkey = devm_kzalloc(&pdev->dev, sizeof(struct da9063_onkey),
146 GFP_KERNEL);
147 if (!onkey) {
148 dev_err(&pdev->dev, "Failed to allocate memory.\n");
149 return -ENOMEM;
150 }
151
152 onkey->dev = &pdev->dev;
153 onkey->hw = da9063;
154
155 if (pdata)
156 onkey->key_power = pdata->key_power;
157 else
158 onkey->key_power =
159 !of_property_read_bool(pdev->dev.of_node,
160 "dlg,disable-key-power");
161
162 onkey->input = devm_input_allocate_device(&pdev->dev);
163 if (!onkey->input) {
164 dev_err(&pdev->dev, "Failed to allocated input device.\n");
165 return -ENOMEM;
166 }
167
168 onkey->input->name = DA9063_DRVNAME_ONKEY;
169 onkey->input->phys = DA9063_DRVNAME_ONKEY "/input0";
170 onkey->input->dev.parent = &pdev->dev;
171
172 if (onkey->key_power)
173 input_set_capability(onkey->input, EV_KEY, KEY_POWER);
174
175 input_set_capability(onkey->input, EV_KEY, KEY_SLEEP);
176
177 INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
178
179 error = devm_add_action(&pdev->dev, da9063_cancel_poll, onkey);
180 if (error) {
181 dev_err(&pdev->dev,
182 "Failed to add cancel poll action: %d\n",
183 error);
184 return error;
185 }
186
187 irq = platform_get_irq_byname(pdev, "ONKEY");
188 if (irq < 0) {
189 error = irq;
190 dev_err(&pdev->dev, "Failed to get platform IRQ: %d\n", error);
191 return error;
192 }
193
194 error = devm_request_threaded_irq(&pdev->dev, irq,
195 NULL, da9063_onkey_irq_handler,
196 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
197 "ONKEY", onkey);
198 if (error) {
199 dev_err(&pdev->dev,
200 "Failed to request IRQ %d: %d\n", irq, error);
201 return error;
202 }
203
204 error = input_register_device(onkey->input);
205 if (error) {
206 dev_err(&pdev->dev,
207 "Failed to register input device: %d\n", error);
208 return error;
209 }
210
211 platform_set_drvdata(pdev, onkey);
212 return 0;
213}
214
215static struct platform_driver da9063_onkey_driver = {
216 .probe = da9063_onkey_probe,
217 .driver = {
218 .name = DA9063_DRVNAME_ONKEY,
219 },
220};
221module_platform_driver(da9063_onkey_driver);
222
223MODULE_AUTHOR("S Twiss <stwiss.opensource@diasemi.com>");
224MODULE_DESCRIPTION("Onkey device driver for Dialog DA9063");
225MODULE_LICENSE("GPL");
226MODULE_ALIAS("platform:" DA9063_DRVNAME_ONKEY);
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 599578042ea0..e5d60ecd29a4 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -580,15 +580,10 @@ static int drv260x_probe(struct i2c_client *client,
580 return error; 580 return error;
581 } 581 }
582 582
583 haptics->enable_gpio = devm_gpiod_get(&client->dev, "enable"); 583 haptics->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable",
584 if (IS_ERR(haptics->enable_gpio)) { 584 GPIOD_OUT_HIGH);
585 error = PTR_ERR(haptics->enable_gpio); 585 if (IS_ERR(haptics->enable_gpio))
586 if (error != -ENOENT && error != -ENOSYS) 586 return PTR_ERR(haptics->enable_gpio);
587 return error;
588 haptics->enable_gpio = NULL;
589 } else {
590 gpiod_direction_output(haptics->enable_gpio, 1);
591 }
592 587
593 haptics->input_dev = devm_input_allocate_device(&client->dev); 588 haptics->input_dev = devm_input_allocate_device(&client->dev);
594 if (!haptics->input_dev) { 589 if (!haptics->input_dev) {
diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c
new file mode 100644
index 000000000000..0afaa33de07d
--- /dev/null
+++ b/drivers/input/misc/drv2665.c
@@ -0,0 +1,322 @@
1/*
2 * DRV2665 haptics driver family
3 *
4 * Author: Dan Murphy <dmurphy@ti.com>
5 *
6 * Copyright: (C) 2015 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#include <linux/i2c.h>
19#include <linux/input.h>
20#include <linux/module.h>
21#include <linux/regmap.h>
22#include <linux/slab.h>
23#include <linux/delay.h>
24#include <linux/regulator/consumer.h>
25
26/* Contol registers */
27#define DRV2665_STATUS 0x00
28#define DRV2665_CTRL_1 0x01
29#define DRV2665_CTRL_2 0x02
30#define DRV2665_FIFO 0x0b
31
32/* Status Register */
33#define DRV2665_FIFO_FULL BIT(0)
34#define DRV2665_FIFO_EMPTY BIT(1)
35
36/* Control 1 Register */
37#define DRV2665_25_VPP_GAIN 0x00
38#define DRV2665_50_VPP_GAIN 0x01
39#define DRV2665_75_VPP_GAIN 0x02
40#define DRV2665_100_VPP_GAIN 0x03
41#define DRV2665_DIGITAL_IN 0xfc
42#define DRV2665_ANALOG_IN BIT(2)
43
44/* Control 2 Register */
45#define DRV2665_BOOST_EN BIT(1)
46#define DRV2665_STANDBY BIT(6)
47#define DRV2665_DEV_RST BIT(7)
48#define DRV2665_5_MS_IDLE_TOUT 0x00
49#define DRV2665_10_MS_IDLE_TOUT 0x04
50#define DRV2665_15_MS_IDLE_TOUT 0x08
51#define DRV2665_20_MS_IDLE_TOUT 0x0c
52
53/**
54 * struct drv2665_data -
55 * @input_dev - Pointer to the input device
56 * @client - Pointer to the I2C client
57 * @regmap - Register map of the device
58 * @work - Work item used to off load the enable/disable of the vibration
59 * @regulator - Pointer to the regulator for the IC
60 */
61struct drv2665_data {
62 struct input_dev *input_dev;
63 struct i2c_client *client;
64 struct regmap *regmap;
65 struct work_struct work;
66 struct regulator *regulator;
67};
68
69/* 8kHz Sine wave to stream to the FIFO */
70static const u8 drv2665_sine_wave_form[] = {
71 0x00, 0x10, 0x20, 0x2e, 0x3c, 0x48, 0x53, 0x5b, 0x61, 0x65, 0x66,
72 0x65, 0x61, 0x5b, 0x53, 0x48, 0x3c, 0x2e, 0x20, 0x10,
73 0x00, 0xf0, 0xe0, 0xd2, 0xc4, 0xb8, 0xad, 0xa5, 0x9f, 0x9b, 0x9a,
74 0x9b, 0x9f, 0xa5, 0xad, 0xb8, 0xc4, 0xd2, 0xe0, 0xf0, 0x00,
75};
76
77static struct reg_default drv2665_reg_defs[] = {
78 { DRV2665_STATUS, 0x02 },
79 { DRV2665_CTRL_1, 0x28 },
80 { DRV2665_CTRL_2, 0x40 },
81 { DRV2665_FIFO, 0x00 },
82};
83
84static void drv2665_worker(struct work_struct *work)
85{
86 struct drv2665_data *haptics =
87 container_of(work, struct drv2665_data, work);
88 unsigned int read_buf;
89 int error;
90
91 error = regmap_read(haptics->regmap, DRV2665_STATUS, &read_buf);
92 if (error) {
93 dev_err(&haptics->client->dev,
94 "Failed to read status: %d\n", error);
95 return;
96 }
97
98 if (read_buf & DRV2665_FIFO_EMPTY) {
99 error = regmap_bulk_write(haptics->regmap,
100 DRV2665_FIFO,
101 drv2665_sine_wave_form,
102 ARRAY_SIZE(drv2665_sine_wave_form));
103 if (error) {
104 dev_err(&haptics->client->dev,
105 "Failed to write FIFO: %d\n", error);
106 return;
107 }
108 }
109}
110
111static int drv2665_haptics_play(struct input_dev *input, void *data,
112 struct ff_effect *effect)
113{
114 struct drv2665_data *haptics = input_get_drvdata(input);
115
116 schedule_work(&haptics->work);
117
118 return 0;
119}
120
121static void drv2665_close(struct input_dev *input)
122{
123 struct drv2665_data *haptics = input_get_drvdata(input);
124 int error;
125
126 cancel_work_sync(&haptics->work);
127
128 error = regmap_update_bits(haptics->regmap,
129 DRV2665_CTRL_2, DRV2665_STANDBY, 1);
130 if (error)
131 dev_err(&haptics->client->dev,
132 "Failed to enter standby mode: %d\n", error);
133}
134
135static const struct reg_default drv2665_init_regs[] = {
136 { DRV2665_CTRL_2, 0 | DRV2665_10_MS_IDLE_TOUT },
137 { DRV2665_CTRL_1, DRV2665_25_VPP_GAIN },
138};
139
140static int drv2665_init(struct drv2665_data *haptics)
141{
142 int error;
143
144 error = regmap_register_patch(haptics->regmap,
145 drv2665_init_regs,
146 ARRAY_SIZE(drv2665_init_regs));
147 if (error) {
148 dev_err(&haptics->client->dev,
149 "Failed to write init registers: %d\n",
150 error);
151 return error;
152 }
153
154 return 0;
155}
156
157static const struct regmap_config drv2665_regmap_config = {
158 .reg_bits = 8,
159 .val_bits = 8,
160
161 .max_register = DRV2665_FIFO,
162 .reg_defaults = drv2665_reg_defs,
163 .num_reg_defaults = ARRAY_SIZE(drv2665_reg_defs),
164 .cache_type = REGCACHE_NONE,
165};
166
167static int drv2665_probe(struct i2c_client *client,
168 const struct i2c_device_id *id)
169{
170 struct drv2665_data *haptics;
171 int error;
172
173 haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL);
174 if (!haptics)
175 return -ENOMEM;
176
177 haptics->regulator = devm_regulator_get(&client->dev, "vbat");
178 if (IS_ERR(haptics->regulator)) {
179 error = PTR_ERR(haptics->regulator);
180 dev_err(&client->dev,
181 "unable to get regulator, error: %d\n", error);
182 return error;
183 }
184
185 haptics->input_dev = devm_input_allocate_device(&client->dev);
186 if (!haptics->input_dev) {
187 dev_err(&client->dev, "Failed to allocate input device\n");
188 return -ENOMEM;
189 }
190
191 haptics->input_dev->name = "drv2665:haptics";
192 haptics->input_dev->dev.parent = client->dev.parent;
193 haptics->input_dev->close = drv2665_close;
194 input_set_drvdata(haptics->input_dev, haptics);
195 input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE);
196
197 error = input_ff_create_memless(haptics->input_dev, NULL,
198 drv2665_haptics_play);
199 if (error) {
200 dev_err(&client->dev, "input_ff_create() failed: %d\n",
201 error);
202 return error;
203 }
204
205 INIT_WORK(&haptics->work, drv2665_worker);
206
207 haptics->client = client;
208 i2c_set_clientdata(client, haptics);
209
210 haptics->regmap = devm_regmap_init_i2c(client, &drv2665_regmap_config);
211 if (IS_ERR(haptics->regmap)) {
212 error = PTR_ERR(haptics->regmap);
213 dev_err(&client->dev, "Failed to allocate register map: %d\n",
214 error);
215 return error;
216 }
217
218 error = drv2665_init(haptics);
219 if (error) {
220 dev_err(&client->dev, "Device init failed: %d\n", error);
221 return error;
222 }
223
224 error = input_register_device(haptics->input_dev);
225 if (error) {
226 dev_err(&client->dev, "couldn't register input device: %d\n",
227 error);
228 return error;
229 }
230
231 return 0;
232}
233
234static int __maybe_unused drv2665_suspend(struct device *dev)
235{
236 struct drv2665_data *haptics = dev_get_drvdata(dev);
237 int ret = 0;
238
239 mutex_lock(&haptics->input_dev->mutex);
240
241 if (haptics->input_dev->users) {
242 ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2,
243 DRV2665_STANDBY, 1);
244 if (ret) {
245 dev_err(dev, "Failed to set standby mode\n");
246 regulator_disable(haptics->regulator);
247 goto out;
248 }
249
250 ret = regulator_disable(haptics->regulator);
251 if (ret) {
252 dev_err(dev, "Failed to disable regulator\n");
253 regmap_update_bits(haptics->regmap,
254 DRV2665_CTRL_2,
255 DRV2665_STANDBY, 0);
256 }
257 }
258out:
259 mutex_unlock(&haptics->input_dev->mutex);
260 return ret;
261}
262
263static int __maybe_unused drv2665_resume(struct device *dev)
264{
265 struct drv2665_data *haptics = dev_get_drvdata(dev);
266 int ret = 0;
267
268 mutex_lock(&haptics->input_dev->mutex);
269
270 if (haptics->input_dev->users) {
271 ret = regulator_enable(haptics->regulator);
272 if (ret) {
273 dev_err(dev, "Failed to enable regulator\n");
274 goto out;
275 }
276
277 ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2,
278 DRV2665_STANDBY, 0);
279 if (ret) {
280 dev_err(dev, "Failed to unset standby mode\n");
281 regulator_disable(haptics->regulator);
282 goto out;
283 }
284
285 }
286
287out:
288 mutex_unlock(&haptics->input_dev->mutex);
289 return ret;
290}
291
292static SIMPLE_DEV_PM_OPS(drv2665_pm_ops, drv2665_suspend, drv2665_resume);
293
294static const struct i2c_device_id drv2665_id[] = {
295 { "drv2665", 0 },
296 { }
297};
298MODULE_DEVICE_TABLE(i2c, drv2665_id);
299
300#ifdef CONFIG_OF
301static const struct of_device_id drv2665_of_match[] = {
302 { .compatible = "ti,drv2665", },
303 { }
304};
305MODULE_DEVICE_TABLE(of, drv2665_of_match);
306#endif
307
308static struct i2c_driver drv2665_driver = {
309 .probe = drv2665_probe,
310 .driver = {
311 .name = "drv2665-haptics",
312 .owner = THIS_MODULE,
313 .of_match_table = of_match_ptr(drv2665_of_match),
314 .pm = &drv2665_pm_ops,
315 },
316 .id_table = drv2665_id,
317};
318module_i2c_driver(drv2665_driver);
319
320MODULE_DESCRIPTION("TI DRV2665 haptics driver");
321MODULE_LICENSE("GPL");
322MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com>");
diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c
index 4817c5f0c3e4..16272fffeb7e 100644
--- a/drivers/input/misc/gpio-beeper.c
+++ b/drivers/input/misc/gpio-beeper.c
@@ -66,13 +66,12 @@ static int gpio_beeper_probe(struct platform_device *pdev)
66{ 66{
67 struct gpio_beeper *beep; 67 struct gpio_beeper *beep;
68 struct input_dev *input; 68 struct input_dev *input;
69 int err;
70 69
71 beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL); 70 beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
72 if (!beep) 71 if (!beep)
73 return -ENOMEM; 72 return -ENOMEM;
74 73
75 beep->desc = devm_gpiod_get(&pdev->dev, NULL); 74 beep->desc = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW);
76 if (IS_ERR(beep->desc)) 75 if (IS_ERR(beep->desc))
77 return PTR_ERR(beep->desc); 76 return PTR_ERR(beep->desc);
78 77
@@ -92,10 +91,6 @@ static int gpio_beeper_probe(struct platform_device *pdev)
92 91
93 input_set_capability(input, EV_SND, SND_BELL); 92 input_set_capability(input, EV_SND, SND_BELL);
94 93
95 err = gpiod_direction_output(beep->desc, 0);
96 if (err)
97 return err;
98
99 input_set_drvdata(input, beep); 94 input_set_drvdata(input, beep);
100 95
101 return input_register_device(input); 96 return input_register_device(input);
diff --git a/drivers/input/misc/retu-pwrbutton.c b/drivers/input/misc/retu-pwrbutton.c
index 0c8ac60e2639..30b459b6b344 100644
--- a/drivers/input/misc/retu-pwrbutton.c
+++ b/drivers/input/misc/retu-pwrbutton.c
@@ -63,7 +63,8 @@ static int retu_pwrbutton_probe(struct platform_device *pdev)
63 input_set_drvdata(idev, rdev); 63 input_set_drvdata(idev, rdev);
64 64
65 error = devm_request_threaded_irq(&pdev->dev, irq, 65 error = devm_request_threaded_irq(&pdev->dev, irq,
66 NULL, retu_pwrbutton_irq, 0, 66 NULL, retu_pwrbutton_irq,
67 IRQF_ONESHOT,
67 "retu-pwrbutton", idev); 68 "retu-pwrbutton", idev);
68 if (error) 69 if (error)
69 return error; 70 return error;
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index e8e010a85484..c14b82709b0f 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -18,7 +18,6 @@
18#include <linux/gpio/consumer.h> 18#include <linux/gpio/consumer.h>
19#include <linux/gpio_keys.h> 19#include <linux/gpio_keys.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/acpi.h>
22 21
23/* 22/*
24 * Definition of buttons on the tablet. The ACPI index of each button 23 * Definition of buttons on the tablet. The ACPI index of each button
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index e98cc81a84c6..603fc2fadf05 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -71,7 +71,8 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
71 pwr->dev.parent = &pdev->dev; 71 pwr->dev.parent = &pdev->dev;
72 72
73 err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq, 73 err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
74 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 74 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
75 IRQF_ONESHOT,
75 "twl4030_pwrbutton", pwr); 76 "twl4030_pwrbutton", pwr);
76 if (err < 0) { 77 if (err < 0) {
77 dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err); 78 dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 0e0d094df2e6..ea63fad48de6 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -308,7 +308,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
308 mutex_init(&info->mutex); 308 mutex_init(&info->mutex);
309 309
310 error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, 310 error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
311 twl6040_vib_irq_handler, 0, 311 twl6040_vib_irq_handler,
312 IRQF_ONESHOT,
312 "twl6040_irq_vib", info); 313 "twl6040_irq_vib", info);
313 if (error) { 314 if (error) {
314 dev_err(info->dev, "VIB IRQ request failed: %d\n", error); 315 dev_err(info->dev, "VIB IRQ request failed: %d\n", error);
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index 59d4f7bcb4a3..1b44de265a0a 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -99,7 +99,8 @@ static int wm831x_on_probe(struct platform_device *pdev)
99 wm831x_on->dev->dev.parent = &pdev->dev; 99 wm831x_on->dev->dev.parent = &pdev->dev;
100 100
101 ret = request_threaded_irq(irq, NULL, wm831x_on_irq, 101 ret = request_threaded_irq(irq, NULL, wm831x_on_irq,
102 IRQF_TRIGGER_RISING, "wm831x_on", 102 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
103 "wm831x_on",
103 wm831x_on); 104 wm831x_on);
104 if (ret < 0) { 105 if (ret < 0) {
105 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret); 106 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index a353b7de6d22..113d6f1516a5 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -159,8 +159,8 @@ static const struct alps_protocol_info alps_v8_protocol_data = {
159 159
160static void alps_set_abs_params_st(struct alps_data *priv, 160static void alps_set_abs_params_st(struct alps_data *priv,
161 struct input_dev *dev1); 161 struct input_dev *dev1);
162static void alps_set_abs_params_mt(struct alps_data *priv, 162static void alps_set_abs_params_semi_mt(struct alps_data *priv,
163 struct input_dev *dev1); 163 struct input_dev *dev1);
164static void alps_set_abs_params_v7(struct alps_data *priv, 164static void alps_set_abs_params_v7(struct alps_data *priv,
165 struct input_dev *dev1); 165 struct input_dev *dev1);
166static void alps_set_abs_params_ss4_v2(struct alps_data *priv, 166static void alps_set_abs_params_ss4_v2(struct alps_data *priv,
@@ -310,53 +310,6 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse)
310 input_sync(dev); 310 input_sync(dev);
311} 311}
312 312
313/*
314 * Process bitmap data for V5 protocols. Return value is null.
315 *
316 * The bitmaps don't have enough data to track fingers, so this function
317 * only generates points representing a bounding box of at most two contacts.
318 * These two points are returned in fields->mt.
319 */
320static void alps_process_bitmap_dolphin(struct alps_data *priv,
321 struct alps_fields *fields)
322{
323 int box_middle_x, box_middle_y;
324 unsigned int x_map, y_map;
325 unsigned char start_bit, end_bit;
326 unsigned char x_msb, x_lsb, y_msb, y_lsb;
327
328 x_map = fields->x_map;
329 y_map = fields->y_map;
330
331 if (!x_map || !y_map)
332 return;
333
334 /* Get Most-significant and Least-significant bit */
335 x_msb = fls(x_map);
336 x_lsb = ffs(x_map);
337 y_msb = fls(y_map);
338 y_lsb = ffs(y_map);
339
340 /* Most-significant bit should never exceed max sensor line number */
341 if (x_msb > priv->x_bits || y_msb > priv->y_bits)
342 return;
343
344 if (fields->fingers > 1) {
345 start_bit = priv->x_bits - x_msb;
346 end_bit = priv->x_bits - x_lsb;
347 box_middle_x = (priv->x_max * (start_bit + end_bit)) /
348 (2 * (priv->x_bits - 1));
349
350 start_bit = y_lsb - 1;
351 end_bit = y_msb - 1;
352 box_middle_y = (priv->y_max * (start_bit + end_bit)) /
353 (2 * (priv->y_bits - 1));
354 fields->mt[0] = fields->st;
355 fields->mt[1].x = 2 * box_middle_x - fields->mt[0].x;
356 fields->mt[1].y = 2 * box_middle_y - fields->mt[0].y;
357 }
358}
359
360static void alps_get_bitmap_points(unsigned int map, 313static void alps_get_bitmap_points(unsigned int map,
361 struct alps_bitmap_point *low, 314 struct alps_bitmap_point *low,
362 struct alps_bitmap_point *high, 315 struct alps_bitmap_point *high,
@@ -384,7 +337,7 @@ static void alps_get_bitmap_points(unsigned int map,
384} 337}
385 338
386/* 339/*
387 * Process bitmap data from v3 and v4 protocols. Returns the number of 340 * Process bitmap data from semi-mt protocols. Returns the number of
388 * fingers detected. A return value of 0 means at least one of the 341 * fingers detected. A return value of 0 means at least one of the
389 * bitmaps was empty. 342 * bitmaps was empty.
390 * 343 *
@@ -396,9 +349,10 @@ static void alps_get_bitmap_points(unsigned int map,
396static int alps_process_bitmap(struct alps_data *priv, 349static int alps_process_bitmap(struct alps_data *priv,
397 struct alps_fields *fields) 350 struct alps_fields *fields)
398{ 351{
399 int i, fingers_x = 0, fingers_y = 0, fingers; 352 int i, fingers_x = 0, fingers_y = 0, fingers, closest;
400 struct alps_bitmap_point x_low = {0,}, x_high = {0,}; 353 struct alps_bitmap_point x_low = {0,}, x_high = {0,};
401 struct alps_bitmap_point y_low = {0,}, y_high = {0,}; 354 struct alps_bitmap_point y_low = {0,}, y_high = {0,};
355 struct input_mt_pos corner[4];
402 356
403 if (!fields->x_map || !fields->y_map) 357 if (!fields->x_map || !fields->y_map)
404 return 0; 358 return 0;
@@ -429,26 +383,76 @@ static int alps_process_bitmap(struct alps_data *priv,
429 y_high.num_bits = max(i, 1); 383 y_high.num_bits = max(i, 1);
430 } 384 }
431 385
432 fields->mt[0].x = 386 /* top-left corner */
387 corner[0].x =
433 (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) / 388 (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) /
434 (2 * (priv->x_bits - 1)); 389 (2 * (priv->x_bits - 1));
435 fields->mt[0].y = 390 corner[0].y =
436 (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) / 391 (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) /
437 (2 * (priv->y_bits - 1)); 392 (2 * (priv->y_bits - 1));
438 393
439 fields->mt[1].x = 394 /* top-right corner */
395 corner[1].x =
440 (priv->x_max * (2 * x_high.start_bit + x_high.num_bits - 1)) / 396 (priv->x_max * (2 * x_high.start_bit + x_high.num_bits - 1)) /
441 (2 * (priv->x_bits - 1)); 397 (2 * (priv->x_bits - 1));
442 fields->mt[1].y = 398 corner[1].y =
399 (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) /
400 (2 * (priv->y_bits - 1));
401
402 /* bottom-right corner */
403 corner[2].x =
404 (priv->x_max * (2 * x_high.start_bit + x_high.num_bits - 1)) /
405 (2 * (priv->x_bits - 1));
406 corner[2].y =
407 (priv->y_max * (2 * y_high.start_bit + y_high.num_bits - 1)) /
408 (2 * (priv->y_bits - 1));
409
410 /* bottom-left corner */
411 corner[3].x =
412 (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) /
413 (2 * (priv->x_bits - 1));
414 corner[3].y =
443 (priv->y_max * (2 * y_high.start_bit + y_high.num_bits - 1)) / 415 (priv->y_max * (2 * y_high.start_bit + y_high.num_bits - 1)) /
444 (2 * (priv->y_bits - 1)); 416 (2 * (priv->y_bits - 1));
445 417
446 /* y-bitmap order is reversed, except on rushmore */ 418 /* x-bitmap order is reversed on v5 touchpads */
447 if (priv->proto_version != ALPS_PROTO_V3_RUSHMORE) { 419 if (priv->proto_version == ALPS_PROTO_V5) {
448 fields->mt[0].y = priv->y_max - fields->mt[0].y; 420 for (i = 0; i < 4; i++)
449 fields->mt[1].y = priv->y_max - fields->mt[1].y; 421 corner[i].x = priv->x_max - corner[i].x;
422 }
423
424 /* y-bitmap order is reversed on v3 and v4 touchpads */
425 if (priv->proto_version == ALPS_PROTO_V3 ||
426 priv->proto_version == ALPS_PROTO_V4) {
427 for (i = 0; i < 4; i++)
428 corner[i].y = priv->y_max - corner[i].y;
429 }
430
431 /*
432 * We only select a corner for the second touch once per 2 finger
433 * touch sequence to avoid the chosen corner (and thus the coordinates)
434 * jumping around when the first touch is in the middle.
435 */
436 if (priv->second_touch == -1) {
437 /* Find corner closest to our st coordinates */
438 closest = 0x7fffffff;
439 for (i = 0; i < 4; i++) {
440 int dx = fields->st.x - corner[i].x;
441 int dy = fields->st.y - corner[i].y;
442 int distance = dx * dx + dy * dy;
443
444 if (distance < closest) {
445 priv->second_touch = i;
446 closest = distance;
447 }
448 }
449 /* And select the opposite corner to use for the 2nd touch */
450 priv->second_touch = (priv->second_touch + 2) % 4;
450 } 451 }
451 452
453 fields->mt[0] = fields->st;
454 fields->mt[1] = corner[priv->second_touch];
455
452 return fingers; 456 return fingers;
453} 457}
454 458
@@ -485,9 +489,14 @@ static void alps_report_semi_mt_data(struct psmouse *psmouse, int fingers)
485 f->mt[0].x = f->st.x; 489 f->mt[0].x = f->st.x;
486 f->mt[0].y = f->st.y; 490 f->mt[0].y = f->st.y;
487 fingers = f->pressure > 0 ? 1 : 0; 491 fingers = f->pressure > 0 ? 1 : 0;
492 priv->second_touch = -1;
488 } 493 }
489 494
490 alps_report_mt_data(psmouse, (fingers <= 2) ? fingers : 2); 495 if (fingers >= 1)
496 alps_set_slot(dev, 0, f->mt[0].x, f->mt[0].y);
497 if (fingers >= 2)
498 alps_set_slot(dev, 1, f->mt[1].x, f->mt[1].y);
499 input_mt_sync_frame(dev);
491 500
492 input_mt_report_finger_count(dev, fingers); 501 input_mt_report_finger_count(dev, fingers);
493 502
@@ -584,20 +593,22 @@ static int alps_decode_pinnacle(struct alps_fields *f, unsigned char *p,
584 f->first_mp = !!(p[4] & 0x40); 593 f->first_mp = !!(p[4] & 0x40);
585 f->is_mp = !!(p[0] & 0x40); 594 f->is_mp = !!(p[0] & 0x40);
586 595
587 f->fingers = (p[5] & 0x3) + 1; 596 if (f->is_mp) {
588 f->x_map = ((p[4] & 0x7e) << 8) | 597 f->fingers = (p[5] & 0x3) + 1;
589 ((p[1] & 0x7f) << 2) | 598 f->x_map = ((p[4] & 0x7e) << 8) |
590 ((p[0] & 0x30) >> 4); 599 ((p[1] & 0x7f) << 2) |
591 f->y_map = ((p[3] & 0x70) << 4) | 600 ((p[0] & 0x30) >> 4);
592 ((p[2] & 0x7f) << 1) | 601 f->y_map = ((p[3] & 0x70) << 4) |
593 (p[4] & 0x01); 602 ((p[2] & 0x7f) << 1) |
594 603 (p[4] & 0x01);
595 f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | 604 } else {
596 ((p[0] & 0x30) >> 4); 605 f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) |
597 f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); 606 ((p[0] & 0x30) >> 4);
598 f->pressure = p[5] & 0x7f; 607 f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f);
608 f->pressure = p[5] & 0x7f;
599 609
600 alps_decode_buttons_v3(f, p); 610 alps_decode_buttons_v3(f, p);
611 }
601 612
602 return 0; 613 return 0;
603} 614}
@@ -605,13 +616,27 @@ static int alps_decode_pinnacle(struct alps_fields *f, unsigned char *p,
605static int alps_decode_rushmore(struct alps_fields *f, unsigned char *p, 616static int alps_decode_rushmore(struct alps_fields *f, unsigned char *p,
606 struct psmouse *psmouse) 617 struct psmouse *psmouse)
607{ 618{
608 alps_decode_pinnacle(f, p, psmouse); 619 f->first_mp = !!(p[4] & 0x40);
609
610 /* Rushmore's packet decode has a bit difference with Pinnacle's */
611 f->is_mp = !!(p[5] & 0x40); 620 f->is_mp = !!(p[5] & 0x40);
612 f->fingers = max((p[5] & 0x3), ((p[5] >> 2) & 0x3)) + 1; 621
613 f->x_map |= (p[5] & 0x10) << 11; 622 if (f->is_mp) {
614 f->y_map |= (p[5] & 0x20) << 6; 623 f->fingers = max((p[5] & 0x3), ((p[5] >> 2) & 0x3)) + 1;
624 f->x_map = ((p[5] & 0x10) << 11) |
625 ((p[4] & 0x7e) << 8) |
626 ((p[1] & 0x7f) << 2) |
627 ((p[0] & 0x30) >> 4);
628 f->y_map = ((p[5] & 0x20) << 6) |
629 ((p[3] & 0x70) << 4) |
630 ((p[2] & 0x7f) << 1) |
631 (p[4] & 0x01);
632 } else {
633 f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) |
634 ((p[0] & 0x30) >> 4);
635 f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f);
636 f->pressure = p[5] & 0x7f;
637
638 alps_decode_buttons_v3(f, p);
639 }
615 640
616 return 0; 641 return 0;
617} 642}
@@ -680,30 +705,13 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
680 */ 705 */
681 if (f->is_mp) { 706 if (f->is_mp) {
682 fingers = f->fingers; 707 fingers = f->fingers;
683 if (priv->proto_version == ALPS_PROTO_V3 || 708 /*
684 priv->proto_version == ALPS_PROTO_V3_RUSHMORE) { 709 * Bitmap processing uses position packet's coordinate
685 if (alps_process_bitmap(priv, f) == 0) 710 * data, so we need to do decode it first.
686 fingers = 0; /* Use st data */ 711 */
687 712 priv->decode_fields(f, priv->multi_data, psmouse);
688 /* Now process position packet */ 713 if (alps_process_bitmap(priv, f) == 0)
689 priv->decode_fields(f, priv->multi_data, 714 fingers = 0; /* Use st data */
690 psmouse);
691 } else {
692 /*
693 * Because Dolphin uses position packet's
694 * coordinate data as Pt1 and uses it to
695 * calculate Pt2, so we need to do position
696 * packet decode first.
697 */
698 priv->decode_fields(f, priv->multi_data,
699 psmouse);
700
701 /*
702 * Since Dolphin's finger number is reliable,
703 * there is no need to compare with bmap_fn.
704 */
705 alps_process_bitmap_dolphin(priv, f);
706 }
707 } else { 715 } else {
708 priv->multi_packet = 0; 716 priv->multi_packet = 0;
709 } 717 }
@@ -865,6 +873,14 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
865 priv->multi_data[offset] = packet[6]; 873 priv->multi_data[offset] = packet[6];
866 priv->multi_data[offset + 1] = packet[7]; 874 priv->multi_data[offset + 1] = packet[7];
867 875
876 f->left = !!(packet[4] & 0x01);
877 f->right = !!(packet[4] & 0x02);
878
879 f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
880 ((packet[0] & 0x30) >> 4);
881 f->st.y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f);
882 f->pressure = packet[5] & 0x7f;
883
868 if (++priv->multi_packet > 2) { 884 if (++priv->multi_packet > 2) {
869 priv->multi_packet = 0; 885 priv->multi_packet = 0;
870 886
@@ -879,14 +895,6 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
879 f->fingers = alps_process_bitmap(priv, f); 895 f->fingers = alps_process_bitmap(priv, f);
880 } 896 }
881 897
882 f->left = !!(packet[4] & 0x01);
883 f->right = !!(packet[4] & 0x02);
884
885 f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
886 ((packet[0] & 0x30) >> 4);
887 f->st.y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f);
888 f->pressure = packet[5] & 0x7f;
889
890 alps_report_semi_mt_data(psmouse, f->fingers); 898 alps_report_semi_mt_data(psmouse, f->fingers);
891} 899}
892 900
@@ -2561,7 +2569,7 @@ static int alps_set_protocol(struct psmouse *psmouse,
2561 case ALPS_PROTO_V3: 2569 case ALPS_PROTO_V3:
2562 priv->hw_init = alps_hw_init_v3; 2570 priv->hw_init = alps_hw_init_v3;
2563 priv->process_packet = alps_process_packet_v3; 2571 priv->process_packet = alps_process_packet_v3;
2564 priv->set_abs_params = alps_set_abs_params_mt; 2572 priv->set_abs_params = alps_set_abs_params_semi_mt;
2565 priv->decode_fields = alps_decode_pinnacle; 2573 priv->decode_fields = alps_decode_pinnacle;
2566 priv->nibble_commands = alps_v3_nibble_commands; 2574 priv->nibble_commands = alps_v3_nibble_commands;
2567 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2575 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
@@ -2570,7 +2578,7 @@ static int alps_set_protocol(struct psmouse *psmouse,
2570 case ALPS_PROTO_V3_RUSHMORE: 2578 case ALPS_PROTO_V3_RUSHMORE:
2571 priv->hw_init = alps_hw_init_rushmore_v3; 2579 priv->hw_init = alps_hw_init_rushmore_v3;
2572 priv->process_packet = alps_process_packet_v3; 2580 priv->process_packet = alps_process_packet_v3;
2573 priv->set_abs_params = alps_set_abs_params_mt; 2581 priv->set_abs_params = alps_set_abs_params_semi_mt;
2574 priv->decode_fields = alps_decode_rushmore; 2582 priv->decode_fields = alps_decode_rushmore;
2575 priv->nibble_commands = alps_v3_nibble_commands; 2583 priv->nibble_commands = alps_v3_nibble_commands;
2576 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2584 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
@@ -2586,7 +2594,7 @@ static int alps_set_protocol(struct psmouse *psmouse,
2586 case ALPS_PROTO_V4: 2594 case ALPS_PROTO_V4:
2587 priv->hw_init = alps_hw_init_v4; 2595 priv->hw_init = alps_hw_init_v4;
2588 priv->process_packet = alps_process_packet_v4; 2596 priv->process_packet = alps_process_packet_v4;
2589 priv->set_abs_params = alps_set_abs_params_mt; 2597 priv->set_abs_params = alps_set_abs_params_semi_mt;
2590 priv->nibble_commands = alps_v4_nibble_commands; 2598 priv->nibble_commands = alps_v4_nibble_commands;
2591 priv->addr_command = PSMOUSE_CMD_DISABLE; 2599 priv->addr_command = PSMOUSE_CMD_DISABLE;
2592 break; 2600 break;
@@ -2595,7 +2603,7 @@ static int alps_set_protocol(struct psmouse *psmouse,
2595 priv->hw_init = alps_hw_init_dolphin_v1; 2603 priv->hw_init = alps_hw_init_dolphin_v1;
2596 priv->process_packet = alps_process_touchpad_packet_v3_v5; 2604 priv->process_packet = alps_process_touchpad_packet_v3_v5;
2597 priv->decode_fields = alps_decode_dolphin; 2605 priv->decode_fields = alps_decode_dolphin;
2598 priv->set_abs_params = alps_set_abs_params_mt; 2606 priv->set_abs_params = alps_set_abs_params_semi_mt;
2599 priv->nibble_commands = alps_v3_nibble_commands; 2607 priv->nibble_commands = alps_v3_nibble_commands;
2600 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2608 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
2601 priv->x_bits = 23; 2609 priv->x_bits = 23;
@@ -2777,15 +2785,15 @@ static void alps_set_abs_params_mt_common(struct alps_data *priv,
2777 set_bit(BTN_TOOL_QUADTAP, dev1->keybit); 2785 set_bit(BTN_TOOL_QUADTAP, dev1->keybit);
2778} 2786}
2779 2787
2780static void alps_set_abs_params_mt(struct alps_data *priv, 2788static void alps_set_abs_params_semi_mt(struct alps_data *priv,
2781 struct input_dev *dev1) 2789 struct input_dev *dev1)
2782{ 2790{
2783 alps_set_abs_params_mt_common(priv, dev1); 2791 alps_set_abs_params_mt_common(priv, dev1);
2784 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 2792 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);
2785 2793
2786 input_mt_init_slots(dev1, MAX_TOUCHES, 2794 input_mt_init_slots(dev1, MAX_TOUCHES,
2787 INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED | 2795 INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED |
2788 INPUT_MT_TRACK | INPUT_MT_SEMI_MT); 2796 INPUT_MT_SEMI_MT);
2789} 2797}
2790 2798
2791static void alps_set_abs_params_v7(struct alps_data *priv, 2799static void alps_set_abs_params_v7(struct alps_data *priv,
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 6dfdccc3a7c6..d37f814dc447 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -278,6 +278,7 @@ struct alps_data {
278 278
279 int prev_fin; 279 int prev_fin;
280 int multi_packet; 280 int multi_packet;
281 int second_touch;
281 unsigned char multi_data[6]; 282 unsigned char multi_data[6];
282 struct alps_fields f; 283 struct alps_fields f;
283 u8 quirks; 284 u8 quirks;
diff --git a/drivers/input/mouse/cyapa_gen3.c b/drivers/input/mouse/cyapa_gen3.c
index 1e2291c378fe..3faf01c1b191 100644
--- a/drivers/input/mouse/cyapa_gen3.c
+++ b/drivers/input/mouse/cyapa_gen3.c
@@ -950,14 +950,13 @@ static u16 cyapa_get_wait_time_for_pwr_cmd(u8 pwr_mode)
950 * Device power mode can only be set when device is in operational mode. 950 * Device power mode can only be set when device is in operational mode.
951 */ 951 */
952static int cyapa_gen3_set_power_mode(struct cyapa *cyapa, u8 power_mode, 952static int cyapa_gen3_set_power_mode(struct cyapa *cyapa, u8 power_mode,
953 u16 always_unused) 953 u16 always_unused)
954{ 954{
955 int ret; 955 int ret;
956 u8 power; 956 u8 power;
957 int tries; 957 int tries;
958 u16 sleep_time; 958 u16 sleep_time;
959 959
960 always_unused = 0;
961 if (cyapa->state != CYAPA_STATE_OP) 960 if (cyapa->state != CYAPA_STATE_OP)
962 return 0; 961 return 0;
963 962
diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
index 5b611dd71e79..afc39e799da2 100644
--- a/drivers/input/mouse/cyapa_gen5.c
+++ b/drivers/input/mouse/cyapa_gen5.c
@@ -352,7 +352,7 @@ struct gen5_app_cmd_head {
352 u8 parameter_data[0]; /* Parameter data variable based on cmd_code */ 352 u8 parameter_data[0]; /* Parameter data variable based on cmd_code */
353} __packed; 353} __packed;
354 354
355/* Applicaton get/set parameter command data structure */ 355/* Application get/set parameter command data structure */
356struct gen5_app_set_parameter_data { 356struct gen5_app_set_parameter_data {
357 u8 parameter_id; 357 u8 parameter_id;
358 u8 parameter_size; 358 u8 parameter_size;
@@ -832,7 +832,7 @@ static int gen5_hid_description_header_parse(struct cyapa *cyapa, u8 *reg_data)
832 int ret; 832 int ret;
833 833
834 /* 0x20 0x00 0xF7 is Gen5 Application HID Description Header; 834 /* 0x20 0x00 0xF7 is Gen5 Application HID Description Header;
835 * 0x20 0x00 0xFF is Gen5 Booloader HID Description Header. 835 * 0x20 0x00 0xFF is Gen5 Bootloader HID Description Header.
836 * 836 *
837 * Must read HID Description content through out, 837 * Must read HID Description content through out,
838 * otherwise Gen5 trackpad cannot response next command 838 * otherwise Gen5 trackpad cannot response next command
@@ -1654,8 +1654,8 @@ static int cyapa_gen5_set_power_mode(struct cyapa *cyapa,
1654 * that trackpad unable to report signal to wake system up 1654 * that trackpad unable to report signal to wake system up
1655 * in the special situation that system is in suspending, and 1655 * in the special situation that system is in suspending, and
1656 * at the same time, user touch trackpad to wake system up. 1656 * at the same time, user touch trackpad to wake system up.
1657 * This function can avoid the data to be buffured when system 1657 * This function can avoid the data to be buffered when system
1658 * is suspending which may cause interrput line unable to be 1658 * is suspending which may cause interrupt line unable to be
1659 * asserted again. 1659 * asserted again.
1660 */ 1660 */
1661 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); 1661 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL);
@@ -2546,16 +2546,11 @@ static bool cyapa_gen5_irq_cmd_handler(struct cyapa *cyapa)
2546 gen5_pip->resp_sort_func(cyapa, 2546 gen5_pip->resp_sort_func(cyapa,
2547 gen5_pip->irq_cmd_buf, length))) { 2547 gen5_pip->irq_cmd_buf, length))) {
2548 /* 2548 /*
2549 * Cover the Gen5 V1 firmware issue. 2549 * Work around the Gen5 V1 firmware
2550 * The issue is there is no interrut will be 2550 * that does not assert interrupt signalling
2551 * asserted to notityf host to read a command 2551 * that command response is ready if user
2552 * data out when always has finger touch on 2552 * keeps touching the trackpad while command
2553 * trackpad during the command is issued to 2553 * is sent to the device.
2554 * trackad device.
2555 * This issue has the scenario is that,
2556 * user always has his fingers touched on
2557 * trackpad device when booting/rebooting
2558 * their chrome book.
2559 */ 2554 */
2560 length = 0; 2555 length = 0;
2561 if (gen5_pip->resp_len) 2556 if (gen5_pip->resp_len)
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index 6d5f8a4c1748..73670f2aebfd 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -28,14 +28,13 @@
28#define ETP_PRESSURE_OFFSET 25 28#define ETP_PRESSURE_OFFSET 25
29 29
30/* IAP Firmware handling */ 30/* IAP Firmware handling */
31#define ETP_FW_NAME "elan_i2c.bin" 31#define ETP_PRODUCT_ID_FORMAT_STRING "%d.0"
32#define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin"
32#define ETP_IAP_START_ADDR 0x0083 33#define ETP_IAP_START_ADDR 0x0083
33#define ETP_FW_IAP_PAGE_ERR (1 << 5) 34#define ETP_FW_IAP_PAGE_ERR (1 << 5)
34#define ETP_FW_IAP_INTF_ERR (1 << 4) 35#define ETP_FW_IAP_INTF_ERR (1 << 4)
35#define ETP_FW_PAGE_SIZE 64 36#define ETP_FW_PAGE_SIZE 64
36#define ETP_FW_VAILDPAGE_COUNT 768
37#define ETP_FW_SIGNATURE_SIZE 6 37#define ETP_FW_SIGNATURE_SIZE 6
38#define ETP_FW_SIGNATURE_ADDRESS 0xBFFA
39 38
40struct i2c_client; 39struct i2c_client;
41struct completion; 40struct completion;
@@ -58,7 +57,8 @@ struct elan_transport_ops {
58 bool max_baseliune, u8 *value); 57 bool max_baseliune, u8 *value);
59 58
60 int (*get_version)(struct i2c_client *client, bool iap, u8 *version); 59 int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
61 int (*get_sm_version)(struct i2c_client *client, u8 *version); 60 int (*get_sm_version)(struct i2c_client *client,
61 u8* ic_type, u8 *version);
62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); 62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
63 int (*get_product_id)(struct i2c_client *client, u8 *id); 63 int (*get_product_id)(struct i2c_client *client, u8 *id);
64 64
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index fd5068b2542d..62641f2adaf7 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
4 * Copyright (c) 2013 ELAN Microelectronics Corp. 4 * Copyright (c) 2013 ELAN Microelectronics Corp.
5 * 5 *
6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> 6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
7 * Version: 1.5.7 7 * Version: 1.5.9
8 * 8 *
9 * Based on cyapa driver: 9 * Based on cyapa driver:
10 * copyright (c) 2011-2012 Cypress Semiconductor, Inc. 10 * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -40,7 +40,7 @@
40#include "elan_i2c.h" 40#include "elan_i2c.h"
41 41
42#define DRIVER_NAME "elan_i2c" 42#define DRIVER_NAME "elan_i2c"
43#define ELAN_DRIVER_VERSION "1.5.7" 43#define ELAN_DRIVER_VERSION "1.5.9"
44#define ETP_MAX_PRESSURE 255 44#define ETP_MAX_PRESSURE 255
45#define ETP_FWIDTH_REDUCE 90 45#define ETP_FWIDTH_REDUCE 90
46#define ETP_FINGER_WIDTH 15 46#define ETP_FINGER_WIDTH 15
@@ -83,6 +83,9 @@ struct elan_tp_data {
83 u16 fw_checksum; 83 u16 fw_checksum;
84 int pressure_adjustment; 84 int pressure_adjustment;
85 u8 mode; 85 u8 mode;
86 u8 ic_type;
87 u16 fw_vaildpage_count;
88 u16 fw_signature_address;
86 89
87 bool irq_wake; 90 bool irq_wake;
88 91
@@ -91,6 +94,29 @@ struct elan_tp_data {
91 bool baseline_ready; 94 bool baseline_ready;
92}; 95};
93 96
97static int elan_get_fwinfo(u8 ic_type, u16 *vaildpage_count,
98 u16 *signature_address)
99{
100 switch(ic_type) {
101 case 0x09:
102 *vaildpage_count = 768;
103 break;
104 case 0x0D:
105 *vaildpage_count = 896;
106 break;
107 default:
108 /* unknown ic type clear value */
109 *vaildpage_count = 0;
110 *signature_address = 0;
111 return -ENXIO;
112 }
113
114 *signature_address =
115 (*vaildpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE;
116
117 return 0;
118}
119
94static int elan_enable_power(struct elan_tp_data *data) 120static int elan_enable_power(struct elan_tp_data *data)
95{ 121{
96 int repeat = ETP_RETRY_COUNT; 122 int repeat = ETP_RETRY_COUNT;
@@ -221,7 +247,8 @@ static int elan_query_device_info(struct elan_tp_data *data)
221 if (error) 247 if (error)
222 return error; 248 return error;
223 249
224 error = data->ops->get_sm_version(data->client, &data->sm_version); 250 error = data->ops->get_sm_version(data->client, &data->ic_type,
251 &data->sm_version);
225 if (error) 252 if (error)
226 return error; 253 return error;
227 254
@@ -234,6 +261,14 @@ static int elan_query_device_info(struct elan_tp_data *data)
234 if (error) 261 if (error)
235 return error; 262 return error;
236 263
264 error = elan_get_fwinfo(data->ic_type, &data->fw_vaildpage_count,
265 &data->fw_signature_address);
266 if (error) {
267 dev_err(&data->client->dev,
268 "unknown ic type %d\n", data->ic_type);
269 return error;
270 }
271
237 return 0; 272 return 0;
238} 273}
239 274
@@ -318,7 +353,7 @@ static int __elan_update_firmware(struct elan_tp_data *data,
318 iap_start_addr = get_unaligned_le16(&fw->data[ETP_IAP_START_ADDR * 2]); 353 iap_start_addr = get_unaligned_le16(&fw->data[ETP_IAP_START_ADDR * 2]);
319 354
320 boot_page_count = (iap_start_addr * 2) / ETP_FW_PAGE_SIZE; 355 boot_page_count = (iap_start_addr * 2) / ETP_FW_PAGE_SIZE;
321 for (i = boot_page_count; i < ETP_FW_VAILDPAGE_COUNT; i++) { 356 for (i = boot_page_count; i < data->fw_vaildpage_count; i++) {
322 u16 checksum = 0; 357 u16 checksum = 0;
323 const u8 *page = &fw->data[i * ETP_FW_PAGE_SIZE]; 358 const u8 *page = &fw->data[i * ETP_FW_PAGE_SIZE];
324 359
@@ -403,7 +438,8 @@ static ssize_t elan_sysfs_read_product_id(struct device *dev,
403 struct i2c_client *client = to_i2c_client(dev); 438 struct i2c_client *client = to_i2c_client(dev);
404 struct elan_tp_data *data = i2c_get_clientdata(client); 439 struct elan_tp_data *data = i2c_get_clientdata(client);
405 440
406 return sprintf(buf, "%d.0\n", data->product_id); 441 return sprintf(buf, ETP_PRODUCT_ID_FORMAT_STRING "\n",
442 data->product_id);
407} 443}
408 444
409static ssize_t elan_sysfs_read_fw_ver(struct device *dev, 445static ssize_t elan_sysfs_read_fw_ver(struct device *dev,
@@ -442,19 +478,28 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
442{ 478{
443 struct elan_tp_data *data = dev_get_drvdata(dev); 479 struct elan_tp_data *data = dev_get_drvdata(dev);
444 const struct firmware *fw; 480 const struct firmware *fw;
481 char *fw_name;
445 int error; 482 int error;
446 const u8 *fw_signature; 483 const u8 *fw_signature;
447 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; 484 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};
448 485
449 error = request_firmware(&fw, ETP_FW_NAME, dev); 486 /* Look for a firmware with the product id appended. */
487 fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);
488 if (!fw_name) {
489 dev_err(dev, "failed to allocate memory for firmware name\n");
490 return -ENOMEM;
491 }
492
493 dev_info(dev, "requesting fw '%s'\n", fw_name);
494 error = request_firmware(&fw, fw_name, dev);
495 kfree(fw_name);
450 if (error) { 496 if (error) {
451 dev_err(dev, "cannot load firmware %s: %d\n", 497 dev_err(dev, "failed to request firmware: %d\n", error);
452 ETP_FW_NAME, error);
453 return error; 498 return error;
454 } 499 }
455 500
456 /* Firmware file must match signature data */ 501 /* Firmware file must match signature data */
457 fw_signature = &fw->data[ETP_FW_SIGNATURE_ADDRESS]; 502 fw_signature = &fw->data[data->fw_signature_address];
458 if (memcmp(fw_signature, signature, sizeof(signature)) != 0) { 503 if (memcmp(fw_signature, signature, sizeof(signature)) != 0) {
459 dev_err(dev, "signature mismatch (expected %*ph, got %*ph)\n", 504 dev_err(dev, "signature mismatch (expected %*ph, got %*ph)\n",
460 (int)sizeof(signature), signature, 505 (int)sizeof(signature), signature,
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index a0acbbf83bfd..683c840c9dd7 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -259,7 +259,8 @@ static int elan_i2c_get_version(struct i2c_client *client,
259 return 0; 259 return 0;
260} 260}
261 261
262static int elan_i2c_get_sm_version(struct i2c_client *client, u8 *version) 262static int elan_i2c_get_sm_version(struct i2c_client *client,
263 u8 *ic_type, u8 *version)
263{ 264{
264 int error; 265 int error;
265 u8 val[3]; 266 u8 val[3];
@@ -271,6 +272,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, u8 *version)
271 } 272 }
272 273
273 *version = val[0]; 274 *version = val[0];
275 *ic_type = val[1];
274 return 0; 276 return 0;
275} 277}
276 278
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
index 30ab80dbcdd6..ff36a366b2aa 100644
--- a/drivers/input/mouse/elan_i2c_smbus.c
+++ b/drivers/input/mouse/elan_i2c_smbus.c
@@ -165,7 +165,8 @@ static int elan_smbus_get_version(struct i2c_client *client,
165 return 0; 165 return 0;
166} 166}
167 167
168static int elan_smbus_get_sm_version(struct i2c_client *client, u8 *version) 168static int elan_smbus_get_sm_version(struct i2c_client *client,
169 u8 *ic_type, u8 *version)
169{ 170{
170 int error; 171 int error;
171 u8 val[3]; 172 u8 val[3];
@@ -177,7 +178,8 @@ static int elan_smbus_get_sm_version(struct i2c_client *client, u8 *version)
177 return error; 178 return error;
178 } 179 }
179 180
180 *version = val[0]; /* XXX Why 0 and not 2 as in IAP/FW versions? */ 181 *version = val[0];
182 *ic_type = val[1];
181 return 0; 183 return 0;
182} 184}
183 185
diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c
index 23d259416f2f..4d5576de81be 100644
--- a/drivers/input/mouse/focaltech.c
+++ b/drivers/input/mouse/focaltech.c
@@ -103,6 +103,16 @@ struct focaltech_hw_state {
103 */ 103 */
104 struct focaltech_finger_state fingers[FOC_MAX_FINGERS]; 104 struct focaltech_finger_state fingers[FOC_MAX_FINGERS];
105 105
106 /*
107 * Finger width 0-7 and 15 for a very big contact area.
108 * 15 value stays until the finger is released.
109 * Width is reported only in absolute packets.
110 * Since hardware reports width only for last touching finger,
111 * there is no need to store width for every specific finger,
112 * so we keep only last value reported.
113 */
114 unsigned int width;
115
106 /* True if the clickpad has been pressed. */ 116 /* True if the clickpad has been pressed. */
107 bool pressed; 117 bool pressed;
108}; 118};
@@ -137,6 +147,7 @@ static void focaltech_report_state(struct psmouse *psmouse)
137 input_report_abs(dev, ABS_MT_POSITION_X, clamped_x); 147 input_report_abs(dev, ABS_MT_POSITION_X, clamped_x);
138 input_report_abs(dev, ABS_MT_POSITION_Y, 148 input_report_abs(dev, ABS_MT_POSITION_Y,
139 priv->y_max - clamped_y); 149 priv->y_max - clamped_y);
150 input_report_abs(dev, ABS_TOOL_WIDTH, state->width);
140 } 151 }
141 } 152 }
142 input_mt_report_pointer_emulation(dev, true); 153 input_mt_report_pointer_emulation(dev, true);
@@ -187,6 +198,7 @@ static void focaltech_process_abs_packet(struct psmouse *psmouse,
187 198
188 state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2]; 199 state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2];
189 state->fingers[finger].y = (packet[3] << 8) | packet[4]; 200 state->fingers[finger].y = (packet[3] << 8) | packet[4];
201 state->width = packet[5] >> 4;
190 state->fingers[finger].valid = true; 202 state->fingers[finger].valid = true;
191} 203}
192 204
@@ -331,6 +343,7 @@ static void focaltech_set_input_params(struct psmouse *psmouse)
331 __set_bit(EV_ABS, dev->evbit); 343 __set_bit(EV_ABS, dev->evbit);
332 input_set_abs_params(dev, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0); 344 input_set_abs_params(dev, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0);
333 input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0); 345 input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0);
346 input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
334 input_mt_init_slots(dev, 5, INPUT_MT_POINTER); 347 input_mt_init_slots(dev, 5, INPUT_MT_POINTER);
335 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); 348 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
336} 349}
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 5bb1658f60c7..7c4ba43d253e 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -63,7 +63,7 @@ static unsigned int psmouse_rate = 100;
63module_param_named(rate, psmouse_rate, uint, 0644); 63module_param_named(rate, psmouse_rate, uint, 0644);
64MODULE_PARM_DESC(rate, "Report rate, in reports per second."); 64MODULE_PARM_DESC(rate, "Report rate, in reports per second.");
65 65
66static bool psmouse_smartscroll = 1; 66static bool psmouse_smartscroll = true;
67module_param_named(smartscroll, psmouse_smartscroll, bool, 0644); 67module_param_named(smartscroll, psmouse_smartscroll, bool, 0644);
68MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); 68MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled.");
69 69
diff --git a/drivers/input/mouse/sentelic.h b/drivers/input/mouse/sentelic.h
index aa697ece405b..42df9e3beae8 100644
--- a/drivers/input/mouse/sentelic.h
+++ b/drivers/input/mouse/sentelic.h
@@ -123,11 +123,11 @@ struct fsp_data {
123extern int fsp_detect(struct psmouse *psmouse, bool set_properties); 123extern int fsp_detect(struct psmouse *psmouse, bool set_properties);
124extern int fsp_init(struct psmouse *psmouse); 124extern int fsp_init(struct psmouse *psmouse);
125#else 125#else
126inline int fsp_detect(struct psmouse *psmouse, bool set_properties) 126static inline int fsp_detect(struct psmouse *psmouse, bool set_properties)
127{ 127{
128 return -ENOSYS; 128 return -ENOSYS;
129} 129}
130inline int fsp_init(struct psmouse *psmouse) 130static inline int fsp_init(struct psmouse *psmouse)
131{ 131{
132 return -ENOSYS; 132 return -ENOSYS;
133} 133}
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index 878f18498f3b..ffceedcaf3c8 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -185,7 +185,7 @@
185#define NO_DATA_SLEEP_MSECS (MSEC_PER_SEC / 4) 185#define NO_DATA_SLEEP_MSECS (MSEC_PER_SEC / 4)
186 186
187/* Control touchpad's No Deceleration option */ 187/* Control touchpad's No Deceleration option */
188static bool no_decel = 1; 188static bool no_decel = true;
189module_param(no_decel, bool, 0644); 189module_param(no_decel, bool, 0644);
190MODULE_PARM_DESC(no_decel, "No Deceleration. Default = 1 (on)"); 190MODULE_PARM_DESC(no_decel, "No Deceleration. Default = 1 (on)");
191 191
@@ -340,9 +340,9 @@ static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
340 s32 data; 340 s32 data;
341 s8 x_delta, y_delta; 341 s8 x_delta, y_delta;
342 342
343 /* Deal with spontanious resets and errors */ 343 /* Deal with spontaneous resets and errors */
344 if (synaptics_i2c_check_error(touch->client)) 344 if (synaptics_i2c_check_error(touch->client))
345 return 0; 345 return false;
346 346
347 /* Get Gesture Bit */ 347 /* Get Gesture Bit */
348 data = synaptics_i2c_reg_get(touch->client, DATA_REG0); 348 data = synaptics_i2c_reg_get(touch->client, DATA_REG0);
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 80f6386709bf..7afa6a2b776c 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -958,6 +958,7 @@ config TOUCHSCREEN_ST1232
958config TOUCHSCREEN_STMPE 958config TOUCHSCREEN_STMPE
959 tristate "STMicroelectronics STMPE touchscreens" 959 tristate "STMicroelectronics STMPE touchscreens"
960 depends on MFD_STMPE 960 depends on MFD_STMPE
961 depends on (OF || COMPILE_TEST)
961 help 962 help
962 Say Y here if you want support for STMicroelectronics 963 Say Y here if you want support for STMicroelectronics
963 STMPE touchscreen controllers. 964 STMPE touchscreen controllers.
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 40b98dda8f38..dfc7309e3d38 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -726,15 +726,15 @@ static void mxt_input_button(struct mxt_data *data, u8 *message)
726{ 726{
727 struct input_dev *input = data->input_dev; 727 struct input_dev *input = data->input_dev;
728 const struct mxt_platform_data *pdata = data->pdata; 728 const struct mxt_platform_data *pdata = data->pdata;
729 bool button;
730 int i; 729 int i;
731 730
732 /* Active-low switch */
733 for (i = 0; i < pdata->t19_num_keys; i++) { 731 for (i = 0; i < pdata->t19_num_keys; i++) {
734 if (pdata->t19_keymap[i] == KEY_RESERVED) 732 if (pdata->t19_keymap[i] == KEY_RESERVED)
735 continue; 733 continue;
736 button = !(message[1] & (1 << i)); 734
737 input_report_key(input, pdata->t19_keymap[i], button); 735 /* Active-low switch */
736 input_report_key(input, pdata->t19_keymap[i],
737 !(message[1] & BIT(i)));
738 } 738 }
739} 739}
740 740
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index 568a3d340c8a..5ed31057430c 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -775,7 +775,6 @@ static void cyttsp4_get_touch(struct cyttsp4_mt_data *md,
775 struct device *dev = &md->input->dev; 775 struct device *dev = &md->input->dev;
776 struct cyttsp4_sysinfo *si = md->si; 776 struct cyttsp4_sysinfo *si = md->si;
777 enum cyttsp4_tch_abs abs; 777 enum cyttsp4_tch_abs abs;
778 int tmp;
779 bool flipped; 778 bool flipped;
780 779
781 for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) { 780 for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) {
@@ -790,9 +789,7 @@ static void cyttsp4_get_touch(struct cyttsp4_mt_data *md,
790 } 789 }
791 790
792 if (md->pdata->flags & CY_FLAG_FLIP) { 791 if (md->pdata->flags & CY_FLAG_FLIP) {
793 tmp = touch->abs[CY_TCH_X]; 792 swap(touch->abs[CY_TCH_X], touch->abs[CY_TCH_Y]);
794 touch->abs[CY_TCH_X] = touch->abs[CY_TCH_Y];
795 touch->abs[CY_TCH_Y] = tmp;
796 flipped = true; 793 flipped = true;
797 } else 794 } else
798 flipped = false; 795 flipped = false;
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 3af16984d57c..b4d12e29abff 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -47,7 +47,7 @@ struct goodix_ts_data {
47/* Register defines */ 47/* Register defines */
48#define GOODIX_READ_COOR_ADDR 0x814E 48#define GOODIX_READ_COOR_ADDR 0x814E
49#define GOODIX_REG_CONFIG_DATA 0x8047 49#define GOODIX_REG_CONFIG_DATA 0x8047
50#define GOODIX_REG_VERSION 0x8140 50#define GOODIX_REG_ID 0x8140
51 51
52#define RESOLUTION_LOC 1 52#define RESOLUTION_LOC 1
53#define MAX_CONTACTS_LOC 5 53#define MAX_CONTACTS_LOC 5
@@ -69,7 +69,7 @@ static const unsigned long goodix_irq_flags[] = {
69 * @len: length of the buffer to write 69 * @len: length of the buffer to write
70 */ 70 */
71static int goodix_i2c_read(struct i2c_client *client, 71static int goodix_i2c_read(struct i2c_client *client,
72 u16 reg, u8 *buf, int len) 72 u16 reg, u8 *buf, int len)
73{ 73{
74 struct i2c_msg msgs[2]; 74 struct i2c_msg msgs[2];
75 u16 wbuf = cpu_to_be16(reg); 75 u16 wbuf = cpu_to_be16(reg);
@@ -78,7 +78,7 @@ static int goodix_i2c_read(struct i2c_client *client,
78 msgs[0].flags = 0; 78 msgs[0].flags = 0;
79 msgs[0].addr = client->addr; 79 msgs[0].addr = client->addr;
80 msgs[0].len = 2; 80 msgs[0].len = 2;
81 msgs[0].buf = (u8 *) &wbuf; 81 msgs[0].buf = (u8 *)&wbuf;
82 82
83 msgs[1].flags = I2C_M_RD; 83 msgs[1].flags = I2C_M_RD;
84 msgs[1].addr = client->addr; 84 msgs[1].addr = client->addr;
@@ -101,6 +101,9 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
101 return error; 101 return error;
102 } 102 }
103 103
104 if (!(data[0] & 0x80))
105 return -EAGAIN;
106
104 touch_num = data[0] & 0x0f; 107 touch_num = data[0] & 0x0f;
105 if (touch_num > ts->max_touch_num) 108 if (touch_num > ts->max_touch_num)
106 return -EPROTO; 109 return -EPROTO;
@@ -144,7 +147,7 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
144 */ 147 */
145static void goodix_process_events(struct goodix_ts_data *ts) 148static void goodix_process_events(struct goodix_ts_data *ts)
146{ 149{
147 u8 point_data[1 + GOODIX_CONTACT_SIZE * ts->max_touch_num]; 150 u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
148 int touch_num; 151 int touch_num;
149 int i; 152 int i;
150 153
@@ -196,8 +199,8 @@ static void goodix_read_config(struct goodix_ts_data *ts)
196 int error; 199 int error;
197 200
198 error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA, 201 error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
199 config, 202 config,
200 GOODIX_CONFIG_MAX_LENGTH); 203 GOODIX_CONFIG_MAX_LENGTH);
201 if (error) { 204 if (error) {
202 dev_warn(&ts->client->dev, 205 dev_warn(&ts->client->dev,
203 "Error reading config (%d), using defaults\n", 206 "Error reading config (%d), using defaults\n",
@@ -227,22 +230,28 @@ static void goodix_read_config(struct goodix_ts_data *ts)
227 * 230 *
228 * @client: the i2c client 231 * @client: the i2c client
229 * @version: output buffer containing the version on success 232 * @version: output buffer containing the version on success
233 * @id: output buffer containing the id on success
230 */ 234 */
231static int goodix_read_version(struct i2c_client *client, u16 *version) 235static int goodix_read_version(struct i2c_client *client, u16 *version, u16 *id)
232{ 236{
233 int error; 237 int error;
234 u8 buf[6]; 238 u8 buf[6];
239 char id_str[5];
235 240
236 error = goodix_i2c_read(client, GOODIX_REG_VERSION, buf, sizeof(buf)); 241 error = goodix_i2c_read(client, GOODIX_REG_ID, buf, sizeof(buf));
237 if (error) { 242 if (error) {
238 dev_err(&client->dev, "read version failed: %d\n", error); 243 dev_err(&client->dev, "read version failed: %d\n", error);
239 return error; 244 return error;
240 } 245 }
241 246
242 if (version) 247 memcpy(id_str, buf, 4);
243 *version = get_unaligned_le16(&buf[4]); 248 id_str[4] = 0;
249 if (kstrtou16(id_str, 10, id))
250 *id = 0x1001;
251
252 *version = get_unaligned_le16(&buf[4]);
244 253
245 dev_info(&client->dev, "IC VERSION: %6ph\n", buf); 254 dev_info(&client->dev, "ID %d, version: %04x\n", *id, *version);
246 255
247 return 0; 256 return 0;
248} 257}
@@ -276,10 +285,13 @@ static int goodix_i2c_test(struct i2c_client *client)
276 * goodix_request_input_dev - Allocate, populate and register the input device 285 * goodix_request_input_dev - Allocate, populate and register the input device
277 * 286 *
278 * @ts: our goodix_ts_data pointer 287 * @ts: our goodix_ts_data pointer
288 * @version: device firmware version
289 * @id: device ID
279 * 290 *
280 * Must be called during probe 291 * Must be called during probe
281 */ 292 */
282static int goodix_request_input_dev(struct goodix_ts_data *ts) 293static int goodix_request_input_dev(struct goodix_ts_data *ts, u16 version,
294 u16 id)
283{ 295{
284 int error; 296 int error;
285 297
@@ -289,14 +301,10 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
289 return -ENOMEM; 301 return -ENOMEM;
290 } 302 }
291 303
292 ts->input_dev->evbit[0] = BIT_MASK(EV_SYN) | 304 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
293 BIT_MASK(EV_KEY) | 305 0, ts->abs_x_max, 0, 0);
294 BIT_MASK(EV_ABS); 306 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y,
295 307 0, ts->abs_y_max, 0, 0);
296 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0,
297 ts->abs_x_max, 0, 0);
298 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0,
299 ts->abs_y_max, 0, 0);
300 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); 308 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
301 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); 309 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
302 310
@@ -307,8 +315,8 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
307 ts->input_dev->phys = "input/ts"; 315 ts->input_dev->phys = "input/ts";
308 ts->input_dev->id.bustype = BUS_I2C; 316 ts->input_dev->id.bustype = BUS_I2C;
309 ts->input_dev->id.vendor = 0x0416; 317 ts->input_dev->id.vendor = 0x0416;
310 ts->input_dev->id.product = 0x1001; 318 ts->input_dev->id.product = id;
311 ts->input_dev->id.version = 10427; 319 ts->input_dev->id.version = version;
312 320
313 error = input_register_device(ts->input_dev); 321 error = input_register_device(ts->input_dev);
314 if (error) { 322 if (error) {
@@ -326,7 +334,7 @@ static int goodix_ts_probe(struct i2c_client *client,
326 struct goodix_ts_data *ts; 334 struct goodix_ts_data *ts;
327 unsigned long irq_flags; 335 unsigned long irq_flags;
328 int error; 336 int error;
329 u16 version_info; 337 u16 version_info, id_info;
330 338
331 dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr); 339 dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr);
332 340
@@ -348,7 +356,7 @@ static int goodix_ts_probe(struct i2c_client *client,
348 return error; 356 return error;
349 } 357 }
350 358
351 error = goodix_read_version(client, &version_info); 359 error = goodix_read_version(client, &version_info, &id_info);
352 if (error) { 360 if (error) {
353 dev_err(&client->dev, "Read version failed.\n"); 361 dev_err(&client->dev, "Read version failed.\n");
354 return error; 362 return error;
@@ -356,7 +364,7 @@ static int goodix_ts_probe(struct i2c_client *client,
356 364
357 goodix_read_config(ts); 365 goodix_read_config(ts);
358 366
359 error = goodix_request_input_dev(ts); 367 error = goodix_request_input_dev(ts, version_info, id_info);
360 if (error) 368 if (error)
361 return error; 369 return error;
362 370
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 2c2107147319..8f3e243a62bf 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -78,7 +78,7 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
78 } 78 }
79 79
80 ret = i2c_master_recv(tsdata->client, rdbuf, readsize); 80 ret = i2c_master_recv(tsdata->client, rdbuf, readsize);
81 if (ret != sizeof(rdbuf)) { 81 if (ret != readsize) {
82 dev_err(&tsdata->client->dev, 82 dev_err(&tsdata->client->dev,
83 "%s: i2c_master_recv failed(), ret=%d\n", 83 "%s: i2c_master_recv failed(), ret=%d\n",
84 __func__, ret); 84 __func__, ret);
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index bdfa27dc097b..a4a103e1d11b 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -411,7 +411,7 @@ static const struct dev_pm_ops s3c_ts_pmops = {
411}; 411};
412#endif 412#endif
413 413
414static struct platform_device_id s3cts_driver_ids[] = { 414static const struct platform_device_id s3cts_driver_ids[] = {
415 { "s3c2410-ts", 0 }, 415 { "s3c2410-ts", 0 },
416 { "s3c2440-ts", 0 }, 416 { "s3c2440-ts", 0 },
417 { "s3c64xx-ts", FEAT_PEN_IRQ }, 417 { "s3c64xx-ts", FEAT_PEN_IRQ },
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index e4c31256a74d..e414d43e5159 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -267,27 +267,10 @@ static void stmpe_ts_close(struct input_dev *dev)
267static void stmpe_ts_get_platform_info(struct platform_device *pdev, 267static void stmpe_ts_get_platform_info(struct platform_device *pdev,
268 struct stmpe_touch *ts) 268 struct stmpe_touch *ts)
269{ 269{
270 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
271 struct device_node *np = pdev->dev.of_node; 270 struct device_node *np = pdev->dev.of_node;
272 struct stmpe_ts_platform_data *ts_pdata = NULL; 271 u32 val;
273
274 ts->stmpe = stmpe;
275
276 if (stmpe->pdata && stmpe->pdata->ts) {
277 ts_pdata = stmpe->pdata->ts;
278
279 ts->sample_time = ts_pdata->sample_time;
280 ts->mod_12b = ts_pdata->mod_12b;
281 ts->ref_sel = ts_pdata->ref_sel;
282 ts->adc_freq = ts_pdata->adc_freq;
283 ts->ave_ctrl = ts_pdata->ave_ctrl;
284 ts->touch_det_delay = ts_pdata->touch_det_delay;
285 ts->settling = ts_pdata->settling;
286 ts->fraction_z = ts_pdata->fraction_z;
287 ts->i_drive = ts_pdata->i_drive;
288 } else if (np) {
289 u32 val;
290 272
273 if (np) {
291 if (!of_property_read_u32(np, "st,sample-time", &val)) 274 if (!of_property_read_u32(np, "st,sample-time", &val))
292 ts->sample_time = val; 275 ts->sample_time = val;
293 if (!of_property_read_u32(np, "st,mod-12b", &val)) 276 if (!of_property_read_u32(np, "st,mod-12b", &val))
@@ -311,6 +294,7 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev,
311 294
312static int stmpe_input_probe(struct platform_device *pdev) 295static int stmpe_input_probe(struct platform_device *pdev)
313{ 296{
297 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
314 struct stmpe_touch *ts; 298 struct stmpe_touch *ts;
315 struct input_dev *idev; 299 struct input_dev *idev;
316 int error; 300 int error;
@@ -329,6 +313,7 @@ static int stmpe_input_probe(struct platform_device *pdev)
329 return -ENOMEM; 313 return -ENOMEM;
330 314
331 platform_set_drvdata(pdev, ts); 315 platform_set_drvdata(pdev, ts);
316 ts->stmpe = stmpe;
332 ts->idev = idev; 317 ts->idev = idev;
333 ts->dev = &pdev->dev; 318 ts->dev = &pdev->dev;
334 319
@@ -351,14 +336,13 @@ static int stmpe_input_probe(struct platform_device *pdev)
351 idev->name = STMPE_TS_NAME; 336 idev->name = STMPE_TS_NAME;
352 idev->phys = STMPE_TS_NAME"/input0"; 337 idev->phys = STMPE_TS_NAME"/input0";
353 idev->id.bustype = BUS_I2C; 338 idev->id.bustype = BUS_I2C;
354 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
355 idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
356 339
357 idev->open = stmpe_ts_open; 340 idev->open = stmpe_ts_open;
358 idev->close = stmpe_ts_close; 341 idev->close = stmpe_ts_close;
359 342
360 input_set_drvdata(idev, ts); 343 input_set_drvdata(idev, ts);
361 344
345 input_set_capability(idev, EV_KEY, BTN_TOUCH);
362 input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0); 346 input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0);
363 input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); 347 input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0);
364 input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); 348 input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0);
@@ -383,14 +367,19 @@ static int stmpe_ts_remove(struct platform_device *pdev)
383 367
384static struct platform_driver stmpe_ts_driver = { 368static struct platform_driver stmpe_ts_driver = {
385 .driver = { 369 .driver = {
386 .name = STMPE_TS_NAME, 370 .name = STMPE_TS_NAME,
387 }, 371 },
388 .probe = stmpe_input_probe, 372 .probe = stmpe_input_probe,
389 .remove = stmpe_ts_remove, 373 .remove = stmpe_ts_remove,
390}; 374};
391module_platform_driver(stmpe_ts_driver); 375module_platform_driver(stmpe_ts_driver);
392 376
377static const struct of_device_id stmpe_ts_ids[] = {
378 { .compatible = "st,stmpe-ts", },
379 { },
380};
381MODULE_DEVICE_TABLE(of, stmpe_ts_ids);
382
393MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); 383MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>");
394MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); 384MODULE_DESCRIPTION("STMPEXXX touchscreen driver");
395MODULE_LICENSE("GPL"); 385MODULE_LICENSE("GPL");
396MODULE_ALIAS("platform:" STMPE_TS_NAME);
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 19880c7385e3..f58a196521a9 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -30,7 +30,6 @@
30#include <linux/input/mt.h> 30#include <linux/input/mt.h>
31#include <linux/platform_data/zforce_ts.h> 31#include <linux/platform_data/zforce_ts.h>
32#include <linux/regulator/consumer.h> 32#include <linux/regulator/consumer.h>
33#include <linux/delay.h>
34#include <linux/of.h> 33#include <linux/of.h>
35#include <linux/of_gpio.h> 34#include <linux/of_gpio.h>
36 35
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 966b9605f5f0..4191614c4651 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -11,9 +11,6 @@ menuconfig NEW_LEDS
11 Say Y to enable Linux LED support. This allows control of supported 11 Say Y to enable Linux LED support. This allows control of supported
12 LEDs from both userspace and optionally, by kernel events (triggers). 12 LEDs from both userspace and optionally, by kernel events (triggers).
13 13
14 This is not related to standard keyboard LEDs which are controlled
15 via the input system.
16
17if NEW_LEDS 14if NEW_LEDS
18 15
19config LEDS_CLASS 16config LEDS_CLASS
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 843f2cdc280b..9ffdfcf2ec6e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -55,9 +55,6 @@
55static int __read_mostly sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE; 55static int __read_mostly sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
56static bool __read_mostly sysrq_always_enabled; 56static bool __read_mostly sysrq_always_enabled;
57 57
58unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
59int sysrq_reset_downtime_ms __weak;
60
61static bool sysrq_on(void) 58static bool sysrq_on(void)
62{ 59{
63 return sysrq_enabled || sysrq_always_enabled; 60 return sysrq_enabled || sysrq_always_enabled;
@@ -569,6 +566,7 @@ void handle_sysrq(int key)
569EXPORT_SYMBOL(handle_sysrq); 566EXPORT_SYMBOL(handle_sysrq);
570 567
571#ifdef CONFIG_INPUT 568#ifdef CONFIG_INPUT
569static int sysrq_reset_downtime_ms;
572 570
573/* Simple translation table for the SysRq keys */ 571/* Simple translation table for the SysRq keys */
574static const unsigned char sysrq_xlate[KEY_CNT] = 572static const unsigned char sysrq_xlate[KEY_CNT] =
@@ -949,23 +947,8 @@ static bool sysrq_handler_registered;
949 947
950static inline void sysrq_register_handler(void) 948static inline void sysrq_register_handler(void)
951{ 949{
952 unsigned short key;
953 int error; 950 int error;
954 int i;
955
956 /* First check if a __weak interface was instantiated. */
957 for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
958 key = platform_sysrq_reset_seq[i];
959 if (key == KEY_RESERVED || key > KEY_MAX)
960 break;
961
962 sysrq_reset_seq[sysrq_reset_seq_len++] = key;
963 }
964 951
965 /*
966 * DT configuration takes precedence over anything that would
967 * have been defined via the __weak interface.
968 */
969 sysrq_of_get_keyreset_config(); 952 sysrq_of_get_keyreset_config();
970 953
971 error = input_register_handler(&sysrq_handler); 954 error = input_register_handler(&sysrq_handler);
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index 8a89f6e7715d..6f0336fff501 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -33,6 +33,7 @@
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/leds.h>
36 37
37#include <linux/kbd_kern.h> 38#include <linux/kbd_kern.h>
38#include <linux/kbd_diacr.h> 39#include <linux/kbd_diacr.h>
@@ -129,7 +130,7 @@ static char rep; /* flag telling character repeat */
129 130
130static int shift_state = 0; 131static int shift_state = 0;
131 132
132static unsigned char ledstate = 0xff; /* undefined */ 133static unsigned int ledstate = -1U; /* undefined */
133static unsigned char ledioctl; 134static unsigned char ledioctl;
134 135
135/* 136/*
@@ -961,6 +962,122 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag)
961 } 962 }
962} 963}
963 964
965#if IS_ENABLED(CONFIG_INPUT_LEDS) && IS_ENABLED(CONFIG_LEDS_TRIGGERS)
966
967struct kbd_led_trigger {
968 struct led_trigger trigger;
969 unsigned int mask;
970};
971
972static void kbd_led_trigger_activate(struct led_classdev *cdev)
973{
974 struct kbd_led_trigger *trigger =
975 container_of(cdev->trigger, struct kbd_led_trigger, trigger);
976
977 tasklet_disable(&keyboard_tasklet);
978 if (ledstate != -1U)
979 led_trigger_event(&trigger->trigger,
980 ledstate & trigger->mask ?
981 LED_FULL : LED_OFF);
982 tasklet_enable(&keyboard_tasklet);
983}
984
985#define KBD_LED_TRIGGER(_led_bit, _name) { \
986 .trigger = { \
987 .name = _name, \
988 .activate = kbd_led_trigger_activate, \
989 }, \
990 .mask = BIT(_led_bit), \
991 }
992
993#define KBD_LOCKSTATE_TRIGGER(_led_bit, _name) \
994 KBD_LED_TRIGGER((_led_bit) + 8, _name)
995
996static struct kbd_led_trigger kbd_led_triggers[] = {
997 KBD_LED_TRIGGER(VC_SCROLLOCK, "kbd-scrollock"),
998 KBD_LED_TRIGGER(VC_NUMLOCK, "kbd-numlock"),
999 KBD_LED_TRIGGER(VC_CAPSLOCK, "kbd-capslock"),
1000 KBD_LED_TRIGGER(VC_KANALOCK, "kbd-kanalock"),
1001
1002 KBD_LOCKSTATE_TRIGGER(VC_SHIFTLOCK, "kbd-shiftlock"),
1003 KBD_LOCKSTATE_TRIGGER(VC_ALTGRLOCK, "kbd-altgrlock"),
1004 KBD_LOCKSTATE_TRIGGER(VC_CTRLLOCK, "kbd-ctrllock"),
1005 KBD_LOCKSTATE_TRIGGER(VC_ALTLOCK, "kbd-altlock"),
1006 KBD_LOCKSTATE_TRIGGER(VC_SHIFTLLOCK, "kbd-shiftllock"),
1007 KBD_LOCKSTATE_TRIGGER(VC_SHIFTRLOCK, "kbd-shiftrlock"),
1008 KBD_LOCKSTATE_TRIGGER(VC_CTRLLLOCK, "kbd-ctrlllock"),
1009 KBD_LOCKSTATE_TRIGGER(VC_CTRLRLOCK, "kbd-ctrlrlock"),
1010};
1011
1012static void kbd_propagate_led_state(unsigned int old_state,
1013 unsigned int new_state)
1014{
1015 struct kbd_led_trigger *trigger;
1016 unsigned int changed = old_state ^ new_state;
1017 int i;
1018
1019 for (i = 0; i < ARRAY_SIZE(kbd_led_triggers); i++) {
1020 trigger = &kbd_led_triggers[i];
1021
1022 if (changed & trigger->mask)
1023 led_trigger_event(&trigger->trigger,
1024 new_state & trigger->mask ?
1025 LED_FULL : LED_OFF);
1026 }
1027}
1028
1029static int kbd_update_leds_helper(struct input_handle *handle, void *data)
1030{
1031 unsigned int led_state = *(unsigned int *)data;
1032
1033 if (test_bit(EV_LED, handle->dev->evbit))
1034 kbd_propagate_led_state(~led_state, led_state);
1035
1036 return 0;
1037}
1038
1039static void kbd_init_leds(void)
1040{
1041 int error;
1042 int i;
1043
1044 for (i = 0; i < ARRAY_SIZE(kbd_led_triggers); i++) {
1045 error = led_trigger_register(&kbd_led_triggers[i].trigger);
1046 if (error)
1047 pr_err("error %d while registering trigger %s\n",
1048 error, kbd_led_triggers[i].trigger.name);
1049 }
1050}
1051
1052#else
1053
1054static int kbd_update_leds_helper(struct input_handle *handle, void *data)
1055{
1056 unsigned int leds = *(unsigned int *)data;
1057
1058 if (test_bit(EV_LED, handle->dev->evbit)) {
1059 input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
1060 input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02));
1061 input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04));
1062 input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
1063 }
1064
1065 return 0;
1066}
1067
1068static void kbd_propagate_led_state(unsigned int old_state,
1069 unsigned int new_state)
1070{
1071 input_handler_for_each_handle(&kbd_handler, &new_state,
1072 kbd_update_leds_helper);
1073}
1074
1075static void kbd_init_leds(void)
1076{
1077}
1078
1079#endif
1080
964/* 1081/*
965 * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, 1082 * The leds display either (i) the status of NumLock, CapsLock, ScrollLock,
966 * or (ii) whatever pattern of lights people want to show using KDSETLED, 1083 * or (ii) whatever pattern of lights people want to show using KDSETLED,
@@ -968,7 +1085,7 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag)
968 */ 1085 */
969static unsigned char getledstate(void) 1086static unsigned char getledstate(void)
970{ 1087{
971 return ledstate; 1088 return ledstate & 0xff;
972} 1089}
973 1090
974void setledstate(struct kbd_struct *kb, unsigned int led) 1091void setledstate(struct kbd_struct *kb, unsigned int led)
@@ -995,20 +1112,6 @@ static inline unsigned char getleds(void)
995 return kb->ledflagstate; 1112 return kb->ledflagstate;
996} 1113}
997 1114
998static int kbd_update_leds_helper(struct input_handle *handle, void *data)
999{
1000 unsigned char leds = *(unsigned char *)data;
1001
1002 if (test_bit(EV_LED, handle->dev->evbit)) {
1003 input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
1004 input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02));
1005 input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04));
1006 input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
1007 }
1008
1009 return 0;
1010}
1011
1012/** 1115/**
1013 * vt_get_leds - helper for braille console 1116 * vt_get_leds - helper for braille console
1014 * @console: console to read 1117 * @console: console to read
@@ -1085,24 +1188,23 @@ void vt_kbd_con_stop(int console)
1085} 1188}
1086 1189
1087/* 1190/*
1088 * This is the tasklet that updates LED state on all keyboards 1191 * This is the tasklet that updates LED state of LEDs using standard
1089 * attached to the box. The reason we use tasklet is that we 1192 * keyboard triggers. The reason we use tasklet is that we need to
1090 * need to handle the scenario when keyboard handler is not 1193 * handle the scenario when keyboard handler is not registered yet
1091 * registered yet but we already getting updates from the VT to 1194 * but we already getting updates from the VT to update led state.
1092 * update led state.
1093 */ 1195 */
1094static void kbd_bh(unsigned long dummy) 1196static void kbd_bh(unsigned long dummy)
1095{ 1197{
1096 unsigned char leds; 1198 unsigned int leds;
1097 unsigned long flags; 1199 unsigned long flags;
1098 1200
1099 spin_lock_irqsave(&led_lock, flags); 1201 spin_lock_irqsave(&led_lock, flags);
1100 leds = getleds(); 1202 leds = getleds();
1203 leds |= (unsigned int)kbd->lockstate << 8;
1101 spin_unlock_irqrestore(&led_lock, flags); 1204 spin_unlock_irqrestore(&led_lock, flags);
1102 1205
1103 if (leds != ledstate) { 1206 if (leds != ledstate) {
1104 input_handler_for_each_handle(&kbd_handler, &leds, 1207 kbd_propagate_led_state(ledstate, leds);
1105 kbd_update_leds_helper);
1106 ledstate = leds; 1208 ledstate = leds;
1107 } 1209 }
1108} 1210}
@@ -1450,7 +1552,7 @@ static void kbd_start(struct input_handle *handle)
1450{ 1552{
1451 tasklet_disable(&keyboard_tasklet); 1553 tasklet_disable(&keyboard_tasklet);
1452 1554
1453 if (ledstate != 0xff) 1555 if (ledstate != -1U)
1454 kbd_update_leds_helper(handle, &ledstate); 1556 kbd_update_leds_helper(handle, &ledstate);
1455 1557
1456 tasklet_enable(&keyboard_tasklet); 1558 tasklet_enable(&keyboard_tasklet);
@@ -1497,6 +1599,8 @@ int __init kbd_init(void)
1497 kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE; 1599 kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
1498 } 1600 }
1499 1601
1602 kbd_init_leds();
1603
1500 error = input_register_handler(&kbd_handler); 1604 error = input_register_handler(&kbd_handler);
1501 if (error) 1605 if (error)
1502 return error; 1606 return error;
diff --git a/include/linux/mfd/da9063/pdata.h b/include/linux/mfd/da9063/pdata.h
index 95c8742215a7..612383bd80ae 100644
--- a/include/linux/mfd/da9063/pdata.h
+++ b/include/linux/mfd/da9063/pdata.h
@@ -103,6 +103,7 @@ struct da9063;
103struct da9063_pdata { 103struct da9063_pdata {
104 int (*init)(struct da9063 *da9063); 104 int (*init)(struct da9063 *da9063);
105 int irq_base; 105 int irq_base;
106 bool key_power;
106 unsigned flags; 107 unsigned flags;
107 struct da9063_regulators_pdata *regulators_pdata; 108 struct da9063_regulators_pdata *regulators_pdata;
108 struct led_platform_data *leds_pdata; 109 struct led_platform_data *leds_pdata;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index c9d869027300..cb83883918a7 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -118,47 +118,6 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
118#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) 118#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
119 119
120/** 120/**
121 * struct stmpe_ts_platform_data - stmpe811 touch screen controller platform
122 * data
123 * @sample_time: ADC converstion time in number of clock.
124 * (0 -> 36 clocks, 1 -> 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks,
125 * 4 -> 80 clocks, 5 -> 96 clocks, 6 -> 144 clocks),
126 * recommended is 4.
127 * @mod_12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
128 * @ref_sel: ADC reference source
129 * (0 -> internal reference, 1 -> external reference)
130 * @adc_freq: ADC Clock speed
131 * (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz)
132 * @ave_ctrl: Sample average control
133 * (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 samples, 3 -> 8 samples)
134 * @touch_det_delay: Touch detect interrupt delay
135 * (0 -> 10 us, 1 -> 50 us, 2 -> 100 us, 3 -> 500 us,
136 * 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms)
137 * recommended is 3
138 * @settling: Panel driver settling time
139 * (0 -> 10 us, 1 -> 100 us, 2 -> 500 us, 3 -> 1 ms,
140 * 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms)
141 * recommended is 2
142 * @fraction_z: Length of the fractional part in z
143 * (fraction_z ([0..7]) = Count of the fractional part)
144 * recommended is 7
145 * @i_drive: current limit value of the touchscreen drivers
146 * (0 -> 20 mA typical 35 mA max, 1 -> 50 mA typical 80 mA max)
147 *
148 * */
149struct stmpe_ts_platform_data {
150 u8 sample_time;
151 u8 mod_12b;
152 u8 ref_sel;
153 u8 adc_freq;
154 u8 ave_ctrl;
155 u8 touch_det_delay;
156 u8 settling;
157 u8 fraction_z;
158 u8 i_drive;
159};
160
161/**
162 * struct stmpe_platform_data - STMPE platform data 121 * struct stmpe_platform_data - STMPE platform data
163 * @id: device id to distinguish between multiple STMPEs on the same board 122 * @id: device id to distinguish between multiple STMPEs on the same board
164 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*) 123 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
@@ -168,7 +127,6 @@ struct stmpe_ts_platform_data {
168 * @irq_over_gpio: true if gpio is used to get irq 127 * @irq_over_gpio: true if gpio is used to get irq
169 * @irq_gpio: gpio number over which irq will be requested (significant only if 128 * @irq_gpio: gpio number over which irq will be requested (significant only if
170 * irq_over_gpio is true) 129 * irq_over_gpio is true)
171 * @ts: touchscreen-specific platform data
172 */ 130 */
173struct stmpe_platform_data { 131struct stmpe_platform_data {
174 int id; 132 int id;
@@ -178,8 +136,6 @@ struct stmpe_platform_data {
178 bool irq_over_gpio; 136 bool irq_over_gpio;
179 int irq_gpio; 137 int irq_gpio;
180 int autosleep_timeout; 138 int autosleep_timeout;
181
182 struct stmpe_ts_platform_data *ts;
183}; 139};
184 140
185#endif 141#endif
diff --git a/include/linux/platform_data/keyboard-spear.h b/include/linux/platform_data/keyboard-spear.h
index 9248e3a7e333..5e3ff653900c 100644
--- a/include/linux/platform_data/keyboard-spear.h
+++ b/include/linux/platform_data/keyboard-spear.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 ST Microelectronics 2 * Copyright (C) 2010 ST Microelectronics
3 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 3 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any