From: Dmitry Torokhov Date: Wed, 22 Jul 2020 02:02:33 +0000 (-0700) Subject: Merge branch 'elan-i2c' into next X-Git-Tag: microblaze-v5.10~73^2^2~13 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=9b031c86506cef9acae45e61339fcf9deaabb793;p=linux-2.6-microblaze.git Merge branch 'elan-i2c' into next Bring in update to Elan touchpad driver to support newer touchpads with higher resolution. --- 9b031c86506cef9acae45e61339fcf9deaabb793 diff --cc MAINTAINERS index 2c79dc3422f1,50659d76976b..d7e3eab852d3 --- a/MAINTAINERS +++ b/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 +L: linux-input@vger.kernel.org +S: Maintained +F: drivers/input/touchscreen/cy8ctma140.c + CYTTSP TOUCHSCREEN DRIVER M: Ferruh Yigit L: linux-input@vger.kernel.org diff --cc drivers/input/mouse/elan_i2c_core.c index 3f9354baac4b,f10635a0b189..4b6e2dffc0ea --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@@ -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); } }