Skip to content

Commit 210f8ca

Browse files
JungHoon Hyundtor
authored andcommitted
Input: melfas_mip4 - report palm touches
The driver had the code to differentiate between finger and palm touches, but did not use this information when reporting contacts. Change it so that proper "tool" type is assigned to reported contacts. Signed-off-by: JungHoon Hyun <hyunjunghoon@melfas.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent cd7cd6f commit 210f8ca

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

drivers/input/touchscreen/melfas_mip4.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static void mip4_report_touch(struct mip4_ts *ts, u8 *packet)
466466
{
467467
int id;
468468
bool __always_unused hover;
469-
bool __always_unused palm;
469+
bool palm;
470470
bool state;
471471
u16 x, y;
472472
u8 __always_unused pressure_stage = 0;
@@ -522,21 +522,21 @@ static void mip4_report_touch(struct mip4_ts *ts, u8 *packet)
522522

523523
if (unlikely(id < 0 || id >= MIP4_MAX_FINGERS)) {
524524
dev_err(&ts->client->dev, "Screen - invalid slot ID: %d\n", id);
525-
} else if (state) {
526-
/* Press or Move event */
527-
input_mt_slot(ts->input, id);
528-
input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
525+
goto out;
526+
}
527+
528+
input_mt_slot(ts->input, id);
529+
if (input_mt_report_slot_state(ts->input,
530+
palm ? MT_TOOL_PALM : MT_TOOL_FINGER,
531+
state)) {
529532
input_report_abs(ts->input, ABS_MT_POSITION_X, x);
530533
input_report_abs(ts->input, ABS_MT_POSITION_Y, y);
531534
input_report_abs(ts->input, ABS_MT_PRESSURE, pressure);
532535
input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, touch_major);
533536
input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, touch_minor);
534-
} else {
535-
/* Release event */
536-
input_mt_slot(ts->input, id);
537-
input_mt_report_slot_inactive(ts->input);
538537
}
539538

539+
out:
540540
input_mt_sync_frame(ts->input);
541541
}
542542

@@ -1483,6 +1483,7 @@ static int mip4_probe(struct i2c_client *client)
14831483
input->keycodesize = sizeof(*ts->key_code);
14841484
input->keycodemax = ts->key_num;
14851485

1486+
input_set_abs_params(input, ABS_MT_TOOL_TYPE, 0, MT_TOOL_PALM, 0, 0);
14861487
input_set_abs_params(input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0);
14871488
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0);
14881489
input_set_abs_params(input, ABS_MT_PRESSURE,

0 commit comments

Comments
 (0)