aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-07-06 16:51:43 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-07-06 16:51:43 -0400
commitede2e7cdc58e1847cc73bd26b88a634631a43112 (patch)
treef4582f9dc0f4ec8c06975017e036479805d77a4b
parent9768935264c4f0e4afd788a185d8e8d89c28e41d (diff)
parent65938133784a3092c61b00aa63d1830fb465c1ac (diff)
Merge branch 'next' into for-linus
Prepare input updates for 4.13 merge window.
-rw-r--r--Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt21
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/st,stmfts.txt43
-rw-r--r--MAINTAINERS8
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c2
-rw-r--r--drivers/input/input.c12
-rw-r--r--drivers/input/joystick/xpad.c87
-rw-r--r--drivers/input/keyboard/Kconfig11
-rw-r--r--drivers/input/keyboard/Makefile1
-rw-r--r--drivers/input/keyboard/dlink-dir685-touchkeys.c155
-rw-r--r--drivers/input/keyboard/lm8323.c2
-rw-r--r--drivers/input/keyboard/mcs_touchkey.c2
-rw-r--r--drivers/input/misc/axp20x-pek.c28
-rw-r--r--drivers/input/misc/xen-kbdfront.c22
-rw-r--r--drivers/input/mouse/elan_i2c.h3
-rw-r--r--drivers/input/mouse/elan_i2c_core.c40
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c71
-rw-r--r--drivers/input/mouse/elan_i2c_smbus.c9
-rw-r--r--drivers/input/mouse/elantech.c11
-rw-r--r--drivers/input/rmi4/rmi_f34v7.c24
-rw-r--r--drivers/input/sparse-keymap.c14
-rw-r--r--drivers/input/touchscreen/Kconfig11
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/mcs5000_ts.c2
-rw-r--r--drivers/input/touchscreen/mms114.c2
-rw-r--r--drivers/input/touchscreen/s3c2410_ts.c8
-rw-r--r--drivers/input/touchscreen/stmfts.c822
-rw-r--r--drivers/input/touchscreen/tsc2007_core.c2
-rw-r--r--drivers/mfd/timberdale.c2
-rw-r--r--include/linux/input/sparse-keymap.h1
-rw-r--r--include/linux/platform_data/lm8323.h (renamed from include/linux/i2c/lm8323.h)0
-rw-r--r--include/linux/platform_data/mcs.h (renamed from include/linux/i2c/mcs.h)0
-rw-r--r--include/linux/platform_data/mms114.h (renamed from include/linux/i2c/mms114.h)0
-rw-r--r--include/linux/platform_data/tsc2007.h (renamed from include/linux/i2c/tsc2007.h)2
-rw-r--r--include/uapi/linux/input-event-codes.h1
34 files changed, 1349 insertions, 71 deletions
diff --git a/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt b/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt
new file mode 100644
index 000000000000..10dec1c57abf
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt
@@ -0,0 +1,21 @@
1* D-Link DIR-685 Touchkeys
2
3This is a I2C one-off touchkey controller based on the Cypress Semiconductor
4CY8C214 MCU with some firmware in its internal 8KB flash. The circuit
5board inside the router is named E119921.
6
7The touchkey device node should be placed inside an I2C bus node.
8
9Required properties:
10- compatible: must be "dlink,dir685-touchkeys"
11- reg: the I2C address of the touchkeys
12- interrupts: reference to the interrupt number
13
14Example:
15
16touchkeys@26 {
17 compatible = "dlink,dir685-touchkeys";
18 reg = <0x26>;
19 interrupt-parent = <&gpio0>;
20 interrupts = <17 IRQ_TYPE_EDGE_FALLING>;
21};
diff --git a/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.txt b/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.txt
new file mode 100644
index 000000000000..9683595cd0f5
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.txt
@@ -0,0 +1,43 @@
1* ST-Microelectronics FingerTip touchscreen controller
2
3The ST-Microelectronics FingerTip device provides a basic touchscreen
4functionality. Along with it the user can enable the touchkey which can work as
5a basic HOME and BACK key for phones.
6
7The driver supports also hovering as an absolute single touch event with x, y, z
8coordinates.
9
10Required properties:
11- compatible : must be "st,stmfts"
12- reg : I2C slave address, (e.g. 0x49)
13- interrupt-parent : the phandle to the interrupt controller which provides
14 the interrupt
15- interrupts : interrupt specification
16- avdd-supply : analogic power supply
17- vdd-supply : power supply
18- touchscreen-size-x : see touchscreen.txt
19- touchscreen-size-y : see touchscreen.txt
20
21Optional properties:
22- touch-key-connected : specifies whether the touchkey feature is connected
23- ledvdd-supply : power supply to the touch key leds
24
25Example:
26
27i2c@00000000 {
28
29 /* ... */
30
31 touchscreen@49 {
32 compatible = "st,stmfts";
33 reg = <0x49>;
34 interrupt-parent = <&gpa1>;
35 interrupts = <1 IRQ_TYPE_NONE>;
36 touchscreen-size-x = <1599>;
37 touchscreen-size-y = <2559>;
38 touch-key-connected;
39 avdd-supply = <&ldo30_reg>;
40 vdd-supply = <&ldo31_reg>;
41 ledvdd-supply = <&ldo33_reg>;
42 };
43};
diff --git a/MAINTAINERS b/MAINTAINERS
index 053c3bdd1fe5..e14c5aa501ef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3786,6 +3786,12 @@ S: Supported
3786F: drivers/input/touchscreen/cyttsp* 3786F: drivers/input/touchscreen/cyttsp*
3787F: include/linux/input/cyttsp.h 3787F: include/linux/input/cyttsp.h
3788 3788
3789D-LINK DIR-685 TOUCHKEYS DRIVER
3790M: Linus Walleij <linus.walleij@linaro.org>
3791L: linux-input@vger.kernel.org
3792S: Supported
3793F: drivers/input/dlink-dir685-touchkeys.c
3794
3789DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK 3795DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK
3790M: Joshua Kinard <kumba@gentoo.org> 3796M: Joshua Kinard <kumba@gentoo.org>
3791S: Maintained 3797S: Maintained
@@ -6598,8 +6604,10 @@ S: Maintained
6598F: drivers/input/ 6604F: drivers/input/
6599F: include/linux/input.h 6605F: include/linux/input.h
6600F: include/uapi/linux/input.h 6606F: include/uapi/linux/input.h
6607F: include/uapi/linux/input-event-codes.h
6601F: include/linux/input/ 6608F: include/linux/input/
6602F: Documentation/devicetree/bindings/input/ 6609F: Documentation/devicetree/bindings/input/
6610F: Documentation/input/
6603 6611
6604INPUT MULTITOUCH (MT) PROTOCOL 6612INPUT MULTITOUCH (MT) PROTOCOL
6605M: Henrik Rydberg <rydberg@bitmath.org> 6613M: Henrik Rydberg <rydberg@bitmath.org>
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 6d612792f6b8..1faf6cb93dcb 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -24,7 +24,7 @@
24#include <linux/usb/r8a66597.h> 24#include <linux/usb/r8a66597.h>
25#include <linux/usb/renesas_usbhs.h> 25#include <linux/usb/renesas_usbhs.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/i2c/tsc2007.h> 27#include <linux/platform_data/tsc2007.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/sh_msiof.h> 29#include <linux/spi/sh_msiof.h>
30#include <linux/spi/mmc_spi.h> 30#include <linux/spi/mmc_spi.h>
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 067d648028a2..7e6842bd525c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -481,7 +481,7 @@ EXPORT_SYMBOL(input_inject_event);
481void input_alloc_absinfo(struct input_dev *dev) 481void input_alloc_absinfo(struct input_dev *dev)
482{ 482{
483 if (!dev->absinfo) 483 if (!dev->absinfo)
484 dev->absinfo = kcalloc(ABS_CNT, sizeof(struct input_absinfo), 484 dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo),
485 GFP_KERNEL); 485 GFP_KERNEL);
486 486
487 WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__); 487 WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__);
@@ -1126,7 +1126,7 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
1126 * If no output was produced print a single 0. 1126 * If no output was produced print a single 0.
1127 */ 1127 */
1128 if (skip_empty) 1128 if (skip_empty)
1129 seq_puts(seq, "0"); 1129 seq_putc(seq, '0');
1130 1130
1131 seq_putc(seq, '\n'); 1131 seq_putc(seq, '\n');
1132} 1132}
@@ -1144,7 +1144,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
1144 seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : ""); 1144 seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : "");
1145 seq_printf(seq, "S: Sysfs=%s\n", path ? path : ""); 1145 seq_printf(seq, "S: Sysfs=%s\n", path ? path : "");
1146 seq_printf(seq, "U: Uniq=%s\n", dev->uniq ? dev->uniq : ""); 1146 seq_printf(seq, "U: Uniq=%s\n", dev->uniq ? dev->uniq : "");
1147 seq_printf(seq, "H: Handlers="); 1147 seq_puts(seq, "H: Handlers=");
1148 1148
1149 list_for_each_entry(handle, &dev->h_list, d_node) 1149 list_for_each_entry(handle, &dev->h_list, d_node)
1150 seq_printf(seq, "%s ", handle->name); 1150 seq_printf(seq, "%s ", handle->name);
@@ -1783,7 +1783,7 @@ struct input_dev *input_allocate_device(void)
1783 static atomic_t input_no = ATOMIC_INIT(-1); 1783 static atomic_t input_no = ATOMIC_INIT(-1);
1784 struct input_dev *dev; 1784 struct input_dev *dev;
1785 1785
1786 dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); 1786 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
1787 if (dev) { 1787 if (dev) {
1788 dev->dev.type = &input_dev_type; 1788 dev->dev.type = &input_dev_type;
1789 dev->dev.class = &input_class; 1789 dev->dev.class = &input_class;
@@ -1849,7 +1849,7 @@ struct input_dev *devm_input_allocate_device(struct device *dev)
1849 struct input_devres *devres; 1849 struct input_devres *devres;
1850 1850
1851 devres = devres_alloc(devm_input_device_release, 1851 devres = devres_alloc(devm_input_device_release,
1852 sizeof(struct input_devres), GFP_KERNEL); 1852 sizeof(*devres), GFP_KERNEL);
1853 if (!devres) 1853 if (!devres)
1854 return NULL; 1854 return NULL;
1855 1855
@@ -2099,7 +2099,7 @@ int input_register_device(struct input_dev *dev)
2099 2099
2100 if (dev->devres_managed) { 2100 if (dev->devres_managed) {
2101 devres = devres_alloc(devm_input_device_unregister, 2101 devres = devres_alloc(devm_input_device_unregister,
2102 sizeof(struct input_devres), GFP_KERNEL); 2102 sizeof(*devres), GFP_KERNEL);
2103 if (!devres) 2103 if (!devres)
2104 return -ENOMEM; 2104 return -ENOMEM;
2105 2105
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index def96cd2479b..298a6ba51411 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -126,13 +126,18 @@ static const struct xpad_device {
126 u8 mapping; 126 u8 mapping;
127 u8 xtype; 127 u8 xtype;
128} xpad_device[] = { 128} xpad_device[] = {
129 { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX },
130 { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX },
129 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, 131 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
132 { 0x044f, 0x0f10, "Thrustmaster Modena GT Wheel", 0, XTYPE_XBOX },
130 { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, 133 { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 },
131 { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, 134 { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
132 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, 135 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
133 { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, 136 { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
137 { 0x045e, 0x0288, "Microsoft Xbox Controller S v2", 0, XTYPE_XBOX },
134 { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, 138 { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
135 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, 139 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
140 { 0x045e, 0x028f, "Microsoft X-Box 360 pad v2", 0, XTYPE_XBOX360 },
136 { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, 141 { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
137 { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, 142 { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE },
138 { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, 143 { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE },
@@ -145,28 +150,52 @@ static const struct xpad_device {
145 { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, 150 { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
146 { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, 151 { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
147 { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, 152 { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
153 { 0x046d, 0xca8a, "Logitech Precision Vibration Feedback Wheel", 0, XTYPE_XBOX },
154 { 0x046d, 0xcaa3, "Logitech DriveFx Racing Wheel", 0, XTYPE_XBOX360 },
148 { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 }, 155 { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 },
149 { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, 156 { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
150 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, 157 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
158 { 0x05fe, 0x3030, "Chic Controller", 0, XTYPE_XBOX },
159 { 0x05fe, 0x3031, "Chic Controller", 0, XTYPE_XBOX },
160 { 0x062a, 0x0020, "Logic3 Xbox GamePad", 0, XTYPE_XBOX },
161 { 0x062a, 0x0033, "Competition Pro Steering Wheel", 0, XTYPE_XBOX },
162 { 0x06a3, 0x0200, "Saitek Racing Wheel", 0, XTYPE_XBOX },
163 { 0x06a3, 0x0201, "Saitek Adrenalin", 0, XTYPE_XBOX },
164 { 0x06a3, 0xf51a, "Saitek P3600", 0, XTYPE_XBOX360 },
165 { 0x0738, 0x4506, "Mad Catz 4506 Wireless Controller", 0, XTYPE_XBOX },
151 { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, 166 { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
167 { 0x0738, 0x4520, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
152 { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX }, 168 { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX },
153 { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX }, 169 { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
170 { 0x0738, 0x4530, "Mad Catz Universal MC2 Racing Wheel and Pedals", 0, XTYPE_XBOX },
154 { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX }, 171 { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX },
155 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 172 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
156 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX }, 173 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX },
174 { 0x0738, 0x4586, "Mad Catz MicroCon Wireless Controller", 0, XTYPE_XBOX },
175 { 0x0738, 0x4588, "Mad Catz Blaster", 0, XTYPE_XBOX },
176 { 0x0738, 0x45ff, "Mad Catz Beat Pad (w/ Handle)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
157 { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, 177 { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
158 { 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 }, 178 { 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 },
159 { 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, 179 { 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
160 { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 180 { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
181 { 0x0738, 0x4736, "Mad Catz MicroCon Gamepad", 0, XTYPE_XBOX360 },
161 { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 182 { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
162 { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, 183 { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 },
184 { 0x0738, 0x4743, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
185 { 0x0738, 0x4758, "Mad Catz Arcade Game Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
163 { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, 186 { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
164 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 187 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
188 { 0x0738, 0x9871, "Mad Catz Portable Drum", 0, XTYPE_XBOX360 },
165 { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, 189 { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 },
190 { 0x0738, 0xb738, "Mad Catz MVC2TE Stick 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
166 { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 }, 191 { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 },
167 { 0x0738, 0xcb02, "Saitek Cyborg Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 }, 192 { 0x0738, 0xcb02, "Saitek Cyborg Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
168 { 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 }, 193 { 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 },
194 { 0x0738, 0xcb29, "Saitek Aviator Stick AV8R02", 0, XTYPE_XBOX360 },
169 { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 }, 195 { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 },
196 { 0x07ff, 0xffff, "Mad Catz GamePad", 0, XTYPE_XBOX360 },
197 { 0x0c12, 0x0005, "Intec wireless", 0, XTYPE_XBOX },
198 { 0x0c12, 0x8801, "Nyko Xbox Controller", 0, XTYPE_XBOX },
170 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, 199 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
171 { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX }, 200 { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX },
172 { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, 201 { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
@@ -174,37 +203,63 @@ static const struct xpad_device {
174 { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, 203 { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
175 { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 204 { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
176 { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, 205 { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
206 { 0x0e4c, 0x1103, "Radica Gamester Reflex", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX },
177 { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, 207 { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
208 { 0x0e4c, 0x3510, "Radica Gamester", 0, XTYPE_XBOX },
178 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, 209 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
179 { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX }, 210 { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX },
180 { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, 211 { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
212 { 0x0e6f, 0x0008, "After Glow Pro Controller", 0, XTYPE_XBOX },
181 { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 213 { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
182 { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 214 { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
183 { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 }, 215 { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 },
216 { 0x0e6f, 0x0131, "PDP EA Sports Controller", 0, XTYPE_XBOX360 },
217 { 0x0e6f, 0x0133, "Xbox 360 Wired Controller", 0, XTYPE_XBOX360 },
184 { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, 218 { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
219 { 0x0e6f, 0x013a, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
185 { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, 220 { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE },
221 { 0x0e6f, 0x0147, "PDP Marvel Xbox One Controller", 0, XTYPE_XBOXONE },
222 { 0x0e6f, 0x015c, "PDP Xbox One Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
223 { 0x0e6f, 0x0161, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
224 { 0x0e6f, 0x0162, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
225 { 0x0e6f, 0x0163, "PDP Xbox One Controller", 0, XTYPE_XBOXONE },
226 { 0x0e6f, 0x0164, "PDP Battlefield One", 0, XTYPE_XBOXONE },
227 { 0x0e6f, 0x0165, "PDP Titanfall 2", 0, XTYPE_XBOXONE },
186 { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, 228 { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
187 { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 229 { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
188 { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 230 { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
231 { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE },
189 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, 232 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
233 { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE },
190 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, 234 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
191 { 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 235 { 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
236 { 0x0e6f, 0x0501, "PDP Xbox 360 Controller", 0, XTYPE_XBOX360 },
237 { 0x0e6f, 0xf900, "PDP Afterglow AX.1", 0, XTYPE_XBOX360 },
192 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, 238 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
193 { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX }, 239 { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
194 { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, 240 { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 },
241 { 0x0f0d, 0x000c, "Hori PadEX Turbo", 0, XTYPE_XBOX360 },
195 { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 242 { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
196 { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 243 { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
244 { 0x0f0d, 0x001b, "Hori Real Arcade Pro VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
245 { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
197 { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, 246 { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
247 { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
248 { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
198 { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, 249 { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
199 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, 250 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
200 { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, 251 { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX },
252 { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 },
201 { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 253 { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
202 { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, 254 { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
255 { 0x12ab, 0x0303, "Mortal Kombat Klassic FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
203 { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 256 { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
204 { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 }, 257 { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
205 { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 258 { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
259 { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 },
206 { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, 260 { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
207 { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, 261 { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 },
262 { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
208 { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, 263 { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE },
209 { 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 }, 264 { 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 },
210 { 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, 265 { 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
@@ -215,22 +270,44 @@ static const struct xpad_device {
215 { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, 270 { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 },
216 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, 271 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
217 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 272 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
273 { 0x1bad, 0x0130, "Ion Drum Rocker", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
218 { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, 274 { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
219 { 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 275 { 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
220 { 0x1bad, 0xf019, "Mad Catz Brawlstick for Xbox 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 276 { 0x1bad, 0xf019, "Mad Catz Brawlstick for Xbox 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
221 { 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 }, 277 { 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 },
222 { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 }, 278 { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 },
279 { 0x1bad, 0xf025, "Mad Catz Call Of Duty", 0, XTYPE_XBOX360 },
280 { 0x1bad, 0xf027, "Mad Catz FPS Pro", 0, XTYPE_XBOX360 },
223 { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, 281 { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 },
224 { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 282 { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
283 { 0x1bad, 0xf030, "Mad Catz Xbox 360 MC2 MicroCon Racing Wheel", 0, XTYPE_XBOX360 },
284 { 0x1bad, 0xf036, "Mad Catz MicroCon GamePad Pro", 0, XTYPE_XBOX360 },
225 { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 }, 285 { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 },
286 { 0x1bad, 0xf039, "Mad Catz MvC2 TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
226 { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 287 { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
288 { 0x1bad, 0xf03d, "Street Fighter IV Arcade Stick TE - Chun Li", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
289 { 0x1bad, 0xf03e, "Mad Catz MLG FightStick TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
290 { 0x1bad, 0xf03f, "Mad Catz FightStick SoulCaliber", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
291 { 0x1bad, 0xf042, "Mad Catz FightStick TES+", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
292 { 0x1bad, 0xf080, "Mad Catz FightStick TE2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
293 { 0x1bad, 0xf501, "HoriPad EX2 Turbo", 0, XTYPE_XBOX360 },
294 { 0x1bad, 0xf502, "Hori Real Arcade Pro.VX SA", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
295 { 0x1bad, 0xf503, "Hori Fighting Stick VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
296 { 0x1bad, 0xf504, "Hori Real Arcade Pro. EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
297 { 0x1bad, 0xf505, "Hori Fighting Stick EX2B", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
298 { 0x1bad, 0xf506, "Hori Real Arcade Pro.EX Premium VLX", 0, XTYPE_XBOX360 },
227 { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 }, 299 { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 },
228 { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 }, 300 { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 },
229 { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 }, 301 { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 },
302 { 0x1bad, 0xf904, "PDP Versus Fighting Pad", 0, XTYPE_XBOX360 },
303 { 0x1bad, 0xf906, "MortalKombat FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
230 { 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 }, 304 { 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 },
305 { 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 },
306 { 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 },
231 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 307 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
232 { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, 308 { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 },
233 { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, 309 { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
310 { 0x24c6, 0x530a, "Xbox 360 Pro EX Controller", 0, XTYPE_XBOX360 },
234 { 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 }, 311 { 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 },
235 { 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 }, 312 { 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 },
236 { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, 313 { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE },
@@ -238,12 +315,19 @@ static const struct xpad_device {
238 { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, 315 { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE },
239 { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, 316 { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 },
240 { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, 317 { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 },
318 { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
241 { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 319 { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
242 { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, 320 { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 },
243 { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, 321 { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 },
322 { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
323 { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE },
324 { 0x24c6, 0x561a, "PowerA FUSION Controller", 0, XTYPE_XBOXONE },
325 { 0x24c6, 0x5b00, "ThrustMaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
244 { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 }, 326 { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 },
245 { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, 327 { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
246 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, 328 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
329 { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
330 { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX },
247 { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, 331 { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
248 { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } 332 { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
249}; 333};
@@ -331,13 +415,16 @@ static struct usb_device_id xpad_table[] = {
331 XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ 415 XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */
332 XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ 416 XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */
333 XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */ 417 XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */
418 XPAD_XBOX360_VENDOR(0x06a3), /* Saitek P3600 */
334 XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ 419 XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */
335 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ 420 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */
336 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ 421 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */
422 XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */
337 XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ 423 XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */
338 XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ 424 XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */
339 XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ 425 XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */
340 XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ 426 XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */
427 XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */
341 XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ 428 XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */
342 XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ 429 XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */
343 XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ 430 XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 97acd6524ad7..4c4ab1ced235 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -178,6 +178,17 @@ config KEYBOARD_CLPS711X
178 To compile this driver as a module, choose M here: the 178 To compile this driver as a module, choose M here: the
179 module will be called clps711x-keypad. 179 module will be called clps711x-keypad.
180 180
181config KEYBOARD_DLINK_DIR685
182 tristate "D-Link DIR-685 touchkeys support"
183 depends on I2C
184 default ARCH_GEMINI
185 help
186 If you say yes here you get support for the D-Link DIR-685
187 touchkeys.
188
189 To compile this driver as a module, choose M here: the
190 module will be called dlink-dir685-touchkeys.
191
181config KEYBOARD_LKKBD 192config KEYBOARD_LKKBD
182 tristate "DECstation/VAXstation LK201/LK401 keyboard" 193 tristate "DECstation/VAXstation LK201/LK401 keyboard"
183 select SERIO 194 select SERIO
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 7d9acff819a7..d2338bacdad1 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o
17obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o 17obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o
18obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o 18obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o
19obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o 19obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
20obj-$(CONFIG_KEYBOARD_DLINK_DIR685) += dlink-dir685-touchkeys.o
20obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o 21obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o
21obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o 22obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o
22obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 23obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c
new file mode 100644
index 000000000000..88e321b76397
--- /dev/null
+++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c
@@ -0,0 +1,155 @@
1/*
2 * D-Link DIR-685 router I2C-based Touchkeys input driver
3 * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
4 *
5 * This is a one-off touchkey controller based on the Cypress Semiconductor
6 * CY8C214 MCU with some firmware in its internal 8KB flash. The circuit
7 * board inside the router is named E119921
8 */
9
10#include <linux/module.h>
11#include <linux/i2c.h>
12#include <linux/interrupt.h>
13#include <linux/delay.h>
14#include <linux/input.h>
15#include <linux/slab.h>
16#include <linux/bitops.h>
17
18struct dir685_touchkeys {
19 struct device *dev;
20 struct i2c_client *client;
21 struct input_dev *input;
22 unsigned long cur_key;
23 u16 codes[7];
24};
25
26static irqreturn_t dir685_tk_irq_thread(int irq, void *data)
27{
28 struct dir685_touchkeys *tk = data;
29 const int num_bits = min_t(int, ARRAY_SIZE(tk->codes), 16);
30 unsigned long changed;
31 u8 buf[6];
32 unsigned long key;
33 int i;
34 int err;
35
36 memset(buf, 0, sizeof(buf));
37 err = i2c_master_recv(tk->client, buf, sizeof(buf));
38 if (err != sizeof(buf)) {
39 dev_err(tk->dev, "short read %d\n", err);
40 return IRQ_HANDLED;
41 }
42
43 dev_dbg(tk->dev, "IN: %*ph\n", (int)sizeof(buf), buf);
44 key = be16_to_cpup((__be16 *) &buf[4]);
45
46 /* Figure out if any bits went high or low since last message */
47 changed = tk->cur_key ^ key;
48 for_each_set_bit(i, &changed, num_bits) {
49 dev_dbg(tk->dev, "key %d is %s\n", i,
50 test_bit(i, &key) ? "down" : "up");
51 input_report_key(tk->input, tk->codes[i], test_bit(i, &key));
52 }
53
54 /* Store currently down keys */
55 tk->cur_key = key;
56 input_sync(tk->input);
57
58 return IRQ_HANDLED;
59}
60
61static int dir685_tk_probe(struct i2c_client *client,
62 const struct i2c_device_id *id)
63{
64 struct dir685_touchkeys *tk;
65 struct device *dev = &client->dev;
66 u8 bl_data[] = { 0xa7, 0x40 };
67 int err;
68 int i;
69
70 tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL);
71 if (!tk)
72 return -ENOMEM;
73
74 tk->input = devm_input_allocate_device(dev);
75 if (!tk->input)
76 return -ENOMEM;
77
78 tk->client = client;
79 tk->dev = dev;
80
81 tk->input->keycodesize = sizeof(u16);
82 tk->input->keycodemax = ARRAY_SIZE(tk->codes);
83 tk->input->keycode = tk->codes;
84 tk->codes[0] = KEY_UP;
85 tk->codes[1] = KEY_DOWN;
86 tk->codes[2] = KEY_LEFT;
87 tk->codes[3] = KEY_RIGHT;
88 tk->codes[4] = KEY_ENTER;
89 tk->codes[5] = KEY_WPS_BUTTON;
90 /*
91 * This key appears in the vendor driver, but I have
92 * not been able to activate it.
93 */
94 tk->codes[6] = KEY_RESERVED;
95
96 __set_bit(EV_KEY, tk->input->evbit);
97 for (i = 0; i < ARRAY_SIZE(tk->codes); i++)
98 __set_bit(tk->codes[i], tk->input->keybit);
99 __clear_bit(KEY_RESERVED, tk->input->keybit);
100
101 tk->input->name = "D-Link DIR-685 touchkeys";
102 tk->input->id.bustype = BUS_I2C;
103
104 err = input_register_device(tk->input);
105 if (err)
106 return err;
107
108 /* Set the brightness to max level */
109 err = i2c_master_send(client, bl_data, sizeof(bl_data));
110 if (err != sizeof(bl_data))
111 dev_warn(tk->dev, "error setting brightness level\n");
112
113 if (!client->irq) {
114 dev_err(dev, "no IRQ on the I2C device\n");
115 return -ENODEV;
116 }
117 err = devm_request_threaded_irq(dev, client->irq,
118 NULL, dir685_tk_irq_thread,
119 IRQF_ONESHOT,
120 "dir685-tk", tk);
121 if (err) {
122 dev_err(dev, "can't request IRQ\n");
123 return err;
124 }
125
126 return 0;
127}
128
129static const struct i2c_device_id dir685_tk_id[] = {
130 { "dir685tk", 0 },
131 { }
132};
133MODULE_DEVICE_TABLE(i2c, dir685_tk_id);
134
135#ifdef CONFIG_OF
136static const struct of_device_id dir685_tk_of_match[] = {
137 { .compatible = "dlink,dir685-touchkeys" },
138 {},
139};
140MODULE_DEVICE_TABLE(of, dir685_tk_of_match);
141#endif
142
143static struct i2c_driver dir685_tk_i2c_driver = {
144 .driver = {
145 .name = "dlin-dir685-touchkeys",
146 .of_match_table = of_match_ptr(dir685_tk_of_match),
147 },
148 .probe = dir685_tk_probe,
149 .id_table = dir685_tk_id,
150};
151module_i2c_driver(dir685_tk_i2c_driver);
152
153MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
154MODULE_DESCRIPTION("D-Link DIR-685 touchkeys driver");
155MODULE_LICENSE("GPL");
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index 21bea52d4365..04a5d7e134d7 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -30,8 +30,8 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/input.h> 31#include <linux/input.h>
32#include <linux/leds.h> 32#include <linux/leds.h>
33#include <linux/platform_data/lm8323.h>
33#include <linux/pm.h> 34#include <linux/pm.h>
34#include <linux/i2c/lm8323.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36 36
37/* Commands to send to the chip. */ 37/* Commands to send to the chip. */
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c
index 31090d71a685..be56d4f262a7 100644
--- a/drivers/input/keyboard/mcs_touchkey.c
+++ b/drivers/input/keyboard/mcs_touchkey.c
@@ -13,11 +13,11 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/i2c/mcs.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
18#include <linux/input.h> 17#include <linux/input.h>
19#include <linux/irq.h> 18#include <linux/irq.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/platform_data/mcs.h>
21#include <linux/pm.h> 21#include <linux/pm.h>
22 22
23/* MCS5000 Touchkey */ 23/* MCS5000 Touchkey */
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 400869e61a06..38c79ebff033 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -253,6 +253,9 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
253 return error; 253 return error;
254 } 254 }
255 255
256 if (axp20x_pek->axp20x->variant == AXP288_ID)
257 enable_irq_wake(axp20x_pek->irq_dbr);
258
256 return 0; 259 return 0;
257} 260}
258 261
@@ -331,10 +334,35 @@ static int axp20x_pek_probe(struct platform_device *pdev)
331 return 0; 334 return 0;
332} 335}
333 336
337static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
338{
339 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
340
341 if (axp20x_pek->axp20x->variant != AXP288_ID)
342 return 0;
343
344 /*
345 * Clear interrupts from button presses during suspend, to avoid
346 * a wakeup power-button press getting reported to userspace.
347 */
348 regmap_write(axp20x_pek->axp20x->regmap,
349 AXP20X_IRQ1_STATE + AXP288_IRQ_POKN / 8,
350 BIT(AXP288_IRQ_POKN % 8));
351
352 return 0;
353}
354
355static const struct dev_pm_ops axp20x_pek_pm_ops = {
356#ifdef CONFIG_PM_SLEEP
357 .resume_noirq = axp20x_pek_resume_noirq,
358#endif
359};
360
334static struct platform_driver axp20x_pek_driver = { 361static struct platform_driver axp20x_pek_driver = {
335 .probe = axp20x_pek_probe, 362 .probe = axp20x_pek_probe,
336 .driver = { 363 .driver = {
337 .name = "axp20x-pek", 364 .name = "axp20x-pek",
365 .pm = &axp20x_pek_pm_ops,
338 }, 366 },
339}; 367};
340module_platform_driver(axp20x_pek_driver); 368module_platform_driver(axp20x_pek_driver);
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 690148f9940e..eb770613a9bd 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device *dev,
135 goto error_nomem; 135 goto error_nomem;
136 136
137 /* Set input abs params to match backend screen res */ 137 /* Set input abs params to match backend screen res */
138 abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0); 138 abs = xenbus_read_unsigned(dev->otherend,
139 ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width", 139 XENKBD_FIELD_FEAT_ABS_POINTER, 0);
140 ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
141 XENKBD_FIELD_WIDTH,
140 ptr_size[KPARAM_X]); 142 ptr_size[KPARAM_X]);
141 ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height", 143 ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
144 XENKBD_FIELD_HEIGHT,
142 ptr_size[KPARAM_Y]); 145 ptr_size[KPARAM_Y]);
143 if (abs) { 146 if (abs) {
144 ret = xenbus_write(XBT_NIL, dev->nodename, 147 ret = xenbus_write(XBT_NIL, dev->nodename,
145 "request-abs-pointer", "1"); 148 XENKBD_FIELD_REQ_ABS_POINTER, "1");
146 if (ret) { 149 if (ret) {
147 pr_warn("xenkbd: can't request abs-pointer\n"); 150 pr_warn("xenkbd: can't request abs-pointer\n");
148 abs = 0; 151 abs = 0;
@@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
271 xenbus_dev_fatal(dev, ret, "starting transaction"); 274 xenbus_dev_fatal(dev, ret, "starting transaction");
272 goto error_irqh; 275 goto error_irqh;
273 } 276 }
274 ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu", 277 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu",
275 virt_to_gfn(info->page)); 278 virt_to_gfn(info->page));
276 if (ret) 279 if (ret)
277 goto error_xenbus; 280 goto error_xenbus;
278 ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref); 281 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
282 "%u", info->gref);
279 if (ret) 283 if (ret)
280 goto error_xenbus; 284 goto error_xenbus;
281 ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u", 285 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u",
282 evtchn); 286 evtchn);
283 if (ret) 287 if (ret)
284 goto error_xenbus; 288 goto error_xenbus;
@@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
353} 357}
354 358
355static const struct xenbus_device_id xenkbd_ids[] = { 359static const struct xenbus_device_id xenkbd_ids[] = {
356 { "vkbd" }, 360 { XENKBD_DRIVER_NAME },
357 { "" } 361 { "" }
358}; 362};
359 363
@@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
390 394
391MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend"); 395MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
392MODULE_LICENSE("GPL"); 396MODULE_LICENSE("GPL");
393MODULE_ALIAS("xen:vkbd"); 397MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index c0ec26118732..61c202436250 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -58,7 +58,7 @@ struct elan_transport_ops {
58 58
59 int (*get_version)(struct i2c_client *client, bool iap, u8 *version); 59 int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
60 int (*get_sm_version)(struct i2c_client *client, 60 int (*get_sm_version)(struct i2c_client *client,
61 u8* ic_type, u8 *version); 61 u16 *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, u16 *id); 63 int (*get_product_id)(struct i2c_client *client, u16 *id);
64 64
@@ -82,6 +82,7 @@ struct elan_transport_ops {
82 int (*get_report)(struct i2c_client *client, u8 *report); 82 int (*get_report)(struct i2c_client *client, u8 *report);
83 int (*get_pressure_adjustment)(struct i2c_client *client, 83 int (*get_pressure_adjustment)(struct i2c_client *client,
84 int *adjustment); 84 int *adjustment);
85 int (*get_pattern)(struct i2c_client *client, u8 *pattern);
85}; 86};
86 87
87extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops; 88extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index d5ab9ddef3e3..3b616cb7c67f 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> 6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
7 * Author: KT Liao <kt.liao@emc.com.tw> 7 * Author: KT Liao <kt.liao@emc.com.tw>
8 * Version: 1.6.2 8 * Version: 1.6.3
9 * 9 *
10 * Based on cyapa driver: 10 * Based on cyapa driver:
11 * copyright (c) 2011-2012 Cypress Semiconductor, Inc. 11 * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -41,7 +41,7 @@
41#include "elan_i2c.h" 41#include "elan_i2c.h"
42 42
43#define DRIVER_NAME "elan_i2c" 43#define DRIVER_NAME "elan_i2c"
44#define ELAN_DRIVER_VERSION "1.6.2" 44#define ELAN_DRIVER_VERSION "1.6.3"
45#define ELAN_VENDOR_ID 0x04f3 45#define ELAN_VENDOR_ID 0x04f3
46#define ETP_MAX_PRESSURE 255 46#define ETP_MAX_PRESSURE 255
47#define ETP_FWIDTH_REDUCE 90 47#define ETP_FWIDTH_REDUCE 90
@@ -78,6 +78,7 @@ struct elan_tp_data {
78 unsigned int x_res; 78 unsigned int x_res;
79 unsigned int y_res; 79 unsigned int y_res;
80 80
81 u8 pattern;
81 u16 product_id; 82 u16 product_id;
82 u8 fw_version; 83 u8 fw_version;
83 u8 sm_version; 84 u8 sm_version;
@@ -85,7 +86,7 @@ struct elan_tp_data {
85 u16 fw_checksum; 86 u16 fw_checksum;
86 int pressure_adjustment; 87 int pressure_adjustment;
87 u8 mode; 88 u8 mode;
88 u8 ic_type; 89 u16 ic_type;
89 u16 fw_validpage_count; 90 u16 fw_validpage_count;
90 u16 fw_signature_address; 91 u16 fw_signature_address;
91 92
@@ -96,10 +97,10 @@ struct elan_tp_data {
96 bool baseline_ready; 97 bool baseline_ready;
97}; 98};
98 99
99static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, 100static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
100 u16 *signature_address) 101 u16 *signature_address)
101{ 102{
102 switch (iap_version) { 103 switch (ic_type) {
103 case 0x00: 104 case 0x00:
104 case 0x06: 105 case 0x06:
105 case 0x08: 106 case 0x08:
@@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
119 case 0x0E: 120 case 0x0E:
120 *validpage_count = 640; 121 *validpage_count = 640;
121 break; 122 break;
123 case 0x10:
124 *validpage_count = 1024;
125 break;
122 default: 126 default:
123 /* unknown ic type clear value */ 127 /* unknown ic type clear value */
124 *validpage_count = 0; 128 *validpage_count = 0;
@@ -305,6 +309,7 @@ static int elan_initialize(struct elan_tp_data *data)
305static int elan_query_device_info(struct elan_tp_data *data) 309static int elan_query_device_info(struct elan_tp_data *data)
306{ 310{
307 int error; 311 int error;
312 u16 ic_type;
308 313
309 error = data->ops->get_version(data->client, false, &data->fw_version); 314 error = data->ops->get_version(data->client, false, &data->fw_version);
310 if (error) 315 if (error)
@@ -324,7 +329,16 @@ static int elan_query_device_info(struct elan_tp_data *data)
324 if (error) 329 if (error)
325 return error; 330 return error;
326 331
327 error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, 332 error = data->ops->get_pattern(data->client, &data->pattern);
333 if (error)
334 return error;
335
336 if (data->pattern == 0x01)
337 ic_type = data->ic_type;
338 else
339 ic_type = data->iap_version;
340
341 error = elan_get_fwinfo(ic_type, &data->fw_validpage_count,
328 &data->fw_signature_address); 342 &data->fw_signature_address);
329 if (error) 343 if (error)
330 dev_warn(&data->client->dev, 344 dev_warn(&data->client->dev,
@@ -1077,6 +1091,13 @@ static int elan_probe(struct i2c_client *client,
1077 return error; 1091 return error;
1078 } 1092 }
1079 1093
1094 /* Make sure there is something at this address */
1095 error = i2c_smbus_read_byte(client);
1096 if (error < 0) {
1097 dev_dbg(&client->dev, "nothing at this address: %d\n", error);
1098 return -ENXIO;
1099 }
1100
1080 /* Initialize the touchpad. */ 1101 /* Initialize the touchpad. */
1081 error = elan_initialize(data); 1102 error = elan_initialize(data);
1082 if (error) 1103 if (error)
@@ -1101,10 +1122,13 @@ static int elan_probe(struct i2c_client *client,
1101 "Elan Touchpad Extra Information:\n" 1122 "Elan Touchpad Extra Information:\n"
1102 " Max ABS X,Y: %d,%d\n" 1123 " Max ABS X,Y: %d,%d\n"
1103 " Width X,Y: %d,%d\n" 1124 " Width X,Y: %d,%d\n"
1104 " Resolution X,Y: %d,%d (dots/mm)\n", 1125 " Resolution X,Y: %d,%d (dots/mm)\n"
1126 " ic type: 0x%x\n"
1127 " info pattern: 0x%x\n",
1105 data->max_x, data->max_y, 1128 data->max_x, data->max_y,
1106 data->width_x, data->width_y, 1129 data->width_x, data->width_y,
1107 data->x_res, data->y_res); 1130 data->x_res, data->y_res,
1131 data->ic_type, data->pattern);
1108 1132
1109 /* Set up input device properties based on queried parameters. */ 1133 /* Set up input device properties based on queried parameters. */
1110 error = elan_setup_input_device(data); 1134 error = elan_setup_input_device(data);
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index f431da07f861..80172f25974d 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -34,9 +34,12 @@
34#define ETP_I2C_DESC_CMD 0x0001 34#define ETP_I2C_DESC_CMD 0x0001
35#define ETP_I2C_REPORT_DESC_CMD 0x0002 35#define ETP_I2C_REPORT_DESC_CMD 0x0002
36#define ETP_I2C_STAND_CMD 0x0005 36#define ETP_I2C_STAND_CMD 0x0005
37#define ETP_I2C_PATTERN_CMD 0x0100
37#define ETP_I2C_UNIQUEID_CMD 0x0101 38#define ETP_I2C_UNIQUEID_CMD 0x0101
38#define ETP_I2C_FW_VERSION_CMD 0x0102 39#define ETP_I2C_FW_VERSION_CMD 0x0102
39#define ETP_I2C_SM_VERSION_CMD 0x0103 40#define ETP_I2C_IC_TYPE_CMD 0x0103
41#define ETP_I2C_OSM_VERSION_CMD 0x0103
42#define ETP_I2C_NSM_VERSION_CMD 0x0104
40#define ETP_I2C_XY_TRACENUM_CMD 0x0105 43#define ETP_I2C_XY_TRACENUM_CMD 0x0105
41#define ETP_I2C_MAX_X_AXIS_CMD 0x0106 44#define ETP_I2C_MAX_X_AXIS_CMD 0x0106
42#define ETP_I2C_MAX_Y_AXIS_CMD 0x0107 45#define ETP_I2C_MAX_Y_AXIS_CMD 0x0107
@@ -239,12 +242,34 @@ static int elan_i2c_get_baseline_data(struct i2c_client *client,
239 return 0; 242 return 0;
240} 243}
241 244
245static int elan_i2c_get_pattern(struct i2c_client *client, u8 *pattern)
246{
247 int error;
248 u8 val[3];
249
250 error = elan_i2c_read_cmd(client, ETP_I2C_PATTERN_CMD, val);
251 if (error) {
252 dev_err(&client->dev, "failed to get pattern: %d\n", error);
253 return error;
254 }
255 *pattern = val[1];
256
257 return 0;
258}
259
242static int elan_i2c_get_version(struct i2c_client *client, 260static int elan_i2c_get_version(struct i2c_client *client,
243 bool iap, u8 *version) 261 bool iap, u8 *version)
244{ 262{
245 int error; 263 int error;
264 u8 pattern_ver;
246 u8 val[3]; 265 u8 val[3];
247 266
267 error = elan_i2c_get_pattern(client, &pattern_ver);
268 if (error) {
269 dev_err(&client->dev, "failed to get pattern version\n");
270 return error;
271 }
272
248 error = elan_i2c_read_cmd(client, 273 error = elan_i2c_read_cmd(client,
249 iap ? ETP_I2C_IAP_VERSION_CMD : 274 iap ? ETP_I2C_IAP_VERSION_CMD :
250 ETP_I2C_FW_VERSION_CMD, 275 ETP_I2C_FW_VERSION_CMD,
@@ -255,24 +280,54 @@ static int elan_i2c_get_version(struct i2c_client *client,
255 return error; 280 return error;
256 } 281 }
257 282
258 *version = val[0]; 283 if (pattern_ver == 0x01)
284 *version = iap ? val[1] : val[0];
285 else
286 *version = val[0];
259 return 0; 287 return 0;
260} 288}
261 289
262static int elan_i2c_get_sm_version(struct i2c_client *client, 290static int elan_i2c_get_sm_version(struct i2c_client *client,
263 u8 *ic_type, u8 *version) 291 u16 *ic_type, u8 *version)
264{ 292{
265 int error; 293 int error;
294 u8 pattern_ver;
266 u8 val[3]; 295 u8 val[3];
267 296
268 error = elan_i2c_read_cmd(client, ETP_I2C_SM_VERSION_CMD, val); 297 error = elan_i2c_get_pattern(client, &pattern_ver);
269 if (error) { 298 if (error) {
270 dev_err(&client->dev, "failed to get SM version: %d\n", error); 299 dev_err(&client->dev, "failed to get pattern version\n");
271 return error; 300 return error;
272 } 301 }
273 302
274 *version = val[0]; 303 if (pattern_ver == 0x01) {
275 *ic_type = val[1]; 304 error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_CMD, val);
305 if (error) {
306 dev_err(&client->dev, "failed to get ic type: %d\n",
307 error);
308 return error;
309 }
310 *ic_type = be16_to_cpup((__be16 *)val);
311
312 error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD,
313 val);
314 if (error) {
315 dev_err(&client->dev, "failed to get SM version: %d\n",
316 error);
317 return error;
318 }
319 *version = val[1];
320 } else {
321 error = elan_i2c_read_cmd(client, ETP_I2C_OSM_VERSION_CMD, val);
322 if (error) {
323 dev_err(&client->dev, "failed to get SM version: %d\n",
324 error);
325 return error;
326 }
327 *version = val[0];
328 *ic_type = val[1];
329 }
330
276 return 0; 331 return 0;
277} 332}
278 333
@@ -641,5 +696,7 @@ const struct elan_transport_ops elan_i2c_ops = {
641 .write_fw_block = elan_i2c_write_fw_block, 696 .write_fw_block = elan_i2c_write_fw_block,
642 .finish_fw_update = elan_i2c_finish_fw_update, 697 .finish_fw_update = elan_i2c_finish_fw_update,
643 698
699 .get_pattern = elan_i2c_get_pattern,
700
644 .get_report = elan_i2c_get_report, 701 .get_report = elan_i2c_get_report,
645}; 702};
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
index e23b2495d52e..df7a57ca7331 100644
--- a/drivers/input/mouse/elan_i2c_smbus.c
+++ b/drivers/input/mouse/elan_i2c_smbus.c
@@ -166,7 +166,7 @@ static int elan_smbus_get_version(struct i2c_client *client,
166} 166}
167 167
168static int elan_smbus_get_sm_version(struct i2c_client *client, 168static int elan_smbus_get_sm_version(struct i2c_client *client,
169 u8 *ic_type, u8 *version) 169 u16 *ic_type, u8 *version)
170{ 170{
171 int error; 171 int error;
172 u8 val[3]; 172 u8 val[3];
@@ -495,6 +495,12 @@ static int elan_smbus_finish_fw_update(struct i2c_client *client,
495 return 0; 495 return 0;
496} 496}
497 497
498static int elan_smbus_get_pattern(struct i2c_client *client, u8 *pattern)
499{
500 *pattern = 0;
501 return 0;
502}
503
498const struct elan_transport_ops elan_smbus_ops = { 504const struct elan_transport_ops elan_smbus_ops = {
499 .initialize = elan_smbus_initialize, 505 .initialize = elan_smbus_initialize,
500 .sleep_control = elan_smbus_sleep_control, 506 .sleep_control = elan_smbus_sleep_control,
@@ -524,4 +530,5 @@ const struct elan_transport_ops elan_smbus_ops = {
524 .finish_fw_update = elan_smbus_finish_fw_update, 530 .finish_fw_update = elan_smbus_finish_fw_update,
525 531
526 .get_report = elan_smbus_get_report, 532 .get_report = elan_smbus_get_report,
533 .get_pattern = elan_smbus_get_pattern,
527}; 534};
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index f1fa1f172107..791993215ea3 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1711,6 +1711,17 @@ int elantech_init(struct psmouse *psmouse)
1711 etd->samples[0], etd->samples[1], etd->samples[2]); 1711 etd->samples[0], etd->samples[1], etd->samples[2]);
1712 } 1712 }
1713 1713
1714 if (etd->samples[1] == 0x74 && etd->hw_version == 0x03) {
1715 /*
1716 * This module has a bug which makes absolute mode
1717 * unusable, so let's abort so we'll be using standard
1718 * PS/2 protocol.
1719 */
1720 psmouse_info(psmouse,
1721 "absolute mode broken, forcing standard PS/2 protocol\n");
1722 goto init_fail;
1723 }
1724
1714 if (elantech_set_absolute_mode(psmouse)) { 1725 if (elantech_set_absolute_mode(psmouse)) {
1715 psmouse_err(psmouse, 1726 psmouse_err(psmouse,
1716 "failed to put touchpad into absolute mode.\n"); 1727 "failed to put touchpad into absolute mode.\n");
diff --git a/drivers/input/rmi4/rmi_f34v7.c b/drivers/input/rmi4/rmi_f34v7.c
index 10c0d11b72c9..3991d2943660 100644
--- a/drivers/input/rmi4/rmi_f34v7.c
+++ b/drivers/input/rmi4/rmi_f34v7.c
@@ -9,13 +9,14 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/bitops.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/rmi.h> 14#include <linux/rmi.h>
14#include <linux/firmware.h> 15#include <linux/firmware.h>
15#include <asm/unaligned.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <asm/unaligned.h>
19 20
20#include "rmi_driver.h" 21#include "rmi_driver.h"
21#include "rmi_f34.h" 22#include "rmi_f34.h"
@@ -464,7 +465,7 @@ static int rmi_f34v7_read_queries_bl_version(struct f34_data *f34)
464static int rmi_f34v7_read_queries(struct f34_data *f34) 465static int rmi_f34v7_read_queries(struct f34_data *f34)
465{ 466{
466 int ret; 467 int ret;
467 int i, j; 468 int i;
468 u8 base; 469 u8 base;
469 int offset; 470 int offset;
470 u8 *ptable; 471 u8 *ptable;
@@ -518,10 +519,7 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
518 query_1_7.partition_support[1] & HAS_GUEST_CODE; 519 query_1_7.partition_support[1] & HAS_GUEST_CODE;
519 520
520 if (query_0 & HAS_CONFIG_ID) { 521 if (query_0 & HAS_CONFIG_ID) {
521 char f34_ctrl[CONFIG_ID_SIZE]; 522 u8 f34_ctrl[CONFIG_ID_SIZE];
522 int i = 0;
523 u8 *p = f34->configuration_id;
524 *p = '\0';
525 523
526 ret = rmi_read_block(f34->fn->rmi_dev, 524 ret = rmi_read_block(f34->fn->rmi_dev,
527 f34->fn->fd.control_base_addr, 525 f34->fn->fd.control_base_addr,
@@ -531,13 +529,11 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
531 return ret; 529 return ret;
532 530
533 /* Eat leading zeros */ 531 /* Eat leading zeros */
534 while (i < sizeof(f34_ctrl) && !f34_ctrl[i]) 532 for (i = 0; i < sizeof(f34_ctrl) - 1 && !f34_ctrl[i]; i++)
535 i++; 533 /* Empty */;
536 534
537 for (; i < sizeof(f34_ctrl); i++) 535 snprintf(f34->configuration_id, sizeof(f34->configuration_id),
538 p += snprintf(p, f34->configuration_id 536 "%*phN", (int)sizeof(f34_ctrl) - i, f34_ctrl + i);
539 + sizeof(f34->configuration_id) - p,
540 "%02X", f34_ctrl[i]);
541 537
542 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "Configuration ID: %s\n", 538 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "Configuration ID: %s\n",
543 f34->configuration_id); 539 f34->configuration_id);
@@ -545,9 +541,7 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
545 541
546 f34->v7.partitions = 0; 542 f34->v7.partitions = 0;
547 for (i = 0; i < sizeof(query_1_7.partition_support); i++) 543 for (i = 0; i < sizeof(query_1_7.partition_support); i++)
548 for (j = 0; j < 8; j++) 544 f34->v7.partitions += hweight8(query_1_7.partition_support[i]);
549 if (query_1_7.partition_support[i] & (1 << j))
550 f34->v7.partitions++;
551 545
552 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: Supported partitions: %*ph\n", 546 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: Supported partitions: %*ph\n",
553 __func__, sizeof(query_1_7.partition_support), 547 __func__, sizeof(query_1_7.partition_support),
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 12a3ad83296d..bb0349fa64bc 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -224,20 +224,6 @@ int sparse_keymap_setup(struct input_dev *dev,
224EXPORT_SYMBOL(sparse_keymap_setup); 224EXPORT_SYMBOL(sparse_keymap_setup);
225 225
226/** 226/**
227 * sparse_keymap_free - free memory allocated for sparse keymap
228 * @dev: Input device using sparse keymap
229 *
230 * This function used to free memory allocated by sparse keymap
231 * in an input device that was set up by sparse_keymap_setup().
232 * Since sparse_keymap_setup() now uses a managed allocation for the
233 * keymap copy, use of this function is deprecated.
234 */
235void sparse_keymap_free(struct input_dev *dev)
236{
237}
238EXPORT_SYMBOL(sparse_keymap_free);
239
240/**
241 * sparse_keymap_report_entry - report event corresponding to given key entry 227 * sparse_keymap_report_entry - report event corresponding to given key entry
242 * @dev: Input device for which event should be reported 228 * @dev: Input device for which event should be reported
243 * @ke: key entry describing event 229 * @ke: key entry describing event
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index cf26ca49ae6d..64b30fe273fd 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -1114,6 +1114,17 @@ config TOUCHSCREEN_ST1232
1114 To compile this driver as a module, choose M here: the 1114 To compile this driver as a module, choose M here: the
1115 module will be called st1232_ts. 1115 module will be called st1232_ts.
1116 1116
1117config TOUCHSCREEN_STMFTS
1118 tristate "STMicroelectronics STMFTS touchscreen"
1119 depends on I2C
1120 depends on LEDS_CLASS
1121 help
1122 Say Y here if you want support for STMicroelectronics
1123 STMFTS touchscreen.
1124
1125 To compile this driver as a module, choose M here: the
1126 module will be called stmfts.
1127
1117config TOUCHSCREEN_STMPE 1128config TOUCHSCREEN_STMPE
1118 tristate "STMicroelectronics STMPE touchscreens" 1129 tristate "STMicroelectronics STMPE touchscreens"
1119 depends on MFD_STMPE 1130 depends on MFD_STMPE
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 18e476948e44..6badce87037b 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
67obj-$(CONFIG_TOUCHSCREEN_SILEAD) += silead.o 67obj-$(CONFIG_TOUCHSCREEN_SILEAD) += silead.o
68obj-$(CONFIG_TOUCHSCREEN_SIS_I2C) += sis_i2c.o 68obj-$(CONFIG_TOUCHSCREEN_SIS_I2C) += sis_i2c.o
69obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o 69obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o
70obj-$(CONFIG_TOUCHSCREEN_STMFTS) += stmfts.o
70obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o 71obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
71obj-$(CONFIG_TOUCHSCREEN_SUN4I) += sun4i-ts.o 72obj-$(CONFIG_TOUCHSCREEN_SUN4I) += sun4i-ts.o
72obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o 73obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c
index 90fc07dc98a6..8868573133ab 100644
--- a/drivers/input/touchscreen/mcs5000_ts.c
+++ b/drivers/input/touchscreen/mcs5000_ts.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/i2c/mcs.h>
19#include <linux/interrupt.h> 18#include <linux/interrupt.h>
20#include <linux/input.h> 19#include <linux/input.h>
21#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/platform_data/mcs.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23
24/* Registers */ 24/* Registers */
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 1fafc9f57af6..e5eeb6311f7d 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -11,9 +11,9 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/i2c/mms114.h>
15#include <linux/input/mt.h> 14#include <linux/input/mt.h>
16#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_data/mms114.h>
17#include <linux/regulator/consumer.h> 17#include <linux/regulator/consumer.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19 19
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 41d58e88cc8a..3b3db8c868e0 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -264,7 +264,11 @@ static int s3c2410ts_probe(struct platform_device *pdev)
264 return -ENOENT; 264 return -ENOENT;
265 } 265 }
266 266
267 clk_prepare_enable(ts.clock); 267 ret = clk_prepare_enable(ts.clock);
268 if (ret) {
269 dev_err(dev, "Failed! to enabled clocks\n");
270 goto err_clk_get;
271 }
268 dev_dbg(dev, "got and enabled clocks\n"); 272 dev_dbg(dev, "got and enabled clocks\n");
269 273
270 ts.irq_tc = ret = platform_get_irq(pdev, 0); 274 ts.irq_tc = ret = platform_get_irq(pdev, 0);
@@ -353,7 +357,9 @@ static int s3c2410ts_probe(struct platform_device *pdev)
353 err_iomap: 357 err_iomap:
354 iounmap(ts.io); 358 iounmap(ts.io);
355 err_clk: 359 err_clk:
360 clk_disable_unprepare(ts.clock);
356 del_timer_sync(&touch_timer); 361 del_timer_sync(&touch_timer);
362 err_clk_get:
357 clk_put(ts.clock); 363 clk_put(ts.clock);
358 return ret; 364 return ret;
359} 365}
diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
new file mode 100644
index 000000000000..157fdb4bb2e8
--- /dev/null
+++ b/drivers/input/touchscreen/stmfts.c
@@ -0,0 +1,822 @@
1/*
2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Author: Andi Shyti <andi.shyti@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * STMicroelectronics FTS Touchscreen device driver
10 */
11
12#include <linux/delay.h>
13#include <linux/i2c.h>
14#include <linux/input/mt.h>
15#include <linux/input/touchscreen.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/leds.h>
19#include <linux/module.h>
20#include <linux/pm_runtime.h>
21#include <linux/regulator/consumer.h>
22
23/* I2C commands */
24#define STMFTS_READ_INFO 0x80
25#define STMFTS_READ_STATUS 0x84
26#define STMFTS_READ_ONE_EVENT 0x85
27#define STMFTS_READ_ALL_EVENT 0x86
28#define STMFTS_LATEST_EVENT 0x87
29#define STMFTS_SLEEP_IN 0x90
30#define STMFTS_SLEEP_OUT 0x91
31#define STMFTS_MS_MT_SENSE_OFF 0x92
32#define STMFTS_MS_MT_SENSE_ON 0x93
33#define STMFTS_SS_HOVER_SENSE_OFF 0x94
34#define STMFTS_SS_HOVER_SENSE_ON 0x95
35#define STMFTS_MS_KEY_SENSE_OFF 0x9a
36#define STMFTS_MS_KEY_SENSE_ON 0x9b
37#define STMFTS_SYSTEM_RESET 0xa0
38#define STMFTS_CLEAR_EVENT_STACK 0xa1
39#define STMFTS_FULL_FORCE_CALIBRATION 0xa2
40#define STMFTS_MS_CX_TUNING 0xa3
41#define STMFTS_SS_CX_TUNING 0xa4
42
43/* events */
44#define STMFTS_EV_NO_EVENT 0x00
45#define STMFTS_EV_MULTI_TOUCH_DETECTED 0x02
46#define STMFTS_EV_MULTI_TOUCH_ENTER 0x03
47#define STMFTS_EV_MULTI_TOUCH_LEAVE 0x04
48#define STMFTS_EV_MULTI_TOUCH_MOTION 0x05
49#define STMFTS_EV_HOVER_ENTER 0x07
50#define STMFTS_EV_HOVER_LEAVE 0x08
51#define STMFTS_EV_HOVER_MOTION 0x09
52#define STMFTS_EV_KEY_STATUS 0x0e
53#define STMFTS_EV_ERROR 0x0f
54#define STMFTS_EV_CONTROLLER_READY 0x10
55#define STMFTS_EV_SLEEP_OUT_CONTROLLER_READY 0x11
56#define STMFTS_EV_STATUS 0x16
57#define STMFTS_EV_DEBUG 0xdb
58
59/* multi touch related event masks */
60#define STMFTS_MASK_EVENT_ID 0x0f
61#define STMFTS_MASK_TOUCH_ID 0xf0
62#define STMFTS_MASK_LEFT_EVENT 0x0f
63#define STMFTS_MASK_X_MSB 0x0f
64#define STMFTS_MASK_Y_LSB 0xf0
65
66/* key related event masks */
67#define STMFTS_MASK_KEY_NO_TOUCH 0x00
68#define STMFTS_MASK_KEY_MENU 0x01
69#define STMFTS_MASK_KEY_BACK 0x02
70
71#define STMFTS_EVENT_SIZE 8
72#define STMFTS_STACK_DEPTH 32
73#define STMFTS_DATA_MAX_SIZE (STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH)
74#define STMFTS_MAX_FINGERS 10
75#define STMFTS_DEV_NAME "stmfts"
76
77enum stmfts_regulators {
78 STMFTS_REGULATOR_VDD,
79 STMFTS_REGULATOR_AVDD,
80};
81
82struct stmfts_data {
83 struct i2c_client *client;
84 struct input_dev *input;
85 struct led_classdev led_cdev;
86 struct mutex mutex;
87
88 struct touchscreen_properties prop;
89
90 struct regulator_bulk_data regulators[2];
91
92 /*
93 * Presence of ledvdd will be used also to check
94 * whether the LED is supported.
95 */
96 struct regulator *ledvdd;
97
98 u16 chip_id;
99 u8 chip_ver;
100 u16 fw_ver;
101 u8 config_id;
102 u8 config_ver;
103
104 u8 data[STMFTS_DATA_MAX_SIZE];
105
106 struct completion cmd_done;
107
108 bool use_key;
109 bool led_status;
110 bool hover_enabled;
111 bool running;
112};
113
114static void stmfts_brightness_set(struct led_classdev *led_cdev,
115 enum led_brightness value)
116{
117 struct stmfts_data *sdata = container_of(led_cdev,
118 struct stmfts_data, led_cdev);
119 int err;
120
121 if (value == sdata->led_status || !sdata->ledvdd)
122 return;
123
124 if (!value) {
125 regulator_disable(sdata->ledvdd);
126 } else {
127 err = regulator_enable(sdata->ledvdd);
128 if (err)
129 dev_warn(&sdata->client->dev,
130 "failed to disable ledvdd regulator: %d\n",
131 err);
132 }
133
134 sdata->led_status = value;
135}
136
137static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev)
138{
139 struct stmfts_data *sdata = container_of(led_cdev,
140 struct stmfts_data, led_cdev);
141
142 return !!regulator_is_enabled(sdata->ledvdd);
143}
144
145/*
146 * We can't simply use i2c_smbus_read_i2c_block_data because we
147 * need to read more than 255 bytes (
148 */
149static int stmfts_read_events(struct stmfts_data *sdata)
150{
151 u8 cmd = STMFTS_READ_ALL_EVENT;
152 struct i2c_msg msgs[2] = {
153 {
154 .addr = sdata->client->addr,
155 .len = 1,
156 .buf = &cmd,
157 },
158 {
159 .addr = sdata->client->addr,
160 .flags = I2C_M_RD,
161 .len = STMFTS_DATA_MAX_SIZE,
162 .buf = sdata->data,
163 },
164 };
165 int ret;
166
167 ret = i2c_transfer(sdata->client->adapter, msgs, ARRAY_SIZE(msgs));
168 if (ret < 0)
169 return ret;
170
171 return ret == ARRAY_SIZE(msgs) ? 0 : -EIO;
172}
173
174static void stmfts_report_contact_event(struct stmfts_data *sdata,
175 const u8 event[])
176{
177 u8 slot_id = (event[0] & STMFTS_MASK_TOUCH_ID) >> 4;
178 u16 x = event[1] | ((event[2] & STMFTS_MASK_X_MSB) << 8);
179 u16 y = (event[2] >> 4) | (event[3] << 4);
180 u8 maj = event[4];
181 u8 min = event[5];
182 u8 orientation = event[6];
183 u8 area = event[7];
184
185 input_mt_slot(sdata->input, slot_id);
186
187 input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, true);
188 input_report_abs(sdata->input, ABS_MT_POSITION_X, x);
189 input_report_abs(sdata->input, ABS_MT_POSITION_Y, y);
190 input_report_abs(sdata->input, ABS_MT_TOUCH_MAJOR, maj);
191 input_report_abs(sdata->input, ABS_MT_TOUCH_MINOR, min);
192 input_report_abs(sdata->input, ABS_MT_PRESSURE, area);
193 input_report_abs(sdata->input, ABS_MT_ORIENTATION, orientation);
194
195 input_sync(sdata->input);
196}
197
198static void stmfts_report_contact_release(struct stmfts_data *sdata,
199 const u8 event[])
200{
201 u8 slot_id = (event[0] & STMFTS_MASK_TOUCH_ID) >> 4;
202
203 input_mt_slot(sdata->input, slot_id);
204 input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, false);
205
206 input_sync(sdata->input);
207}
208
209static void stmfts_report_hover_event(struct stmfts_data *sdata,
210 const u8 event[])
211{
212 u16 x = (event[2] << 4) | (event[4] >> 4);
213 u16 y = (event[3] << 4) | (event[4] & STMFTS_MASK_Y_LSB);
214 u8 z = event[5];
215
216 input_report_abs(sdata->input, ABS_X, x);
217 input_report_abs(sdata->input, ABS_Y, y);
218 input_report_abs(sdata->input, ABS_DISTANCE, z);
219
220 input_sync(sdata->input);
221}
222
223static void stmfts_report_key_event(struct stmfts_data *sdata, const u8 event[])
224{
225 switch (event[2]) {
226 case 0:
227 input_report_key(sdata->input, KEY_BACK, 0);
228 input_report_key(sdata->input, KEY_MENU, 0);
229 break;
230
231 case STMFTS_MASK_KEY_BACK:
232 input_report_key(sdata->input, KEY_BACK, 1);
233 break;
234
235 case STMFTS_MASK_KEY_MENU:
236 input_report_key(sdata->input, KEY_MENU, 1);
237 break;
238
239 default:
240 dev_warn(&sdata->client->dev,
241 "unknown key event: %#02x\n", event[2]);
242 break;
243 }
244
245 input_sync(sdata->input);
246}
247
248static void stmfts_parse_events(struct stmfts_data *sdata)
249{
250 int i;
251
252 for (i = 0; i < STMFTS_STACK_DEPTH; i++) {
253 u8 *event = &sdata->data[i * STMFTS_EVENT_SIZE];
254
255 switch (event[0]) {
256
257 case STMFTS_EV_CONTROLLER_READY:
258 case STMFTS_EV_SLEEP_OUT_CONTROLLER_READY:
259 case STMFTS_EV_STATUS:
260 complete(&sdata->cmd_done);
261 /* fall through */
262
263 case STMFTS_EV_NO_EVENT:
264 case STMFTS_EV_DEBUG:
265 return;
266 }
267
268 switch (event[0] & STMFTS_MASK_EVENT_ID) {
269
270 case STMFTS_EV_MULTI_TOUCH_ENTER:
271 case STMFTS_EV_MULTI_TOUCH_MOTION:
272 stmfts_report_contact_event(sdata, event);
273 break;
274
275 case STMFTS_EV_MULTI_TOUCH_LEAVE:
276 stmfts_report_contact_release(sdata, event);
277 break;
278
279 case STMFTS_EV_HOVER_ENTER:
280 case STMFTS_EV_HOVER_LEAVE:
281 case STMFTS_EV_HOVER_MOTION:
282 stmfts_report_hover_event(sdata, event);
283 break;
284
285 case STMFTS_EV_KEY_STATUS:
286 stmfts_report_key_event(sdata, event);
287 break;
288
289 case STMFTS_EV_ERROR:
290 dev_warn(&sdata->client->dev,
291 "error code: 0x%x%x%x%x%x%x",
292 event[6], event[5], event[4],
293 event[3], event[2], event[1]);
294 break;
295
296 default:
297 dev_err(&sdata->client->dev,
298 "unknown event %#02x\n", event[0]);
299 }
300 }
301}
302
303static irqreturn_t stmfts_irq_handler(int irq, void *dev)
304{
305 struct stmfts_data *sdata = dev;
306 int err;
307
308 mutex_lock(&sdata->mutex);
309
310 err = stmfts_read_events(sdata);
311 if (unlikely(err))
312 dev_err(&sdata->client->dev,
313 "failed to read events: %d\n", err);
314 else
315 stmfts_parse_events(sdata);
316
317 mutex_unlock(&sdata->mutex);
318 return IRQ_HANDLED;
319}
320
321static int stmfts_command(struct stmfts_data *sdata, const u8 cmd)
322{
323 int err;
324
325 reinit_completion(&sdata->cmd_done);
326
327 err = i2c_smbus_write_byte(sdata->client, cmd);
328 if (err)
329 return err;
330
331 if (!wait_for_completion_timeout(&sdata->cmd_done,
332 msecs_to_jiffies(1000)))
333 return -ETIMEDOUT;
334
335 return 0;
336}
337
338static int stmfts_input_open(struct input_dev *dev)
339{
340 struct stmfts_data *sdata = input_get_drvdata(dev);
341 int err;
342
343 err = pm_runtime_get_sync(&sdata->client->dev);
344 if (err < 0)
345 return err;
346
347 err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON);
348 if (err)
349 return err;
350
351 mutex_lock(&sdata->mutex);
352 sdata->running = true;
353
354 if (sdata->hover_enabled) {
355 err = i2c_smbus_write_byte(sdata->client,
356 STMFTS_SS_HOVER_SENSE_ON);
357 if (err)
358 dev_warn(&sdata->client->dev,
359 "failed to enable hover\n");
360 }
361 mutex_unlock(&sdata->mutex);
362
363 if (sdata->use_key) {
364 err = i2c_smbus_write_byte(sdata->client,
365 STMFTS_MS_KEY_SENSE_ON);
366 if (err)
367 /* I can still use only the touch screen */
368 dev_warn(&sdata->client->dev,
369 "failed to enable touchkey\n");
370 }
371
372 return 0;
373}
374
375static void stmfts_input_close(struct input_dev *dev)
376{
377 struct stmfts_data *sdata = input_get_drvdata(dev);
378 int err;
379
380 err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_OFF);
381 if (err)
382 dev_warn(&sdata->client->dev,
383 "failed to disable touchscreen: %d\n", err);
384
385 mutex_lock(&sdata->mutex);
386
387 sdata->running = false;
388
389 if (sdata->hover_enabled) {
390 err = i2c_smbus_write_byte(sdata->client,
391 STMFTS_SS_HOVER_SENSE_OFF);
392 if (err)
393 dev_warn(&sdata->client->dev,
394 "failed to disable hover: %d\n", err);
395 }
396 mutex_unlock(&sdata->mutex);
397
398 if (sdata->use_key) {
399 err = i2c_smbus_write_byte(sdata->client,
400 STMFTS_MS_KEY_SENSE_OFF);
401 if (err)
402 dev_warn(&sdata->client->dev,
403 "failed to disable touchkey: %d\n", err);
404 }
405
406 pm_runtime_put_sync(&sdata->client->dev);
407}
408
409static ssize_t stmfts_sysfs_chip_id(struct device *dev,
410 struct device_attribute *attr, char *buf)
411{
412 struct stmfts_data *sdata = dev_get_drvdata(dev);
413
414 return sprintf(buf, "%#x\n", sdata->chip_id);
415}
416
417static ssize_t stmfts_sysfs_chip_version(struct device *dev,
418 struct device_attribute *attr, char *buf)
419{
420 struct stmfts_data *sdata = dev_get_drvdata(dev);
421
422 return sprintf(buf, "%u\n", sdata->chip_ver);
423}
424
425static ssize_t stmfts_sysfs_fw_ver(struct device *dev,
426 struct device_attribute *attr, char *buf)
427{
428 struct stmfts_data *sdata = dev_get_drvdata(dev);
429
430 return sprintf(buf, "%u\n", sdata->fw_ver);
431}
432
433static ssize_t stmfts_sysfs_config_id(struct device *dev,
434 struct device_attribute *attr, char *buf)
435{
436 struct stmfts_data *sdata = dev_get_drvdata(dev);
437
438 return sprintf(buf, "%#x\n", sdata->config_id);
439}
440
441static ssize_t stmfts_sysfs_config_version(struct device *dev,
442 struct device_attribute *attr, char *buf)
443{
444 struct stmfts_data *sdata = dev_get_drvdata(dev);
445
446 return sprintf(buf, "%u\n", sdata->config_ver);
447}
448
449static ssize_t stmfts_sysfs_read_status(struct device *dev,
450 struct device_attribute *attr, char *buf)
451{
452 struct stmfts_data *sdata = dev_get_drvdata(dev);
453 u8 status[4];
454 int err;
455
456 err = i2c_smbus_read_i2c_block_data(sdata->client, STMFTS_READ_STATUS,
457 sizeof(status), status);
458 if (err)
459 return err;
460
461 return sprintf(buf, "%#02x\n", status[0]);
462}
463
464static ssize_t stmfts_sysfs_hover_enable_read(struct device *dev,
465 struct device_attribute *attr, char *buf)
466{
467 struct stmfts_data *sdata = dev_get_drvdata(dev);
468
469 return sprintf(buf, "%u\n", sdata->hover_enabled);
470}
471
472static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev,
473 struct device_attribute *attr,
474 const char *buf, size_t len)
475{
476 struct stmfts_data *sdata = dev_get_drvdata(dev);
477 unsigned long value;
478 int err = 0;
479
480 if (kstrtoul(buf, 0, &value))
481 return -EINVAL;
482
483 mutex_lock(&sdata->mutex);
484
485 if (value & sdata->hover_enabled)
486 goto out;
487
488 if (sdata->running)
489 err = i2c_smbus_write_byte(sdata->client,
490 value ? STMFTS_SS_HOVER_SENSE_ON :
491 STMFTS_SS_HOVER_SENSE_OFF);
492
493 if (!err)
494 sdata->hover_enabled = !!value;
495
496out:
497 mutex_unlock(&sdata->mutex);
498
499 return len;
500}
501
502static DEVICE_ATTR(chip_id, 0444, stmfts_sysfs_chip_id, NULL);
503static DEVICE_ATTR(chip_version, 0444, stmfts_sysfs_chip_version, NULL);
504static DEVICE_ATTR(fw_ver, 0444, stmfts_sysfs_fw_ver, NULL);
505static DEVICE_ATTR(config_id, 0444, stmfts_sysfs_config_id, NULL);
506static DEVICE_ATTR(config_version, 0444, stmfts_sysfs_config_version, NULL);
507static DEVICE_ATTR(status, 0444, stmfts_sysfs_read_status, NULL);
508static DEVICE_ATTR(hover_enable, 0644, stmfts_sysfs_hover_enable_read,
509 stmfts_sysfs_hover_enable_write);
510
511static struct attribute *stmfts_sysfs_attrs[] = {
512 &dev_attr_chip_id.attr,
513 &dev_attr_chip_version.attr,
514 &dev_attr_fw_ver.attr,
515 &dev_attr_config_id.attr,
516 &dev_attr_config_version.attr,
517 &dev_attr_status.attr,
518 &dev_attr_hover_enable.attr,
519 NULL
520};
521
522static struct attribute_group stmfts_attribute_group = {
523 .attrs = stmfts_sysfs_attrs
524};
525
526static int stmfts_power_on(struct stmfts_data *sdata)
527{
528 int err;
529 u8 reg[8];
530
531 err = regulator_bulk_enable(ARRAY_SIZE(sdata->regulators),
532 sdata->regulators);
533 if (err)
534 return err;
535
536 /*
537 * The datasheet does not specify the power on time, but considering
538 * that the reset time is < 10ms, I sleep 20ms to be sure
539 */
540 msleep(20);
541
542 err = i2c_smbus_read_i2c_block_data(sdata->client, STMFTS_READ_INFO,
543 sizeof(reg), reg);
544 if (err < 0)
545 return err;
546 if (err != sizeof(reg))
547 return -EIO;
548
549 sdata->chip_id = be16_to_cpup((__be16 *)&reg[6]);
550 sdata->chip_ver = reg[0];
551 sdata->fw_ver = be16_to_cpup((__be16 *)&reg[2]);
552 sdata->config_id = reg[4];
553 sdata->config_ver = reg[5];
554
555 enable_irq(sdata->client->irq);
556
557 msleep(50);
558
559 err = stmfts_command(sdata, STMFTS_SYSTEM_RESET);
560 if (err)
561 return err;
562
563 err = stmfts_command(sdata, STMFTS_SLEEP_OUT);
564 if (err)
565 return err;
566
567 /* optional tuning */
568 err = stmfts_command(sdata, STMFTS_MS_CX_TUNING);
569 if (err)
570 dev_warn(&sdata->client->dev,
571 "failed to perform mutual auto tune: %d\n", err);
572
573 /* optional tuning */
574 err = stmfts_command(sdata, STMFTS_SS_CX_TUNING);
575 if (err)
576 dev_warn(&sdata->client->dev,
577 "failed to perform self auto tune: %d\n", err);
578
579 err = stmfts_command(sdata, STMFTS_FULL_FORCE_CALIBRATION);
580 if (err)
581 return err;
582
583 /*
584 * At this point no one is using the touchscreen
585 * and I don't really care about the return value
586 */
587 (void) i2c_smbus_write_byte(sdata->client, STMFTS_SLEEP_IN);
588
589 return 0;
590}
591
592static void stmfts_power_off(void *data)
593{
594 struct stmfts_data *sdata = data;
595
596 disable_irq(sdata->client->irq);
597 regulator_bulk_disable(ARRAY_SIZE(sdata->regulators),
598 sdata->regulators);
599}
600
601/* This function is void because I don't want to prevent using the touch key
602 * only because the LEDs don't get registered
603 */
604static int stmfts_enable_led(struct stmfts_data *sdata)
605{
606 int err;
607
608 /* get the regulator for powering the leds on */
609 sdata->ledvdd = devm_regulator_get(&sdata->client->dev, "ledvdd");
610 if (IS_ERR(sdata->ledvdd))
611 return PTR_ERR(sdata->ledvdd);
612
613 sdata->led_cdev.name = STMFTS_DEV_NAME;
614 sdata->led_cdev.max_brightness = LED_ON;
615 sdata->led_cdev.brightness = LED_OFF;
616 sdata->led_cdev.brightness_set = stmfts_brightness_set;
617 sdata->led_cdev.brightness_get = stmfts_brightness_get;
618
619 err = devm_led_classdev_register(&sdata->client->dev, &sdata->led_cdev);
620 if (err) {
621 devm_regulator_put(sdata->ledvdd);
622 return err;
623 }
624
625 return 0;
626}
627
628static int stmfts_probe(struct i2c_client *client,
629 const struct i2c_device_id *id)
630{
631 int err;
632 struct stmfts_data *sdata;
633
634 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
635 I2C_FUNC_SMBUS_BYTE_DATA |
636 I2C_FUNC_SMBUS_I2C_BLOCK))
637 return -ENODEV;
638
639 sdata = devm_kzalloc(&client->dev, sizeof(*sdata), GFP_KERNEL);
640 if (!sdata)
641 return -ENOMEM;
642
643 i2c_set_clientdata(client, sdata);
644
645 sdata->client = client;
646 mutex_init(&sdata->mutex);
647 init_completion(&sdata->cmd_done);
648
649 sdata->regulators[STMFTS_REGULATOR_VDD].supply = "vdd";
650 sdata->regulators[STMFTS_REGULATOR_AVDD].supply = "avdd";
651 err = devm_regulator_bulk_get(&client->dev,
652 ARRAY_SIZE(sdata->regulators),
653 sdata->regulators);
654 if (err)
655 return err;
656
657 sdata->input = devm_input_allocate_device(&client->dev);
658 if (!sdata->input)
659 return -ENOMEM;
660
661 sdata->input->name = STMFTS_DEV_NAME;
662 sdata->input->id.bustype = BUS_I2C;
663 sdata->input->open = stmfts_input_open;
664 sdata->input->close = stmfts_input_close;
665
666 touchscreen_parse_properties(sdata->input, true, &sdata->prop);
667
668 input_set_abs_params(sdata->input, ABS_MT_POSITION_X, 0,
669 sdata->prop.max_x, 0, 0);
670 input_set_abs_params(sdata->input, ABS_MT_POSITION_Y, 0,
671 sdata->prop.max_y, 0, 0);
672 input_set_abs_params(sdata->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
673 input_set_abs_params(sdata->input, ABS_MT_TOUCH_MINOR, 0, 255, 0, 0);
674 input_set_abs_params(sdata->input, ABS_MT_ORIENTATION, 0, 255, 0, 0);
675 input_set_abs_params(sdata->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
676 input_set_abs_params(sdata->input, ABS_DISTANCE, 0, 255, 0, 0);
677
678 sdata->use_key = device_property_read_bool(&client->dev,
679 "touch-key-connected");
680 if (sdata->use_key) {
681 input_set_capability(sdata->input, EV_KEY, KEY_MENU);
682 input_set_capability(sdata->input, EV_KEY, KEY_BACK);
683 }
684
685 err = input_mt_init_slots(sdata->input,
686 STMFTS_MAX_FINGERS, INPUT_MT_DIRECT);
687 if (err)
688 return err;
689
690 input_set_drvdata(sdata->input, sdata);
691
692 err = devm_request_threaded_irq(&client->dev, client->irq,
693 NULL, stmfts_irq_handler,
694 IRQF_ONESHOT,
695 "stmfts_irq", sdata);
696 if (err)
697 return err;
698
699 /* stmfts_power_on expects interrupt to be disabled */
700 disable_irq(client->irq);
701
702 dev_dbg(&client->dev, "initializing ST-Microelectronics FTS...\n");
703
704 err = stmfts_power_on(sdata);
705 if (err)
706 return err;
707
708 err = devm_add_action_or_reset(&client->dev, stmfts_power_off, sdata);
709 if (err)
710 return err;
711
712 err = input_register_device(sdata->input);
713 if (err)
714 return err;
715
716 if (sdata->use_key) {
717 err = stmfts_enable_led(sdata);
718 if (err) {
719 /*
720 * Even if the LEDs have failed to be initialized and
721 * used in the driver, I can still use the device even
722 * without LEDs. The ledvdd regulator pointer will be
723 * used as a flag.
724 */
725 dev_warn(&client->dev, "unable to use touchkey leds\n");
726 sdata->ledvdd = NULL;
727 }
728 }
729
730 err = sysfs_create_group(&sdata->client->dev.kobj,
731 &stmfts_attribute_group);
732 if (err)
733 return err;
734
735 pm_runtime_enable(&client->dev);
736
737 return 0;
738}
739
740static int stmfts_remove(struct i2c_client *client)
741{
742 pm_runtime_disable(&client->dev);
743 sysfs_remove_group(&client->dev.kobj, &stmfts_attribute_group);
744
745 return 0;
746}
747
748static int __maybe_unused stmfts_runtime_suspend(struct device *dev)
749{
750 struct stmfts_data *sdata = dev_get_drvdata(dev);
751 int ret;
752
753 ret = i2c_smbus_write_byte(sdata->client, STMFTS_SLEEP_IN);
754 if (ret)
755 dev_warn(dev, "failed to suspend device: %d\n", ret);
756
757 return ret;
758}
759
760static int __maybe_unused stmfts_runtime_resume(struct device *dev)
761{
762 struct stmfts_data *sdata = dev_get_drvdata(dev);
763 int ret;
764
765 ret = i2c_smbus_write_byte(sdata->client, STMFTS_SLEEP_OUT);
766 if (ret)
767 dev_err(dev, "failed to resume device: %d\n", ret);
768
769 return ret;
770}
771
772static int __maybe_unused stmfts_suspend(struct device *dev)
773{
774 struct stmfts_data *sdata = dev_get_drvdata(dev);
775
776 stmfts_power_off(sdata);
777
778 return 0;
779}
780
781static int __maybe_unused stmfts_resume(struct device *dev)
782{
783 struct stmfts_data *sdata = dev_get_drvdata(dev);
784
785 return stmfts_power_on(sdata);
786}
787
788static const struct dev_pm_ops stmfts_pm_ops = {
789 SET_SYSTEM_SLEEP_PM_OPS(stmfts_suspend, stmfts_resume)
790 SET_RUNTIME_PM_OPS(stmfts_runtime_suspend, stmfts_runtime_resume, NULL)
791};
792
793#ifdef CONFIG_OF
794static const struct of_device_id stmfts_of_match[] = {
795 { .compatible = "st,stmfts", },
796 { },
797};
798MODULE_DEVICE_TABLE(of, stmfts_of_match);
799#endif
800
801static const struct i2c_device_id stmfts_id[] = {
802 { "stmfts", 0 },
803 { },
804};
805MODULE_DEVICE_TABLE(i2c, stmfts_id);
806
807static struct i2c_driver stmfts_driver = {
808 .driver = {
809 .name = STMFTS_DEV_NAME,
810 .of_match_table = of_match_ptr(stmfts_of_match),
811 .pm = &stmfts_pm_ops,
812 },
813 .probe = stmfts_probe,
814 .remove = stmfts_remove,
815 .id_table = stmfts_id,
816};
817
818module_i2c_driver(stmfts_driver);
819
820MODULE_AUTHOR("Andi Shyti <andi.shyti@samsung.com>");
821MODULE_DESCRIPTION("STMicroelectronics FTS Touch Screen");
822MODULE_LICENSE("GPL v2");
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index fc7384936011..8342e0c48a53 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -25,9 +25,9 @@
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c/tsc2007.h>
29#include <linux/of_device.h> 28#include <linux/of_device.h>
30#include <linux/of_gpio.h> 29#include <linux/of_gpio.h>
30#include <linux/platform_data/tsc2007.h>
31#include "tsc2007.h" 31#include "tsc2007.h"
32 32
33int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) 33int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd)
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index c9339f85359b..cd4a6d7d6750 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -32,13 +32,13 @@
32#include <linux/i2c.h> 32#include <linux/i2c.h>
33#include <linux/i2c-ocores.h> 33#include <linux/i2c-ocores.h>
34#include <linux/i2c-xiic.h> 34#include <linux/i2c-xiic.h>
35#include <linux/i2c/tsc2007.h>
36 35
37#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
38#include <linux/spi/xilinx_spi.h> 37#include <linux/spi/xilinx_spi.h>
39#include <linux/spi/max7301.h> 38#include <linux/spi/max7301.h>
40#include <linux/spi/mc33880.h> 39#include <linux/spi/mc33880.h>
41 40
41#include <linux/platform_data/tsc2007.h>
42#include <linux/platform_data/media/timb_radio.h> 42#include <linux/platform_data/media/timb_radio.h>
43#include <linux/platform_data/media/timb_video.h> 43#include <linux/platform_data/media/timb_video.h>
44 44
diff --git a/include/linux/input/sparse-keymap.h b/include/linux/input/sparse-keymap.h
index 52db62064c6e..c7346e33d958 100644
--- a/include/linux/input/sparse-keymap.h
+++ b/include/linux/input/sparse-keymap.h
@@ -51,7 +51,6 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
51int sparse_keymap_setup(struct input_dev *dev, 51int sparse_keymap_setup(struct input_dev *dev,
52 const struct key_entry *keymap, 52 const struct key_entry *keymap,
53 int (*setup)(struct input_dev *, struct key_entry *)); 53 int (*setup)(struct input_dev *, struct key_entry *));
54void sparse_keymap_free(struct input_dev *dev);
55 54
56void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, 55void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
57 unsigned int value, bool autorelease); 56 unsigned int value, bool autorelease);
diff --git a/include/linux/i2c/lm8323.h b/include/linux/platform_data/lm8323.h
index 478d668bc590..478d668bc590 100644
--- a/include/linux/i2c/lm8323.h
+++ b/include/linux/platform_data/lm8323.h
diff --git a/include/linux/i2c/mcs.h b/include/linux/platform_data/mcs.h
index 61bb18a4fd3c..61bb18a4fd3c 100644
--- a/include/linux/i2c/mcs.h
+++ b/include/linux/platform_data/mcs.h
diff --git a/include/linux/i2c/mms114.h b/include/linux/platform_data/mms114.h
index 5722ebfb2738..5722ebfb2738 100644
--- a/include/linux/i2c/mms114.h
+++ b/include/linux/platform_data/mms114.h
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/platform_data/tsc2007.h
index 4f35b6ad3889..c2d3aa1dadd4 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/platform_data/tsc2007.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_I2C_TSC2007_H 1#ifndef __LINUX_I2C_TSC2007_H
2#define __LINUX_I2C_TSC2007_H 2#define __LINUX_I2C_TSC2007_H
3 3
4/* linux/i2c/tsc2007.h */ 4/* linux/platform_data/tsc2007.h */
5 5
6struct tsc2007_platform_data { 6struct tsc2007_platform_data {
7 u16 model; /* 2007. */ 7 u16 model; /* 2007. */
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index f5a8d96e1e09..179891074b3c 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -600,6 +600,7 @@
600#define KEY_APPSELECT 0x244 /* AL Select Task/Application */ 600#define KEY_APPSELECT 0x244 /* AL Select Task/Application */
601#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ 601#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
602#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ 602#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
603#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
603 604
604#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ 605#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
605#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ 606#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */