Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2018 17:09:30 +0000 (09:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2018 17:09:30 +0000 (09:09 -0800)
Pull input fixes from Dmitry Torokhov:
 "Switching a few devices with Synaptics over to SMbus and disabling
  SMbus on a couple devices with Elan touchpads as they need more
  plumbing on PS/2 side"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: synaptics - enable SMBus for HP EliteBook 840 G4
  Input: elantech - disable elan-i2c for P52 and P72
  Input: synaptics - enable RMI on ThinkPad T560
  Input: omap-keypad - fix idle configuration to not block SoC idle states

drivers/input/keyboard/omap4-keypad.c
drivers/input/mouse/elantech.c
drivers/input/mouse/synaptics.c

index a7dc286f406c992ebd55d764808691101dfff690..840e53732753f556a6f89e7afde3b2c1bf65edcc 100644 (file)
@@ -126,12 +126,8 @@ static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id)
 {
        struct omap4_keypad *keypad_data = dev_id;
 
-       if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) {
-               /* Disable interrupts */
-               kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
-                                OMAP4_VAL_IRQDISABLE);
+       if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS))
                return IRQ_WAKE_THREAD;
-       }
 
        return IRQ_NONE;
 }
@@ -173,11 +169,6 @@ static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id)
        kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
                         kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
 
-       /* enable interrupts */
-       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
-               OMAP4_DEF_IRQENABLE_EVENTEN |
-                               OMAP4_DEF_IRQENABLE_LONGKEY);
-
        return IRQ_HANDLED;
 }
 
@@ -214,9 +205,10 @@ static void omap4_keypad_close(struct input_dev *input)
 
        disable_irq(keypad_data->irq);
 
-       /* Disable interrupts */
+       /* Disable interrupts and wake-up events */
        kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
                         OMAP4_VAL_IRQDISABLE);
+       kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE, 0);
 
        /* clear pending interrupts */
        kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
@@ -365,7 +357,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
        }
 
        error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler,
-                                    omap4_keypad_irq_thread_fn, 0,
+                                    omap4_keypad_irq_thread_fn, IRQF_ONESHOT,
                                     "omap4-keypad", keypad_data);
        if (error) {
                dev_err(&pdev->dev, "failed to register interrupt\n");
index 2d95e8d93cc761aefb102217473d940faf1e4d02..9fe075c137dc41bb513060d5b69871ed922e493f 100644 (file)
@@ -1767,6 +1767,18 @@ static int elantech_smbus = IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_SMBUS) ?
 module_param_named(elantech_smbus, elantech_smbus, int, 0644);
 MODULE_PARM_DESC(elantech_smbus, "Use a secondary bus for the Elantech device.");
 
+static const char * const i2c_blacklist_pnp_ids[] = {
+       /*
+        * These are known to not be working properly as bits are missing
+        * in elan_i2c.
+        */
+       "LEN2131", /* ThinkPad P52 w/ NFC */
+       "LEN2132", /* ThinkPad P52 */
+       "LEN2133", /* ThinkPad P72 w/ NFC */
+       "LEN2134", /* ThinkPad P72 */
+       NULL
+};
+
 static int elantech_create_smbus(struct psmouse *psmouse,
                                 struct elantech_device_info *info,
                                 bool leave_breadcrumbs)
@@ -1802,10 +1814,12 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
 
        if (elantech_smbus == ELANTECH_SMBUS_NOT_SET) {
                /*
-                * New ICs are enabled by default.
+                * New ICs are enabled by default, unless mentioned in
+                * i2c_blacklist_pnp_ids.
                 * Old ICs are up to the user to decide.
                 */
-               if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
+               if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) ||
+                   psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids))
                        return -ENXIO;
        }
 
index 2bd5bb11c8baec85bb9422dbfb0612e6bfed77f2..b6da0c1267e36e96cdc3b808e1fae122bec7add4 100644 (file)
@@ -171,6 +171,7 @@ static const char * const smbus_pnp_ids[] = {
        "LEN0046", /* X250 */
        "LEN004a", /* W541 */
        "LEN005b", /* P50 */
+       "LEN005e", /* T560 */
        "LEN0071", /* T480 */
        "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */
        "LEN0073", /* X1 Carbon G5 (Elantech) */
@@ -178,6 +179,7 @@ static const char * const smbus_pnp_ids[] = {
        "LEN0096", /* X280 */
        "LEN0097", /* X280 -> ALPS trackpoint */
        "LEN200f", /* T450s */
+       "SYN3052", /* HP EliteBook 840 G4 */
        "SYN3221", /* HP 15-ay000 */
        NULL
 };