diff options
| -rw-r--r-- | drivers/hid/hid-sony.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 3fba2dcae0c2..af02139b0b93 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
| @@ -48,15 +48,20 @@ | |||
| 48 | #define DUALSHOCK4_CONTROLLER_BT BIT(6) | 48 | #define DUALSHOCK4_CONTROLLER_BT BIT(6) |
| 49 | #define MOTION_CONTROLLER_USB BIT(7) | 49 | #define MOTION_CONTROLLER_USB BIT(7) |
| 50 | #define MOTION_CONTROLLER_BT BIT(8) | 50 | #define MOTION_CONTROLLER_BT BIT(8) |
| 51 | #define NAVIGATION_CONTROLLER_USB BIT(9) | ||
| 52 | #define NAVIGATION_CONTROLLER_BT BIT(10) | ||
| 51 | 53 | ||
| 52 | #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT) | 54 | #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT) |
| 53 | #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT) | 55 | #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT) |
| 56 | #define NAVIGATION_CONTROLLER (NAVIGATION_CONTROLLER_USB |\ | ||
| 57 | NAVIGATION_CONTROLLER_BT) | ||
| 54 | #define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |\ | 58 | #define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |\ |
| 55 | DUALSHOCK4_CONTROLLER_BT) | 59 | DUALSHOCK4_CONTROLLER_BT) |
| 56 | #define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\ | 60 | #define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\ |
| 57 | DUALSHOCK4_CONTROLLER | MOTION_CONTROLLER) | 61 | DUALSHOCK4_CONTROLLER | MOTION_CONTROLLER |\ |
| 62 | NAVIGATION_CONTROLLER) | ||
| 58 | #define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\ | 63 | #define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\ |
| 59 | MOTION_CONTROLLER_BT) | 64 | MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER) |
| 60 | #define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\ | 65 | #define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\ |
| 61 | MOTION_CONTROLLER) | 66 | MOTION_CONTROLLER) |
| 62 | 67 | ||
| @@ -1052,6 +1057,9 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
| 1052 | if (sc->quirks & MOTION_CONTROLLER) | 1057 | if (sc->quirks & MOTION_CONTROLLER) |
| 1053 | return motion_fixup(hdev, rdesc, rsize); | 1058 | return motion_fixup(hdev, rdesc, rsize); |
| 1054 | 1059 | ||
| 1060 | if (sc->quirks & NAVIGATION_CONTROLLER) | ||
| 1061 | return sixaxis_fixup(hdev, rdesc, rsize); | ||
| 1062 | |||
| 1055 | if (sc->quirks & PS3REMOTE) | 1063 | if (sc->quirks & PS3REMOTE) |
| 1056 | return ps3remote_fixup(hdev, rdesc, rsize); | 1064 | return ps3remote_fixup(hdev, rdesc, rsize); |
| 1057 | 1065 | ||
| @@ -1181,6 +1189,9 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
| 1181 | sixaxis_parse_report(sc, rd, size); | 1189 | sixaxis_parse_report(sc, rd, size); |
| 1182 | } else if ((sc->quirks & MOTION_CONTROLLER_BT) && rd[0] == 0x01 && size == 49) { | 1190 | } else if ((sc->quirks & MOTION_CONTROLLER_BT) && rd[0] == 0x01 && size == 49) { |
| 1183 | sixaxis_parse_report(sc, rd, size); | 1191 | sixaxis_parse_report(sc, rd, size); |
| 1192 | } else if ((sc->quirks & NAVIGATION_CONTROLLER) && rd[0] == 0x01 && | ||
| 1193 | size == 49) { | ||
| 1194 | sixaxis_parse_report(sc, rd, size); | ||
| 1184 | } else if (((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 && | 1195 | } else if (((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 && |
| 1185 | size == 64) || ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) | 1196 | size == 64) || ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) |
| 1186 | && rd[0] == 0x11 && size == 78)) { | 1197 | && rd[0] == 0x11 && size == 78)) { |
| @@ -1591,6 +1602,15 @@ static int sony_leds_init(struct sony_sc *sc) | |||
| 1591 | use_ds4_names = 1; | 1602 | use_ds4_names = 1; |
| 1592 | name_len = 0; | 1603 | name_len = 0; |
| 1593 | name_fmt = "%s:%s"; | 1604 | name_fmt = "%s:%s"; |
| 1605 | } else if (sc->quirks & NAVIGATION_CONTROLLER) { | ||
| 1606 | static const __u8 navigation_leds[4] = {0x01, 0x00, 0x00, 0x00}; | ||
| 1607 | |||
| 1608 | memcpy(sc->led_state, navigation_leds, sizeof(navigation_leds)); | ||
| 1609 | sc->led_count = 1; | ||
| 1610 | memset(use_hw_blink, 1, 4); | ||
| 1611 | use_ds4_names = 0; | ||
| 1612 | name_len = strlen("::sony#"); | ||
| 1613 | name_fmt = "%s::sony%d"; | ||
| 1594 | } else { | 1614 | } else { |
| 1595 | sixaxis_set_leds_from_id(sc); | 1615 | sixaxis_set_leds_from_id(sc); |
| 1596 | sc->led_count = 4; | 1616 | sc->led_count = 4; |
| @@ -1782,7 +1802,8 @@ static void motion_state_worker(struct work_struct *work) | |||
| 1782 | 1802 | ||
| 1783 | static int sony_allocate_output_report(struct sony_sc *sc) | 1803 | static int sony_allocate_output_report(struct sony_sc *sc) |
| 1784 | { | 1804 | { |
| 1785 | if (sc->quirks & SIXAXIS_CONTROLLER) | 1805 | if ((sc->quirks & SIXAXIS_CONTROLLER) || |
| 1806 | (sc->quirks & NAVIGATION_CONTROLLER)) | ||
| 1786 | sc->output_report_dmabuf = | 1807 | sc->output_report_dmabuf = |
| 1787 | kmalloc(sizeof(union sixaxis_output_report_01), | 1808 | kmalloc(sizeof(union sixaxis_output_report_01), |
| 1788 | GFP_KERNEL); | 1809 | GFP_KERNEL); |
| @@ -2001,6 +2022,7 @@ static int sony_check_add(struct sony_sc *sc) | |||
| 2001 | 2022 | ||
| 2002 | if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) || | 2023 | if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) || |
| 2003 | (sc->quirks & MOTION_CONTROLLER_BT) || | 2024 | (sc->quirks & MOTION_CONTROLLER_BT) || |
| 2025 | (sc->quirks & NAVIGATION_CONTROLLER_BT) || | ||
| 2004 | (sc->quirks & SIXAXIS_CONTROLLER_BT)) { | 2026 | (sc->quirks & SIXAXIS_CONTROLLER_BT)) { |
| 2005 | /* | 2027 | /* |
| 2006 | * sony_get_bt_devaddr() attempts to parse the Bluetooth MAC | 2028 | * sony_get_bt_devaddr() attempts to parse the Bluetooth MAC |
| @@ -2033,7 +2055,8 @@ static int sony_check_add(struct sony_sc *sc) | |||
| 2033 | } | 2055 | } |
| 2034 | 2056 | ||
| 2035 | memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); | 2057 | memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); |
| 2036 | } else if (sc->quirks & SIXAXIS_CONTROLLER_USB) { | 2058 | } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || |
| 2059 | (sc->quirks & NAVIGATION_CONTROLLER_USB)) { | ||
| 2037 | buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); | 2060 | buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); |
| 2038 | if (!buf) | 2061 | if (!buf) |
| 2039 | return -ENOMEM; | 2062 | return -ENOMEM; |
| @@ -2167,7 +2190,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 2167 | goto err_stop; | 2190 | goto err_stop; |
| 2168 | } | 2191 | } |
| 2169 | 2192 | ||
| 2170 | if (sc->quirks & SIXAXIS_CONTROLLER_USB) { | 2193 | if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || |
| 2194 | (sc->quirks & NAVIGATION_CONTROLLER_USB)) { | ||
| 2171 | /* | 2195 | /* |
| 2172 | * The Sony Sixaxis does not handle HID Output Reports on the | 2196 | * The Sony Sixaxis does not handle HID Output Reports on the |
| 2173 | * Interrupt EP like it could, so we need to force HID Output | 2197 | * Interrupt EP like it could, so we need to force HID Output |
| @@ -2182,7 +2206,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 2182 | hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID; | 2206 | hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID; |
| 2183 | ret = sixaxis_set_operational_usb(hdev); | 2207 | ret = sixaxis_set_operational_usb(hdev); |
| 2184 | sony_init_work(sc, sixaxis_state_worker); | 2208 | sony_init_work(sc, sixaxis_state_worker); |
| 2185 | } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) { | 2209 | } else if ((sc->quirks & SIXAXIS_CONTROLLER_BT) || |
| 2210 | (sc->quirks & NAVIGATION_CONTROLLER_BT)) { | ||
| 2186 | /* | 2211 | /* |
| 2187 | * The Sixaxis wants output reports sent on the ctrl endpoint | 2212 | * The Sixaxis wants output reports sent on the ctrl endpoint |
| 2188 | * when connected via Bluetooth. | 2213 | * when connected via Bluetooth. |
| @@ -2286,9 +2311,9 @@ static const struct hid_device_id sony_devices[] = { | |||
| 2286 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), | 2311 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), |
| 2287 | .driver_data = SIXAXIS_CONTROLLER_USB }, | 2312 | .driver_data = SIXAXIS_CONTROLLER_USB }, |
| 2288 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER), | 2313 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER), |
| 2289 | .driver_data = SIXAXIS_CONTROLLER_USB }, | 2314 | .driver_data = NAVIGATION_CONTROLLER_USB }, |
| 2290 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER), | 2315 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER), |
| 2291 | .driver_data = SIXAXIS_CONTROLLER_BT }, | 2316 | .driver_data = NAVIGATION_CONTROLLER_BT }, |
| 2292 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER), | 2317 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER), |
| 2293 | .driver_data = MOTION_CONTROLLER_USB }, | 2318 | .driver_data = MOTION_CONTROLLER_USB }, |
| 2294 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER), | 2319 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER), |
