Merge tag 'input-for-v6.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Dec 2023 19:16:58 +0000 (11:16 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Dec 2023 19:16:58 +0000 (11:16 -0800)
Pull input updates from Dmitry Torokhov:

 - a quirk to AT keyboard driver to skip issuing "GET ID" command when
   8042 is in translated mode and the device is a laptop/portable,
   because the "GET ID" command makes a bunch of recent laptops unhappy

 - a quirk to i8042 to disable multiplexed mode on Acer P459-G2-M which
   causes issues on resume

 - psmouse will activate native RMI4 protocol support for touchpad on
   ThinkPad L14 G1

 - addition of Razer Wolverine V2 ID to xpad gamepad driver

 - mapping for airplane mode button in soc_button_array driver for
   TUXEDO laptops

 - improved error handling in ipaq-micro-keys driver

 - amimouse being prepared for platform remove callback returning void

* tag 'input-for-v6.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: soc_button_array - add mapping for airplane mode button
  Input: xpad - add Razer Wolverine V2 support
  Input: ipaq-micro-keys - add error handling for devm_kmemdup
  Input: amimouse - convert to platform remove callback returning void
  Input: i8042 - add nomux quirk for Acer P459-G2-M
  Input: atkbd - skip ATKBD_CMD_GETID in translated mode
  Input: psmouse - enable Synaptics InterTouch for ThinkPad L14 G1

drivers/input/joystick/xpad.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/ipaq-micro-keys.c
drivers/input/misc/soc_button_array.c
drivers/input/mouse/amimouse.c
drivers/input/mouse/synaptics.c
drivers/input/serio/i8042-acpipnpio.h

index f5c2156..e2c1848 100644 (file)
@@ -286,6 +286,7 @@ static const struct xpad_device {
        { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
        { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE },
+       { 0x1532, 0x0a29, "Razer Wolverine V2", 0, XTYPE_XBOXONE },
        { 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 },
        { 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 },
        { 0x15e4, 0x3f10, "Batarang Xbox 360 controller", 0, XTYPE_XBOX360 },
index c92e544..786f00f 100644 (file)
@@ -765,6 +765,44 @@ static void atkbd_deactivate(struct atkbd *atkbd)
                        ps2dev->serio->phys);
 }
 
+#ifdef CONFIG_X86
+static bool atkbd_is_portable_device(void)
+{
+       static const char * const chassis_types[] = {
+               "8",    /* Portable */
+               "9",    /* Laptop */
+               "10",   /* Notebook */
+               "14",   /* Sub-Notebook */
+               "31",   /* Convertible */
+               "32",   /* Detachable */
+       };
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(chassis_types); i++)
+               if (dmi_match(DMI_CHASSIS_TYPE, chassis_types[i]))
+                       return true;
+
+       return false;
+}
+
+/*
+ * On many modern laptops ATKBD_CMD_GETID may cause problems, on these laptops
+ * the controller is always in translated mode. In this mode mice/touchpads will
+ * not work. So in this case simply assume a keyboard is connected to avoid
+ * confusing some laptop keyboards.
+ *
+ * Skipping ATKBD_CMD_GETID ends up using a fake keyboard id. Using a fake id is
+ * ok in translated mode, only atkbd_select_set() checks atkbd->id and in
+ * translated mode that is a no-op.
+ */
+static bool atkbd_skip_getid(struct atkbd *atkbd)
+{
+       return atkbd->translated && atkbd_is_portable_device();
+}
+#else
+static inline bool atkbd_skip_getid(struct atkbd *atkbd) { return false; }
+#endif
+
 /*
  * atkbd_probe() probes for an AT keyboard on a serio port.
  */
@@ -794,12 +832,12 @@ static int atkbd_probe(struct atkbd *atkbd)
  */
 
        param[0] = param[1] = 0xa5;     /* initialize with invalid values */
-       if (ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
+       if (atkbd_skip_getid(atkbd) || ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
 
 /*
- * If the get ID command failed, we check if we can at least set the LEDs on
- * the keyboard. This should work on every keyboard out there. It also turns
- * the LEDs off, which we want anyway.
+ * If the get ID command was skipped or failed, we check if we can at least set
+ * the LEDs on the keyboard. This should work on every keyboard out there.
+ * It also turns the LEDs off, which we want anyway.
  */
                param[0] = 0;
                if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
index 7b509bc..1d71dd7 100644 (file)
@@ -105,6 +105,9 @@ static int micro_key_probe(struct platform_device *pdev)
        keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes,
                           keys->input->keycodesize * keys->input->keycodemax,
                           GFP_KERNEL);
+       if (!keys->codes)
+               return -ENOMEM;
+
        keys->input->keycode = keys->codes;
 
        __set_bit(EV_KEY, keys->input->evbit);
index 08bcee3..f6d0603 100644 (file)
@@ -299,6 +299,11 @@ static int soc_button_parse_btn_desc(struct device *dev,
                info->name = "power";
                info->event_code = KEY_POWER;
                info->wakeup = true;
+       } else if (upage == 0x01 && usage == 0xc6) {
+               info->name = "airplane mode switch";
+               info->event_type = EV_SW;
+               info->event_code = SW_RFKILL_ALL;
+               info->active_low = false;
        } else if (upage == 0x01 && usage == 0xca) {
                info->name = "rotation lock switch";
                info->event_type = EV_SW;
index a50e503..cda0c3f 100644 (file)
@@ -125,16 +125,15 @@ static int __init amimouse_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int __exit amimouse_remove(struct platform_device *pdev)
+static void __exit amimouse_remove(struct platform_device *pdev)
 {
        struct input_dev *dev = platform_get_drvdata(pdev);
 
        input_unregister_device(dev);
-       return 0;
 }
 
 static struct platform_driver amimouse_driver = {
-       .remove = __exit_p(amimouse_remove),
+       .remove_new = __exit_p(amimouse_remove),
        .driver   = {
                .name   = "amiga-mouse",
        },
index 22d16d8..7a303a9 100644 (file)
@@ -183,6 +183,7 @@ static const char * const smbus_pnp_ids[] = {
        "LEN009b", /* T580 */
        "LEN0402", /* X1 Extreme Gen 2 / P1 Gen 2 */
        "LEN040f", /* P1 Gen 3 */
+       "LEN0411", /* L14 Gen 1 */
        "LEN200f", /* T450s */
        "LEN2044", /* L470  */
        "LEN2054", /* E480 */
index 9c39553..b585b1d 100644 (file)
@@ -360,6 +360,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
                },
                .driver_data = (void *)(SERIO_QUIRK_DRITEK)
        },
+       {
+               /* Acer TravelMate P459-G2-M */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate P459-G2-M"),
+               },
+               .driver_data = (void *)(SERIO_QUIRK_NOMUX)
+       },
        {
                /* Amoi M636/A737 */
                .matches = {