Merge branch 'elan-i2c' into next
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 22 Jul 2020 02:02:33 +0000 (19:02 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 22 Jul 2020 02:02:33 +0000 (19:02 -0700)
Bring in update to Elan touchpad driver to support newer touchpads with
higher resolution.

1  2 
MAINTAINERS
drivers/hid/hid-alps.c
drivers/hid/hid-multitouch.c
drivers/input/keyboard/Kconfig
drivers/input/mouse/elan_i2c_core.c

diff --cc MAINTAINERS
@@@ -4625,15 -4651,8 +4651,14 @@@ W:    https://linuxtv.or
  W:    http://palosaari.fi/linux/
  Q:    http://patchwork.linuxtv.org/project/linux-media/list/
  T:    git git://linuxtv.org/anttip/media_tree.git
- S:    Maintained
  F:    drivers/media/common/cypress_firmware*
  
 +CYPRESS CY8CTMA140 TOUCHSCREEN DRIVER
 +M:    Linus Walleij <linus.walleij@linaro.org>
 +L:    linux-input@vger.kernel.org
 +S:    Maintained
 +F:    drivers/input/touchscreen/cy8ctma140.c
 +
  CYTTSP TOUCHSCREEN DRIVER
  M:    Ferruh Yigit <fery@cypress.com>
  L:    linux-input@vger.kernel.org
Simple merge
Simple merge
Simple merge
@@@ -933,12 -958,32 +958,32 @@@ static void elan_report_contact(struct 
                input_report_abs(input, ABS_MT_POSITION_X, pos_x);
                input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
                input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure);
-               input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
-               input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
-               input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
+               if (data->report_features & ETP_FEATURE_REPORT_MK) {
+                       unsigned int mk_x, mk_y, area_x, area_y;
+                       u8 mk_data = high_precision ?
+                               packet[ETP_MK_DATA_OFFSET + contact_num] :
+                               finger_data[3];
+                       mk_x = mk_data & 0x0f;
+                       mk_y = mk_data >> 4;
+                       /*
+                        * To avoid treating large finger as palm, let's reduce
+                        * the width x and y per trace.
+                        */
+                       area_x = mk_x * (data->width_x - ETP_FWIDTH_REDUCE);
+                       area_y = mk_y * (data->width_y - ETP_FWIDTH_REDUCE);
+                       input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
+                       input_report_abs(input, ABS_MT_TOUCH_MAJOR,
+                                        max(area_x, area_y));
+                       input_report_abs(input, ABS_MT_TOUCH_MINOR,
+                                        min(area_x, area_y));
+               }
        } else {
                input_mt_slot(input, contact_num);
 -              input_mt_report_slot_state(input, MT_TOOL_FINGER, false);
 +              input_mt_report_slot_inactive(input);
        }
  }