aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-03-14 10:30:16 -0400
committerJiri Kosina <jkosina@suse.cz>2014-03-14 10:30:16 -0400
commit65ab2fc479fa8554e26d6d1726a4ebe6f29a73be (patch)
treea90294685f0e2a445397a6d9e7e85ac7949ebf1d
parent866e4797b4e8100f5abcf2bfd3f7843dc40306cd (diff)
parentdccf2f65e68d2f5b5e86ae6cf9796cf558694953 (diff)
Merge branch 'for-3.15/sony' into for-3.15/hid-core-ll-transport-cleanup
-rw-r--r--drivers/hid/Kconfig10
-rw-r--r--drivers/hid/hid-sony.c754
-rw-r--r--net/bluetooth/hidp/core.c3
3 files changed, 701 insertions, 66 deletions
<
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 669cc19573ae..7af9d0b5dea1 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -617,25 +617,27 @@ config HID_SAMSUNG
617 Support for Samsung InfraRed remote control or keyboards. 617 Support for Samsung InfraRed remote control or keyboards.
618 618
619config HID_SONY 619config HID_SONY
620 tristate "Sony PS2/3 accessories" 620 tristate "Sony PS2/3/4 accessories"
621 depends on USB_HID 621 depends on USB_HID
622 depends on NEW_LEDS 622 depends on NEW_LEDS
623 depends on LEDS_CLASS 623 depends on LEDS_CLASS
624 select POWER_SUPPLY
624 ---help--- 625 ---help---
625 Support for 626 Support for
626 627
627 * Sony PS3 6-axis controllers 628 * Sony PS3 6-axis controllers
629 * Sony PS4 DualShock 4 controllers
628 * Buzz controllers 630 * Buzz controllers
629 * Sony PS3 Blue-ray Disk Remote Control (Bluetooth) 631 * Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
630 * Logitech Harmony adapter for Sony Playstation 3 (Bluetooth) 632 * Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
631 633
632config SONY_FF 634config SONY_FF
633 bool "Sony PS2/3 accessories force feedback support" 635 bool "Sony PS2/3/4 accessories force feedback support"
634 depends on HID_SONY 636 depends on HID_SONY
635 select INPUT_FF_MEMLESS 637 select INPUT_FF_MEMLESS
636 ---help--- 638 ---help---
637 Say Y here if you have a Sony PS2/3 accessory and want to enable force 639 Say Y here if you have a Sony PS2/3/4 accessory and want to enable
638 feedback support for it. 640 force feedback support for it.
639 641
640config HID_SPEEDLINK 642config HID_SPEEDLINK
641 tristate "Speedlink VAD Cezanne mouse support" 643 tristate "Speedlink VAD Cezanne mouse support"
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index e3e89b6a41c2..b5fe65e70dc4 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -17,7 +17,8 @@
17 * any later version. 17 * any later version.
18 */ 18 */
19 19
20/* NOTE: in order for the Sony PS3 BD Remote Control to be found by 20/*
21 * NOTE: in order for the Sony PS3 BD Remote Control to be found by
21 * a Bluetooth host, the key combination Start+Enter has to be kept pressed 22 * a Bluetooth host, the key combination Start+Enter has to be kept pressed
22 * for about 7 seconds with the Bluetooth Host Controller in discovering mode. 23 * for about 7 seconds with the Bluetooth Host Controller in discovering mode.
23 * 24 *
@@ -30,6 +31,10 @@
30#include <linux/slab.h> 31#include <linux/slab.h>
31#include <linux/usb.h> 32#include <linux/usb.h>
32#include <linux/leds.h> 33#include <linux/leds.h>
34#include <linux/power_supply.h>
35#include <linux/spinlock.h>
36#include <linux/list.h>
37#include <linux/input/mt.h>
33 38
34#include "hid-ids.h" 39#include "hid-ids.h"
35 40
@@ -41,7 +46,13 @@
41#define DUALSHOCK4_CONTROLLER_USB BIT(5) 46#define DUALSHOCK4_CONTROLLER_USB BIT(5)
42#define DUALSHOCK4_CONTROLLER_BT BIT(6) 47#define DUALSHOCK4_CONTROLLER_BT BIT(6)
43 48
44#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB) 49#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
50#define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |\
51 DUALSHOCK4_CONTROLLER_BT)
52#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\
53 DUALSHOCK4_CONTROLLER)
54#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
55#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
45 56
46#define MAX_LEDS 4 57#define MAX_LEDS 4
47 58
@@ -73,7 +84,8 @@ static const u8 sixaxis_rdesc_fixup2[] = {
73 0xb1, 0x02, 0xc0, 0xc0, 84 0xb1, 0x02, 0xc0, 0xc0,
74}; 85};
75 86
76/* The default descriptor doesn't provide mapping for the accelerometers 87/*
88 * The default descriptor doesn't provide mapping for the accelerometers
77 * or orientation sensors. This fixed descriptor maps the accelerometers 89 * or orientation sensors. This fixed descriptor maps the accelerometers
78 * to usage values 0x40, 0x41 and 0x42 and maps the orientation sensors 90 * to usage values 0x40, 0x41 and 0x42 and maps the orientation sensors
79 * to usage values 0x43, 0x44 and 0x45. 91 * to usage values 0x43, 0x44 and 0x45.
@@ -332,6 +344,217 @@ static u8 dualshock4_usb_rdesc[] = {
332 0xC0 /* End Collection */ 344 0xC0 /* End Collection */
333}; 345};
334 346
347/*
348 * The default behavior of the Dualshock 4 is to send reports using report
349 * type 1 when running over Bluetooth. However, as soon as it receives a
350 * report of type 17 to set the LEDs or rumble it starts returning it's state
351 * in report 17 instead of 1. Since report 17 is undefined in the default HID
352 * descriptor the button and axis definitions must be moved to report 17 or
353 * the HID layer won't process the received input once a report is sent.
354 */
355static u8 dualshock4_bt_rdesc[] = {
356 0x05, 0x01, /* Usage Page (Desktop), */
357 0x09, 0x05, /* Usage (Gamepad), */
358 0xA1, 0x01, /* Collection (Application), */
359 0x85, 0x01, /* Report ID (1), */
360 0x75, 0x08, /* Report Size (8), */
361 0x95, 0x0A, /* Report Count (9), */
362 0x81, 0x02, /* Input (Variable), */
363 0x06, 0x04, 0xFF, /* Usage Page (FF04h), */
364 0x85, 0x02, /* Report ID (2), */
365 0x09, 0x24, /* Usage (24h), */
366 0x95, 0x24, /* Report Count (36), */
367 0xB1, 0x02, /* Feature (Variable), */
368 0x85, 0xA3, /* Report ID (163), */
369 0x09, 0x25, /* Usage (25h), */
370 0x95, 0x30, /* Report Count (48), */
371 0xB1, 0x02, /* Feature (Variable), */
372 0x85, 0x05, /* Report ID (5), */
373 0x09, 0x26, /* Usage (26h), */
374 0x95, 0x28, /* Report Count (40), */
375 0xB1, 0x02, /* Feature (Variable), */
376 0x85, 0x06, /* Report ID (6), */
377 0x09, 0x27, /* Usage (27h), */
378 0x95, 0x34, /* Report Count (52), */
379 0xB1, 0x02, /* Feature (Variable), */
380 0x85, 0x07, /* Report ID (7), */
381 0x09, 0x28, /* Usage (28h), */
382 0x95, 0x30, /* Report Count (48), */
383 0xB1, 0x02, /* Feature (Variable), */
384 0x85, 0x08, /* Report ID (8), */
385 0x09, 0x29, /* Usage (29h), */
386 0x95, 0x2F, /* Report Count (47), */
387 0xB1, 0x02, /* Feature (Variable), */
388 0x06, 0x03, 0xFF, /* Usage Page (FF03h), */
389 0x85, 0x03, /* Report ID (3), */
390 0x09, 0x21, /* Usage (21h), */
391 0x95, 0x26, /* Report Count (38), */
392 0xB1, 0x02, /* Feature (Variable), */
393 0x85, 0x04, /* Report ID (4), */
394 0x09, 0x22, /* Usage (22h), */
395 0x95, 0x2E, /* Report Count (46), */
396 0xB1, 0x02, /* Feature (Variable), */
397 0x85, 0xF0, /* Report ID (240), */
398 0x09, 0x47, /* Usage (47h), */
399 0x95, 0x3F, /* Report Count (63), */
400 0xB1, 0x02, /* Feature (Variable), */
401 0x85, 0xF1, /* Report ID (241), */
402 0x09, 0x48, /* Usage (48h), */
403 0x95, 0x3F, /* Report Count (63), */
404 0xB1, 0x02, /* Feature (Variable), */
405 0x85, 0xF2, /* Report ID (242), */
406 0x09, 0x49, /* Usage (49h), */
407 0x95, 0x0F, /* Report Count (15), */
408 0xB1, 0x02, /* Feature (Variable), */
409 0x85, 0x11, /* Report ID (17), */
410 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
411 0x09, 0x20, /* Usage (20h), */
412 0x95, 0x02, /* Report Count (2), */
413 0x81, 0x02, /* Input (Variable), */
414 0x05, 0x01, /* Usage Page (Desktop), */
415 0x09, 0x30, /* Usage (X), */
416 0x09, 0x31, /* Usage (Y), */
417 0x09, 0x32, /* Usage (Z), */
418 0x09, 0x35, /* Usage (Rz), */
419 0x15, 0x00, /* Logical Minimum (0), */
420 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
421 0x75, 0x08, /* Report Size (8), */
422 0x95, 0x04, /* Report Count (4), */
423 0x81, 0x02, /* Input (Variable), */
424 0x09, 0x39, /* Usage (Hat Switch), */
425 0x15, 0x00, /* Logical Minimum (0), */
426 0x25, 0x07, /* Logical Maximum (7), */
427 0x75, 0x04, /* Report Size (4), */
428 0x95, 0x01, /* Report Count (1), */