Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90d5e14e authored by Bingzhe Cai's avatar Bingzhe Cai Committed by Gerrit - the friendly Code Review server
Browse files

input: touchscreen: modify report event according to MT protocol B



Multi-touch(MT) protocol B use input_mt_report_slot_state()
instead of send ABS_MT_TRACKING_ID event directly, so modify
the driver to follow the protocol and remove redundant protocol
A code.

Change-Id: I542e61fabaaa04fcf5fb7e454e10599511f18e39
Signed-off-by: default avatarBingzhe Cai <bingzhec@codeaurora.org>
Signed-off-by: default avatarSudhakar Manapati <smanap@codeaurora.org>
parent c39dd15c
Loading
Loading
Loading
Loading
+6 −63
Original line number Diff line number Diff line
@@ -45,11 +45,9 @@

#include <linux/of_gpio.h>

#if GTP_ICS_SLOT_REPORT
#include <linux/input/mt.h>
#endif

#define GOODIX_DEV_NAME	"Goodix Capacitive TouchScreen"
#define GOODIX_DEV_NAME	"Goodix-CTP"
#define CFG_MAX_TOUCH_POINTS	5
#define GOODIX_COORDS_ARR_SIZE	4
#define MAX_BUTTONS		4
@@ -360,21 +358,12 @@ static void gtp_touch_down(struct goodix_ts_data *ts, int id, int x, int y,
	GTP_SWAP(x, y);
#endif

#if GTP_ICS_SLOT_REPORT
	input_mt_slot(ts->input_dev, id);
	input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
	input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
	input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
	input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
#else
	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
	input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
	input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
	input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
	input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
	input_mt_sync(ts->input_dev);
#endif

	GTP_DEBUG("ID:%d, X:%d, Y:%d, W:%d", id, x, y, w);
}
@@ -389,15 +378,9 @@ Output:
*********************************************************/
static void gtp_touch_up(struct goodix_ts_data *ts, int id)
{
#if GTP_ICS_SLOT_REPORT
	input_mt_slot(ts->input_dev, id);
	input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, -1);
	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);
	GTP_DEBUG("Touch id[%2d] release!", id);
#else
	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0);
	input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0);
	input_mt_sync(ts->input_dev);
#endif
}


@@ -549,7 +532,6 @@ static void goodix_ts_work_func(struct work_struct *work)

	GTP_DEBUG("pre_touch:%02x, finger:%02x.", pre_touch, finger);

#if GTP_ICS_SLOT_REPORT
#if GTP_WITH_PEN
	if (pre_pen && (touch_num == 0)) {
		GTP_DEBUG("Pen touch UP(Slot)!");
@@ -626,42 +608,6 @@ static void goodix_ts_work_func(struct work_struct *work)
			}
		}
	}
#else
	input_report_key(ts->input_dev, BTN_TOUCH, (touch_num || key_value));
	if (touch_num) {
		for (i = 0; i < touch_num; i++) {
			coor_data = &point_data[i * 8 + 3];

			id = coor_data[0];
			input_x = coor_data[1] | coor_data[2] << 8;
			input_y = coor_data[3] | coor_data[4] << 8;
			input_w = coor_data[5] | coor_data[6] << 8;
#if GTP_WITH_PEN
			if (id == 128) {
				GTP_DEBUG("Pen touch DOWN!");
				input_report_key(ts->input_dev,
						BTN_TOOL_PEN, 1);
				pre_pen = 1;
				id = 0;
			}
#endif
			gtp_touch_down(ts, id, input_x, input_y, input_w);
		}
	} else if (pre_touch) {
#if GTP_WITH_PEN
		if (pre_pen == 1) {
			GTP_DEBUG("Pen touch UP!");
			input_report_key(ts->input_dev, BTN_TOOL_PEN, 0);
			pre_pen = 0;
		}
#endif
		GTP_DEBUG("Touch Released!");
		gtp_touch_up(ts, 0);
	}

	pre_touch = touch_num;
#endif

	input_sync(ts->input_dev);

exit_work_func:
@@ -1298,12 +1244,10 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts)

	ts->input_dev->evbit[0] =
		BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
#if GTP_ICS_SLOT_REPORT
	set_bit(BTN_TOOL_FINGER, ts->input_dev->keybit);
	__set_bit(INPUT_PROP_DIRECT, ts->input_dev->propbit);
	input_mt_init_slots(ts->input_dev, 10);/* in case of "out of memory" */
#else
	ts->input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
#endif
	/* in case of "out of memory" */
	input_mt_init_slots(ts->input_dev, 10, 0);

#if GTP_HAVE_TOUCH_KEY
	for (index = 0; index < ARRAY_SIZE(touch_key_array); index++) {
@@ -1955,7 +1899,6 @@ static void goodix_ts_suspend(struct goodix_ts_data *ts)
	for (i = 0; i < GTP_MAX_TOUCH; i++)
		gtp_touch_up(ts, i);

	input_report_key(ts->input_dev, BTN_TOUCH, 0);
	input_sync(ts->input_dev);

	ret = gtp_enter_sleep(ts);
+0 −1
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ extern u16 total_len;
#define GTP_DRIVER_SEND_CFG		1
#define GTP_HAVE_TOUCH_KEY		1
#define GTP_POWER_CTRL_SLEEP	0
#define GTP_ICS_SLOT_REPORT	1

/* auto updated by .bin file as default */
#define GTP_AUTO_UPDATE			0