From: Sasha Levin Date: Thu, 29 Nov 2018 09:06:05 +0000 (-0500) Subject: xpad fixes and quirks for 4.14 X-Git-Tag: v4.19.6~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f4e2e022b2eb9445e540edc353f794ada0909174;p=thirdparty%2Fkernel%2Fstable-queue.git xpad fixes and quirks for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/input-xpad-add-pdp-device-id-0x02a4.patch b/queue-4.14/input-xpad-add-pdp-device-id-0x02a4.patch new file mode 100644 index 00000000000..fedaecba340 --- /dev/null +++ b/queue-4.14/input-xpad-add-pdp-device-id-0x02a4.patch @@ -0,0 +1,62 @@ +From 0b611b1799d7adfc782705983699912748708ba2 Mon Sep 17 00:00:00 2001 +From: Francis Therien +Date: Mon, 26 Mar 2018 15:59:00 -0700 +Subject: Input: xpad - add PDP device id 0x02a4 + +[ Upstream commit c6c848572f4da0e34ffe0a35364b4db871e13e42 ] + +Adds support for a PDP Xbox One controller with device ID +(0x06ef:0x02a4). The Product string for this device is "PDP Wired +Controller for Xbox One - Stealth Series | Phantom Black". + +Signed-off-by: Francis Therien +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 53f775c41cd1..d2a1857fdae5 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -231,6 +231,7 @@ static const struct xpad_device { + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, +@@ -480,7 +481,8 @@ static const u8 xboxone_hori_init[] = { + + /* + * This packet is required for some of the PDP pads to start +- * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ * sending input reports. These pads include: (0x0e6f:0x02ab), ++ * (0x0e6f:0x02a4). + */ + static const u8 xboxone_pdp_init1[] = { + 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 +@@ -488,7 +490,8 @@ static const u8 xboxone_pdp_init1[] = { + + /* + * This packet is required for some of the PDP pads to start +- * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ * sending input reports. These pads include: (0x0e6f:0x02ab), ++ * (0x0e6f:0x02a4). + */ + static const u8 xboxone_pdp_init2[] = { + 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 +@@ -526,6 +529,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +-- +2.17.1 + diff --git a/queue-4.14/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch b/queue-4.14/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch new file mode 100644 index 00000000000..d1777a83482 --- /dev/null +++ b/queue-4.14/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch @@ -0,0 +1,48 @@ +From ed58d17d8c75c149a7ca0146a202180c2c390fa6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ramses=20Ram=C3=ADrez?= +Date: Fri, 28 Sep 2018 16:59:26 -0700 +Subject: Input: xpad - add support for Xbox1 PDP Camo series gamepad +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit 9735082a7cbae572c2eabdc45acecc8c9fa0759b ] + +The "Xbox One PDP Wired Controller - Camo series" has a different +product-id than the regular PDP controller and the PDP stealth series, +but it uses the same initialization sequence. This patch adds the +product-id of the camo series to the structures that handle the other +PDP Xbox One controllers. + +Signed-off-by: Ramses Ramírez +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 69b44aebaf01..2e52015634f9 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -234,6 +234,7 @@ static const struct xpad_device { + { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, +@@ -533,6 +534,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), + XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +-- +2.17.1 + diff --git a/queue-4.14/input-xpad-avoid-using-__set_bit-for-capabilities.patch b/queue-4.14/input-xpad-avoid-using-__set_bit-for-capabilities.patch new file mode 100644 index 00000000000..851db86dedc --- /dev/null +++ b/queue-4.14/input-xpad-avoid-using-__set_bit-for-capabilities.patch @@ -0,0 +1,90 @@ +From a89ee2d8e61d030e02ff844ada34a06b50305b22 Mon Sep 17 00:00:00 2001 +From: Marcus Folkesson +Date: Tue, 8 May 2018 15:17:07 -0700 +Subject: Input: xpad - avoid using __set_bit() for capabilities + +[ Upstream commit a01308031c2647ed5f1c845104b73a8820a958a9 ] + +input_set_capability() and input_set_abs_param() will do it for you. + +Signed-off-by: Marcus Folkesson +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 7e812a8877bc..69b44aebaf01 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1581,8 +1581,6 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + { + struct usb_xpad *xpad = input_get_drvdata(input_dev); + +- set_bit(abs, input_dev->absbit); +- + switch (abs) { + case ABS_X: + case ABS_Y: +@@ -1601,6 +1599,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */ + input_set_abs_params(input_dev, abs, -1, 1, 0, 0); + break; ++ default: ++ input_set_abs_params(input_dev, abs, 0, 0, 0, 0); ++ break; + } + } + +@@ -1641,10 +1642,7 @@ static int xpad_init_input(struct usb_xpad *xpad) + input_dev->close = xpad_close; + } + +- __set_bit(EV_KEY, input_dev->evbit); +- + if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { +- __set_bit(EV_ABS, input_dev->evbit); + /* set up axes */ + for (i = 0; xpad_abs[i] >= 0; i++) + xpad_set_up_abs(input_dev, xpad_abs[i]); +@@ -1652,21 +1650,22 @@ static int xpad_init_input(struct usb_xpad *xpad) + + /* set up standard buttons */ + for (i = 0; xpad_common_btn[i] >= 0; i++) +- __set_bit(xpad_common_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad_common_btn[i]); + + /* set up model-specific ones */ + if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || + xpad->xtype == XTYPE_XBOXONE) { + for (i = 0; xpad360_btn[i] >= 0; i++) +- __set_bit(xpad360_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad360_btn[i]); + } else { + for (i = 0; xpad_btn[i] >= 0; i++) +- __set_bit(xpad_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad_btn[i]); + } + + if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { + for (i = 0; xpad_btn_pad[i] >= 0; i++) +- __set_bit(xpad_btn_pad[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, ++ xpad_btn_pad[i]); + } + + /* +@@ -1683,7 +1682,8 @@ static int xpad_init_input(struct usb_xpad *xpad) + + if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { + for (i = 0; xpad_btn_triggers[i] >= 0; i++) +- __set_bit(xpad_btn_triggers[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, ++ xpad_btn_triggers[i]); + } else { + for (i = 0; xpad_abs_triggers[i] >= 0; i++) + xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); +-- +2.17.1 + diff --git a/queue-4.14/input-xpad-fix-some-coding-style-issues.patch b/queue-4.14/input-xpad-fix-some-coding-style-issues.patch new file mode 100644 index 00000000000..23166d97977 --- /dev/null +++ b/queue-4.14/input-xpad-fix-some-coding-style-issues.patch @@ -0,0 +1,73 @@ +From 6c695ade5c500970b6de00da4af3f5eec7cac855 Mon Sep 17 00:00:00 2001 +From: Leo Sperling +Date: Wed, 3 Aug 2016 17:31:09 -0700 +Subject: Input: xpad - fix some coding style issues + +[ Upstream commit 68c78d0155e37992268664e134996d2b140ddf38 ] + +Fix some coding style issues reported by checkpatch.pl. Mostly brackets +in macros, spacing and comment style. + +Signed-off-by: Leo Sperling +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index d2a1857fdae5..7e812a8877bc 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -89,8 +89,10 @@ + + #define XPAD_PKT_LEN 64 + +-/* xbox d-pads should map to buttons, as is required for DDR pads +- but we map them to axes when possible to simplify things */ ++/* ++ * xbox d-pads should map to buttons, as is required for DDR pads ++ * but we map them to axes when possible to simplify things ++ */ + #define MAP_DPAD_TO_BUTTONS (1 << 0) + #define MAP_TRIGGERS_TO_BUTTONS (1 << 1) + #define MAP_STICKS_TO_NULL (1 << 2) +@@ -391,15 +393,15 @@ static const signed short xpad_abs_triggers[] = { + * match against vendor id as well. Wired Xbox 360 devices have protocol 1, + * wireless controllers have protocol 129. + */ +-#define XPAD_XBOX360_VENDOR_PROTOCOL(vend,pr) \ ++#define XPAD_XBOX360_VENDOR_PROTOCOL(vend, pr) \ + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \ + .idVendor = (vend), \ + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ + .bInterfaceSubClass = 93, \ + .bInterfaceProtocol = (pr) + #define XPAD_XBOX360_VENDOR(vend) \ +- { XPAD_XBOX360_VENDOR_PROTOCOL(vend,1) }, \ +- { XPAD_XBOX360_VENDOR_PROTOCOL(vend,129) } ++ { XPAD_XBOX360_VENDOR_PROTOCOL((vend), 1) }, \ ++ { XPAD_XBOX360_VENDOR_PROTOCOL((vend), 129) } + + /* The Xbox One controller uses subclass 71 and protocol 208. */ + #define XPAD_XBOXONE_VENDOR_PROTOCOL(vend, pr) \ +@@ -409,7 +411,7 @@ static const signed short xpad_abs_triggers[] = { + .bInterfaceSubClass = 71, \ + .bInterfaceProtocol = (pr) + #define XPAD_XBOXONE_VENDOR(vend) \ +- { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) } ++ { XPAD_XBOXONE_VENDOR_PROTOCOL((vend), 208) } + + static const struct usb_device_id xpad_table[] = { + { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ +@@ -1578,6 +1580,7 @@ static void xpad_close(struct input_dev *dev) + static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + { + struct usb_xpad *xpad = input_get_drvdata(input_dev); ++ + set_bit(abs, input_dev->absbit); + + switch (abs) { +-- +2.17.1 + diff --git a/queue-4.14/series b/queue-4.14/series index f6408ec4fd8..e3297526069 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -74,3 +74,7 @@ xhci-allow-more-than-32-quirks.patch xhci-add-quirk-to-workaround-the-errata-seen-on-cavium-thunder-x2-soc.patch mtd-rawnand-atmel-fix-of-child-node-lookup.patch ubi-fastmap-check-each-mapping-only-once.patch +input-xpad-add-pdp-device-id-0x02a4.patch +input-xpad-fix-some-coding-style-issues.patch +input-xpad-avoid-using-__set_bit-for-capabilities.patch +input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch