Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 4 May 2021 18:46:00 +0000 (11:46 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 4 May 2021 18:46:00 +0000 (11:46 -0700)
Prepare input updates for 5.13 merge window.

1  2 
drivers/input/touchscreen/elants_i2c.c

@@@ -38,6 -38,7 +38,7 @@@
  #include <linux/of.h>
  #include <linux/gpio/consumer.h>
  #include <linux/regulator/consumer.h>
+ #include <linux/uuid.h>
  #include <asm/unaligned.h>
  
  /* Device, Driver information */
@@@ -1334,6 -1335,40 +1335,40 @@@ static void elants_i2c_power_off(void *
        }
  }
  
+ #ifdef CONFIG_ACPI
+ static const struct acpi_device_id i2c_hid_ids[] = {
+       {"ACPI0C50", 0 },
+       {"PNP0C50", 0 },
+       { },
+ };
+ static const guid_t i2c_hid_guid =
+       GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
+                 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
+ static bool elants_acpi_is_hid_device(struct device *dev)
+ {
+       acpi_handle handle = ACPI_HANDLE(dev);
+       union acpi_object *obj;
+       if (acpi_match_device_ids(ACPI_COMPANION(dev), i2c_hid_ids))
+               return false;
+       obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL, ACPI_TYPE_INTEGER);
+       if (obj) {
+               ACPI_FREE(obj);
+               return true;
+       }
+       return false;
+ }
+ #else
+ static bool elants_acpi_is_hid_device(struct device *dev)
+ {
+       return false;
+ }
+ #endif
  static int elants_i2c_probe(struct i2c_client *client,
                            const struct i2c_device_id *id)
  {
        unsigned long irqflags;
        int error;
  
+       /* Don't bind to i2c-hid compatible devices, these are handled by the i2c-hid drv. */
+       if (elants_acpi_is_hid_device(&client->dev)) {
+               dev_warn(&client->dev, "This device appears to be an I2C-HID device, not binding\n");
+               return -ENODEV;
+       }
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-               dev_err(&client->dev,
-                       "%s: i2c check functionality error\n", DEVICE_NAME);
+               dev_err(&client->dev, "I2C check functionality error\n");
                return -ENXIO;
        }
  
  
        touchscreen_parse_properties(ts->input, true, &ts->prop);
  
 -      if (ts->chip_id == EKTF3624) {
 +      if (ts->chip_id == EKTF3624 && ts->phy_x && ts->phy_y) {
                /* calculate resolution from size */
                ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, ts->phy_x);
                ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, ts->phy_y);
  
        input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
        input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
 -      if (ts->major_res > 0)
 -              input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->major_res);
 +      input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->major_res);
  
        error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM,
                                    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);