aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-13 13:25:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-13 13:25:05 -0400
commitcd636458904a04de2349c728323c5d2af1203bdf (patch)
tree69980d8ff803069c38d16a0d3e6932ed2a4aa5c8
parentb53c4d5eb7cda86f7bf495f52116ae43bdc9cf23 (diff)
parent3af9256150b3ecc597c5428711f87ce105d1d58e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull some more input subsystem updates from Dmitry Torokhov: "An updated xpad driver with a few more recognized device IDs, and a new psxpad-spi driver, allowing connecting Playstation 1 and 2 joypads via SPI bus" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: cros_ec_keyb - remove extraneous 'const' Input: add support for PlayStation 1/2 joypads connected via SPI Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth Input: xpad - sync supported devices with xboxdrv Input: xpad - sort supported devices by USB ID
-rw-r--r--drivers/input/joystick/Kconfig21
-rw-r--r--drivers/input/joystick/Makefile1
-rw-r--r--drivers/input/joystick/psxpad-spi.c401
-rw-r--r--drivers/input/joystick/xpad.c27
-rw-r--r--drivers/input/keyboard/cros_ec_keyb.c2
5 files changed, 445 insertions, 7 deletions
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index 4215b5382092..f3c2f6ea8b44 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -330,4 +330,25 @@ config JOYSTICK_MAPLE
330 To compile this as a module choose M here: the module will be called 330 To compile this as a module choose M here: the module will be called
331 maplecontrol. 331 maplecontrol.
332 332
333config JOYSTICK_PSXPAD_SPI
334 tristate "PlayStation 1/2 joypads via SPI interface"
335 depends on SPI
336 select INPUT_POLLDEV
337 help
338 Say Y here if you wish to connect PlayStation 1/2 joypads
339 via SPI interface.
340
341 To compile this driver as a module, choose M here: the
342 module will be called psxpad-spi.
343
344config JOYSTICK_PSXPAD_SPI_FF
345 bool "PlayStation 1/2 joypads force feedback (rumble) support"
346 depends on JOYSTICK_PSXPAD_SPI
347 select INPUT_FF_MEMLESS
348 help
349 Say Y here if you want to take advantage of PlayStation 1/2
350 joypads rumble features.
351
352 To drive rumble motor a dedicated power supply is required.
353
333endif 354endif
diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile
index 92dc0de9dfed..496fd56b3f1b 100644
--- a/drivers/input/joystick/Makefile
+++ b/drivers/input/joystick/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_JOYSTICK_INTERACT) += interact.o
21obj-$(CONFIG_JOYSTICK_JOYDUMP) += joydump.o 21obj-$(CONFIG_JOYSTICK_JOYDUMP) += joydump.o
22obj-$(CONFIG_JOYSTICK_MAGELLAN) += magellan.o 22obj-$(CONFIG_JOYSTICK_MAGELLAN) += magellan.o
23obj-$(CONFIG_JOYSTICK_MAPLE) += maplecontrol.o 23obj-$(CONFIG_JOYSTICK_MAPLE) += maplecontrol.o
24obj-$(CONFIG_JOYSTICK_PSXPAD_SPI) += psxpad-spi.o
24obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o 25obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o
25obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o 26obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o
26obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o 27obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o
diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c
new file mode 100644
index 000000000000..28b473f6cbb6
--- /dev/null
+++ b/drivers/input/joystick/psxpad-spi.c
@@ -0,0 +1,401 @@
1/*
2 * PlayStation 1/2 joypads via SPI interface Driver
3 *
4 * Copyright (C) 2017 Tomohiro Yoshidomi <sylph23k@gmail.com>
5 * Licensed under the GPL-2 or later.
6 *
7 * PlayStation 1/2 joypad's plug (not socket)
8 * 123 456 789
9 * (...|...|...)
10 *
11 * 1: DAT -> MISO (pullup with 1k owm to 3.3V)
12 * 2: CMD -> MOSI
13 * 3: 9V (for motor, if not use N.C.)
14 * 4: GND
15 * 5: 3.3V
16 * 6: Attention -> CS(SS)
17 * 7: SCK -> SCK
18 * 8: N.C.
19 * 9: ACK -> N.C.
20 */
21
22#include <linux/kernel.h>
23#include <linux/device.h>
24#include <linux/input.h>
25#include <linux/input-polldev.h>
26#include <linux/module.h>
27#include <linux/spi/spi.h>
28#include <linux/types.h>
29#include <linux/pm.h>
30#include <linux/pm_runtime.h>
31
32#define REVERSE_BIT(x) ((((x) & 0x80) >> 7) | (((x) & 0x40) >> 5) | \
33 (((x) & 0x20) >> 3) | (((x) & 0x10) >> 1) | (((x) & 0x08) << 1) | \
34 (((x) & 0x04) << 3) | (((x) & 0x02) << 5) | (((x) & 0x01) << 7))
35
36/* PlayStation 1/2 joypad command and response are LSBFIRST. */
37
38/*
39 * 0x01, 0x42, 0x00, 0x00, 0x00,
40 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
42 */
43static const u8 PSX_CMD_POLL[] = {
44 0x80, 0x42, 0x00, 0x00, 0x00,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
47};
48/* 0x01, 0x43, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 */
49static const u8 PSX_CMD_ENTER_CFG[] = {
50 0x80, 0xC2, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
51};
52/* 0x01, 0x43, 0x00, 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A */
53static const u8 PSX_CMD_EXIT_CFG[] = {
54 0x80, 0xC2, 0x00, 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A
55};
56/* 0x01, 0x4D, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF */
57static const u8 PSX_CMD_ENABLE_MOTOR[] = {
58 0x80, 0xB2, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF
59};
60
61struct psxpad {
62 struct spi_device *spi;
63 struct input_polled_dev *pdev;
64 char phys[0x20];
65 bool motor1enable;
66 bool motor2enable;
67 u8 motor1level;
68 u8 motor2level;
69 u8 sendbuf[0x20] ____cacheline_aligned;
70 u8 response[sizeof(PSX_CMD_POLL)] ____cacheline_aligned;
71};
72
73static int psxpad_command(struct psxpad *pad, const u8 sendcmdlen)
74{
75 struct spi_transfer xfers = {
76 .tx_buf = pad->sendbuf,
77 .rx_buf = pad->response,
78 .len = sendcmdlen,
79 };
80 int err;
81
82 err = spi_sync_transfer(pad->spi, &xfers, 1);
83 if (err) {
84 dev_err(&pad->spi->dev,
85 "%s: failed to SPI xfers mode: %d\n",
86 __func__, err);
87 return err;
88 }
89
90 return 0;
91}
92
93#ifdef CONFIG_JOYSTICK_PSXPAD_SPI_FF
94static void psxpad_control_motor(struct psxpad *pad,
95 bool motor1enable, bool motor2enable)
96{
97 int err;
98
99 pad->motor1enable = motor1enable;
100 pad->motor2enable = motor2enable;
101
102 memcpy(pad->sendbuf, PSX_CMD_ENTER_CFG, sizeof(PSX_CMD_ENTER_CFG));
103 err = psxpad_command(pad, sizeof(PSX_CMD_ENTER_CFG));
104 if (err) {
105 dev_err(&pad->spi->dev,
106 "%s: failed to enter config mode: %d\n",
107 __func__, err);
108 return;
109 }
110
111 memcpy(pad->sendbuf, PSX_CMD_ENABLE_MOTOR,
112 sizeof(PSX_CMD_ENABLE_MOTOR));
113 pad->sendbuf[3] = pad->motor1enable ? 0x00 : 0xFF;
114 pad->sendbuf[4] = pad->motor2enable ? 0x80 : 0xFF;
115 err = psxpad_command(pad, sizeof(PSX_CMD_ENABLE_MOTOR));
116 if (err) {
117 dev_err(&pad->spi->dev,
118 "%s: failed to enable motor mode: %d\n",
119 __func__, err);
120 return;
121 }
122
123 memcpy(pad->sendbuf, PSX_CMD_EXIT_CFG, sizeof(PSX_CMD_EXIT_CFG));
124 err = psxpad_command(pad, sizeof(PSX_CMD_EXIT_CFG));
125 if (err) {
126 dev_err(&pad->spi->dev,
127 "%s: failed to exit config mode: %d\n",
128 __func__, err);
129 return;
130 }
131}
132
133static void psxpad_set_motor_level(struct psxpad *pad,
134 u8 motor1level, u8 motor2level)
135{
136 pad->motor1level = motor1level ? 0xFF : 0x00;
137 pad->motor2level = REVERSE_BIT(motor2level);
138}
139
140static int psxpad_spi_play_effect(struct input_dev *idev,
141 void *data, struct ff_effect *effect)
142{
143 struct input_polled_dev *pdev = input_get_drvdata(idev);
144 struct psxpad *pad = pdev->private;
145
146 switch (effect->type) {
147 case FF_RUMBLE:
148 psxpad_set_motor_level(pad,
149 (effect->u.rumble.weak_magnitude >> 8) & 0xFFU,
150 (effect->u.rumble.strong_magnitude >> 8) & 0xFFU);
151 break;
152 }
153
154 return 0;
155}
156
157static int psxpad_spi_init_ff(struct psxpad *pad)
158{
159 int err;
160
161 input_set_capability(pad->pdev->input, EV_FF, FF_RUMBLE);
162
163 err = input_ff_create_memless(pad->pdev->input, NULL,
164 psxpad_spi_play_effect);
165 if (err) {
166 dev_err(&pad->spi->dev,
167 "input_ff_create_memless() failed: %d\n", err);
168 return err;
169 }
170
171 return 0;
172}
173
174#else /* CONFIG_JOYSTICK_PSXPAD_SPI_FF */
175
176static void psxpad_control_motor(struct psxpad *pad,
177 bool motor1enable, bool motor2enable)
178{
179}
180
181static void psxpad_set_motor_level(struct psxpad *pad,
182 u8 motor1level, u8 motor2level)
183{
184}
185
186static inline int psxpad_spi_init_ff(struct psxpad *pad)
187{
188 return 0;
189}
190#endif /* CONFIG_JOYSTICK_PSXPAD_SPI_FF */
191
192static void psxpad_spi_poll_open(struct input_polled_dev *pdev)
193{
194 struct psxpad *pad = pdev->private;
195
196 pm_runtime_get_sync(&pad->spi->dev);
197}
198
199static void psxpad_spi_poll_close(struct input_polled_dev *pdev)
200{
201 struct psxpad *pad = pdev->private;
202
203 pm_runtime_put_sync(&pad->spi->dev);
204}
205
206static void psxpad_spi_poll(struct input_polled_dev *pdev)
207{
208 struct psxpad *pad = pdev->private;
209 struct input_dev *input = pdev->input;
210 u8 b_rsp3, b_rsp4;
211 int err;
212
213 psxpad_control_motor(pad, true, true);
214
215 memcpy(pad->sendbuf, PSX_CMD_POLL, sizeof(PSX_CMD_POLL));
216 pad->sendbuf[3] = pad->motor1enable ? pad->motor1level : 0x00;
217 pad->sendbuf[4] = pad->motor2enable ? pad->motor2level : 0x00;
218 err = psxpad_command(pad, sizeof(PSX_CMD_POLL));
219 if (err) {
220 dev_err(&pad->spi->dev,
221 "%s: poll command failed mode: %d\n", __func__, err);
222 return;
223 }
224
225 switch (pad->response[1]) {
226 case 0xCE: /* 0x73 : analog 1 */
227 /* button data is inverted */
228 b_rsp3 = ~pad->response[3];
229 b_rsp4 = ~pad->response[4];
230
231 input_report_abs(input, ABS_X, REVERSE_BIT(pad->response[7]));
232 input_report_abs(input, ABS_Y, REVERSE_BIT(pad->response[8]));
233 input_report_abs(input, ABS_RX, REVERSE_BIT(pad->response[5]));
234 input_report_abs(input, ABS_RY, REVERSE_BIT(pad->response[6]));
235 input_report_key(input, BTN_DPAD_UP, b_rsp3 & BIT(3));
236 input_report_key(input, BTN_DPAD_DOWN, b_rsp3 & BIT(1));
237 input_report_key(input, BTN_DPAD_LEFT, b_rsp3 & BIT(0));
238 input_report_key(input, BTN_DPAD_RIGHT, b_rsp3 & BIT(2));
239 input_report_key(input, BTN_X, b_rsp4 & BIT(3));
240 input_report_key(input, BTN_A, b_rsp4 & BIT(2));
241 input_report_key(input, BTN_B, b_rsp4 & BIT(1));
242 input_report_key(input, BTN_Y, b_rsp4 & BIT(0));
243 input_report_key(input, BTN_TL, b_rsp4 & BIT(5));
244 input_report_key(input, BTN_TR, b_rsp4 & BIT(4));
245 input_report_key(input, BTN_TL2, b_rsp4 & BIT(7));
246 input_report_key(input, BTN_TR2, b_rsp4 & BIT(6));
247 input_report_key(input, BTN_THUMBL, b_rsp3 & BIT(6));
248 input_report_key(input, BTN_THUMBR, b_rsp3 & BIT(5));
249 input_report_key(input, BTN_SELECT, b_rsp3 & BIT(7));
250 input_report_key(input, BTN_START, b_rsp3 & BIT(4));
251 break;
252
253 case 0x82: /* 0x41 : digital */
254 /* button data is inverted */
255 b_rsp3 = ~pad->response[3];
256 b_rsp4 = ~pad->response[4];
257
258 input_report_abs(input, ABS_X, 0x80);
259 input_report_abs(input, ABS_Y, 0x80);
260 input_report_abs(input, ABS_RX, 0x80);
261 input_report_abs(input, ABS_RY, 0x80);
262 input_report_key(input, BTN_DPAD_UP, b_rsp3 & BIT(3));
263 input_report_key(input, BTN_DPAD_DOWN, b_rsp3 & BIT(1));
264 input_report_key(input, BTN_DPAD_LEFT, b_rsp3 & BIT(0));
265 input_report_key(input, BTN_DPAD_RIGHT, b_rsp3 & BIT(2));
266 input_report_key(input, BTN_X, b_rsp4 & BIT(3));
267 input_report_key(input, BTN_A, b_rsp4 & BIT(2));
268 input_report_key(input, BTN_B, b_rsp4 & BIT(1));
269 input_report_key(input, BTN_Y, b_rsp4 & BIT(0));
270 input_report_key(input, BTN_TL, b_rsp4 & BIT(5));
271 input_report_key(input, BTN_TR, b_rsp4 & BIT(4));
272 input_report_key(input, BTN_TL2, b_rsp4 & BIT(7));
273 input_report_key(input, BTN_TR2, b_rsp4 & BIT(6));
274 input_report_key(input, BTN_THUMBL, false);
275 input_report_key(input, BTN_THUMBR, false);
276 input_report_key(input, BTN_SELECT, b_rsp3 & BIT(7));
277 input_report_key(input, BTN_START, b_rsp3 & BIT(4));
278 break;
279 }
280
281 input_sync(input);
282}
283
284static int psxpad_spi_probe(struct spi_device *spi)
285{
286 struct psxpad *pad;
287 struct input_polled_dev *pdev;
288 struct input_dev *idev;
289 int err;
290
291 pad = devm_kzalloc(&spi->dev, sizeof(struct psxpad), GFP_KERNEL);
292 if (!pad)
293 return -ENOMEM;
294
295 pdev = input_allocate_polled_device();
296 if (!pdev) {
297 dev_err(&spi->dev, "failed to allocate input device\n");
298 return -ENOMEM;
299 }
300
301 /* input poll device settings */
302 pad->pdev = pdev;
303 pad->spi = spi;
304
305 pdev->private = pad;
306 pdev->open = psxpad_spi_poll_open;
307 pdev->close = psxpad_spi_poll_close;
308 pdev->poll = psxpad_spi_poll;
309 /* poll interval is about 60fps */
310 pdev->poll_interval = 16;
311 pdev->poll_interval_min = 8;
312 pdev->poll_interval_max = 32;
313
314 /* input device settings */
315 idev = pdev->input;
316 idev->name = "PlayStation 1/2 joypad";
317 snprintf(pad->phys, sizeof(pad->phys), "%s/input", dev_name(&spi->dev));
318 idev->id.bustype = BUS_SPI;
319
320 /* key/value map settings */
321 input_set_abs_params(idev, ABS_X, 0, 255, 0, 0);
322 input_set_abs_params(idev, ABS_Y, 0, 255, 0, 0);
323 input_set_abs_params(idev, ABS_RX, 0, 255, 0, 0);
324 input_set_abs_params(idev, ABS_RY, 0, 255, 0, 0);
325 input_set_capability(idev, EV_KEY, BTN_DPAD_UP);
326 input_set_capability(idev, EV_KEY, BTN_DPAD_DOWN);
327 input_set_capability(idev, EV_KEY, BTN_DPAD_LEFT);
328 input_set_capability(idev, EV_KEY, BTN_DPAD_RIGHT);
329 input_set_capability(idev, EV_KEY, BTN_A);
330 input_set_capability(idev, EV_KEY, BTN_B);
331 input_set_capability(idev, EV_KEY, BTN_X);
332 input_set_capability(idev, EV_KEY, BTN_Y);
333 input_set_capability(idev, EV_KEY, BTN_TL);
334 input_set_capability(idev, EV_KEY, BTN_TR);
335 input_set_capability(idev, EV_KEY, BTN_TL2);
336 input_set_capability(idev, EV_KEY, BTN_TR2);
337 input_set_capability(idev, EV_KEY, BTN_THUMBL);
338 input_set_capability(idev, EV_KEY, BTN_THUMBR);
339 input_set_capability(idev, EV_KEY, BTN_SELECT);
340 input_set_capability(idev, EV_KEY, BTN_START);
341
342 err = psxpad_spi_init_ff(pad);
343 if (err)
344 return err;
345
346 /* SPI settings */
347 spi->mode = SPI_MODE_3;
348 spi->bits_per_word = 8;
349 /* (PlayStation 1/2 joypad might be possible works 250kHz/500kHz) */
350 spi->master->min_speed_hz = 125000;
351 spi->master->max_speed_hz = 125000;
352 spi_setup(spi);
353
354 /* pad settings */
355 psxpad_set_motor_level(pad, 0, 0);
356
357 /* register input poll device */
358 err = input_register_polled_device(pdev);
359 if (err) {
360 dev_err(&spi->dev,
361 "failed to register input poll device: %d\n", err);
362 return err;
363 }
364
365 pm_runtime_enable(&spi->dev);
366
367 return 0;
368}
369
370static int __maybe_unused psxpad_spi_suspend(struct device *dev)
371{
372 struct spi_device *spi = to_spi_device(dev);
373 struct psxpad *pad = spi_get_drvdata(spi);
374
375 psxpad_set_motor_level(pad, 0, 0);
376
377 return 0;
378}
379
380static SIMPLE_DEV_PM_OPS(psxpad_spi_pm, psxpad_spi_suspend, NULL);
381
382static const struct spi_device_id psxpad_spi_id[] = {
383 { "psxpad-spi", 0 },
384 { }
385};
386MODULE_DEVICE_TABLE(spi, psxpad_spi_id);
387
388static struct spi_driver psxpad_spi_driver = {
389 .driver = {
390 .name = "psxpad-spi",
391 .pm = &psxpad_spi_pm,
392 },
393 .id_table = psxpad_spi_id,
394 .probe = psxpad_spi_probe,
395};
396
397module_spi_driver(psxpad_spi_driver);
398
399MODULE_AUTHOR("Tomohiro Yoshidomi <sylph23k@gmail.com>");
400MODULE_DESCRIPTION("PlayStation 1/2 joypads via SPI interface Driver");
401MODULE_LICENSE("GPL");
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index df83fdc6c0e7..def96cd2479b 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -126,25 +126,26 @@ 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, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
130 { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 },
129 { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, 131 { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
130 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, 132 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
131 { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, 133 { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
132 { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, 134 { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
133 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, 135 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
136 { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
134 { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, 137 { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE },
135 { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, 138 { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE },
136 { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, 139 { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE },
137 { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE }, 140 { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE },
138 { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
139 { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, 141 { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
140 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
141 { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 },
142 { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 }, 142 { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
143 { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 }, 143 { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 },
144 { 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 }, 144 { 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
145 { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, 145 { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
146 { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, 146 { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
147 { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, 147 { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
148 { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 },
148 { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, 149 { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
149 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, 150 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
150 { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, 151 { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
@@ -179,13 +180,15 @@ static const struct xpad_device {
179 { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, 180 { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
180 { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 181 { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
181 { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 182 { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
183 { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 },
182 { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, 184 { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE },
185 { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE },
183 { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, 186 { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
184 { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 187 { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
185 { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 188 { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
186 { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE },
187 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, 189 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
188 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, 190 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
191 { 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 },
189 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, 192 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
190 { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX }, 193 { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX },
191 { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, 194 { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 },
@@ -209,27 +212,38 @@ static const struct xpad_device {
209 { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 }, 212 { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 },
210 { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, 213 { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
211 { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, 214 { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
212 { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, 215 { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 },
213 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
214 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, 216 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
215 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 217 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
216 { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, 218 { 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 },
220 { 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 },
217 { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 }, 222 { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 },
218 { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, 223 { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 },
224 { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
219 { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 }, 225 { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 },
226 { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
220 { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 }, 227 { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 },
221 { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 }, 228 { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 },
222 { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 }, 229 { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 },
230 { 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 },
223 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 231 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
224 { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, 232 { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 },
225 { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, 233 { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
234 { 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 },
235 { 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 },
226 { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, 236 { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE },
237 { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE },
227 { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, 238 { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE },
228 { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, 239 { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 },
229 { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, 240 { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 },
241 { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
230 { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, 242 { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 },
243 { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 },
231 { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 }, 244 { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 },
232 { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, 245 { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
246 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 },
233 { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, 247 { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
234 { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } 248 { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
235}; 249};
@@ -316,6 +330,7 @@ static struct usb_device_id xpad_table[] = {
316 XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ 330 XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */
317 XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ 331 XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */
318 XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ 332 XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */
333 XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */
319 XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ 334 XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */
320 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ 335 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */
321 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ 336 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */
diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index c7a8120b13c0..79eb29550c34 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -660,7 +660,7 @@ static const struct of_device_id cros_ec_keyb_of_match[] = {
660MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match); 660MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
661#endif 661#endif
662 662
663static const SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume); 663static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
664 664
665static struct platform_driver cros_ec_keyb_driver = { 665static struct platform_driver cros_ec_keyb_driver = {
666 .probe = cros_ec_keyb_probe, 666 .probe = cros_ec_keyb_probe,