]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 1 May 2023 22:20:08 +0000 (15:20 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 1 May 2023 22:20:08 +0000 (15:20 -0700)
Prepare input updates for 6.4 merge window.

1  2 
drivers/input/joystick/xpad.c

index 29131f1a2f067166eef3638d60546304c941e786,50ecff681b894dfd427e6fe408085110503f00fb..28be88e0e96abed47f0c0453e741b934e53ba15b
@@@ -126,7 -126,6 +126,6 @@@ static const struct xpad_device 
        char *name;
        u8 mapping;
        u8 xtype;
-       u8 packet_type;
  } xpad_device[] = {
        { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
        { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
@@@ -475,6 -474,7 +474,7 @@@ static const struct usb_device_id xpad_
        XPAD_XBOX360_VENDOR(0x0f0d),            /* Hori Controllers */
        XPAD_XBOXONE_VENDOR(0x0f0d),            /* Hori Controllers */
        XPAD_XBOX360_VENDOR(0x1038),            /* SteelSeries Controllers */
+       XPAD_XBOXONE_VENDOR(0x10f5),            /* Turtle Beach Controllers */
        XPAD_XBOX360_VENDOR(0x11c9),            /* Nacon GC100XF */
        XPAD_XBOX360_VENDOR(0x1209),            /* Ardwiino Controllers */
        XPAD_XBOX360_VENDOR(0x12ab),            /* X-Box 360 dance pads */
        XPAD_XBOXONE_VENDOR(0x24c6),            /* PowerA Controllers */
        XPAD_XBOX360_VENDOR(0x2563),            /* OneXPlayer Gamepad */
        XPAD_XBOX360_VENDOR(0x260d),            /* Dareu H101 */
+       XPAD_XBOX360_VENDOR(0x2c22),            /* Qanba Controllers */
        XPAD_XBOX360_VENDOR(0x2dc8),            /* 8BitDo Pro 2 Wired Controller */
        XPAD_XBOXONE_VENDOR(0x2dc8),            /* 8BitDo Pro 2 Wired Controller for Xbox */
        XPAD_XBOXONE_VENDOR(0x2e24),            /* Hyperkin Duke X-Box One pad */
@@@ -559,6 -560,9 +560,9 @@@ struct xboxone_init_packet 
  #define GIP_MOTOR_LT BIT(3)
  #define GIP_MOTOR_ALL (GIP_MOTOR_R | GIP_MOTOR_L | GIP_MOTOR_RT | GIP_MOTOR_LT)
  
+ #define GIP_WIRED_INTF_DATA 0
+ #define GIP_WIRED_INTF_AUDIO 1
  /*
   * This packet is required for all Xbox One pads with 2015
   * or later firmware installed (or present from the factory).
@@@ -781,6 -785,9 +785,6 @@@ static void xpad_process_packet(struct 
        input_report_key(dev, BTN_C, data[8]);
        input_report_key(dev, BTN_Z, data[9]);
  
 -      /* Profile button has a value of 0-3, so it is reported as an axis */
 -      if (xpad->mapping & MAP_PROFILE_BUTTON)
 -              input_report_abs(dev, ABS_PROFILE, data[34]);
  
        input_sync(dev);
  }
@@@ -1058,10 -1065,6 +1062,10 @@@ static void xpadone_process_packet(stru
                                        (__u16) le16_to_cpup((__le16 *)(data + 8)));
                }
  
 +              /* Profile button has a value of 0-3, so it is reported as an axis */
 +              if (xpad->mapping & MAP_PROFILE_BUTTON)
 +                      input_report_abs(dev, ABS_PROFILE, data[34]);
 +
                /* paddle handling */
                /* based on SDL's SDL_hidapi_xboxone.c */
                if (xpad->mapping & MAP_PADDLES) {
@@@ -1392,6 -1395,21 +1396,21 @@@ static int xpad_start_xbox_one(struct u
        unsigned long flags;
        int retval;
  
+       if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) {
+               /*
+                * Explicitly disable the audio interface. This is needed
+                * for some controllers, such as the PowerA Enhanced Wired
+                * Controller for Series X|S (0x20d6:0x200e) to report the
+                * guide button.
+                */
+               retval = usb_set_interface(xpad->udev,
+                                          GIP_WIRED_INTF_AUDIO, 0);
+               if (retval)
+                       dev_warn(&xpad->dev->dev,
+                                "unable to disable audio interface: %d\n",
+                                retval);
+       }
        spin_lock_irqsave(&xpad->odata_lock, flags);
  
        /*
@@@ -2003,7 -2021,7 +2022,7 @@@ static int xpad_probe(struct usb_interf
        }
  
        if (xpad->xtype == XTYPE_XBOXONE &&
-           intf->cur_altsetting->desc.bInterfaceNumber != 0) {
+           intf->cur_altsetting->desc.bInterfaceNumber != GIP_WIRED_INTF_DATA) {
                /*
                 * The Xbox One controller lists three interfaces all with the
                 * same interface class, subclass and protocol. Differentiate by