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

Commit 4c142d16 authored by Figo Wang's avatar Figo Wang Committed by Sudhakar Manapati
Browse files

input: touchpanel: fix the number of touch events detection



Focaltech controllers can reports the number of touch points by read
"TD_STATUS" register. Read this register to avoid always looping
through maximum number of touches supported.

  This patch is propagated from 3.4 kernel
    commit: d21893abf5951ea16dd3680563d3e493d48403c8
    input: touchpanel: fix the number of touch events detection

Change-Id: I8ab111b56b2074cb52cb021d37e9e6505c8b7c72
Signed-off-by: default avatarFigo Wang <figow@codeaurora.org>
Signed-off-by: default avatarBingzhe Cai <bingzhec@codeaurora.org>
parent 550c106e
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -82,6 +82,7 @@
#define FT_ERASE_PANEL_REG	0x63
#define FT_ERASE_PANEL_REG	0x63
#define FT_FW_START_REG		0xBF
#define FT_FW_START_REG		0xBF


#define FT_STATUS_NUM_TP_MASK	0x0F


#define FT_VTG_MIN_UV		2600000
#define FT_VTG_MIN_UV		2600000
#define FT_VTG_MAX_UV		3300000
#define FT_VTG_MAX_UV		3300000
@@ -329,6 +330,7 @@ static void ft5x06_report_value(struct ft5x06_ts_data *data)
static int ft5x06_handle_touchdata(struct ft5x06_ts_data *data)
static int ft5x06_handle_touchdata(struct ft5x06_ts_data *data)
{
{
	struct ts_event *event = &data->event;
	struct ts_event *event = &data->event;
	int num_points;
	int ret, i;
	int ret, i;
	u8 buf[POINT_READ_BUF] = { 0 };
	u8 buf[POINT_READ_BUF] = { 0 };
	u8 pointid = FT_MAX_ID;
	u8 pointid = FT_MAX_ID;
@@ -342,7 +344,9 @@ static int ft5x06_handle_touchdata(struct ft5x06_ts_data *data)
	memset(event, 0, sizeof(struct ts_event));
	memset(event, 0, sizeof(struct ts_event));


	event->touch_point = 0;
	event->touch_point = 0;
	for (i = 0; i < CFG_MAX_TOUCH_POINTS; i++) {
	num_points = buf[2] & FT_STATUS_NUM_TP_MASK;

	for (i = 0; i < num_points; i++) {
		pointid = (buf[FT_TOUCH_ID_POS + FT_TOUCH_STEP * i]) >> 4;
		pointid = (buf[FT_TOUCH_ID_POS + FT_TOUCH_STEP * i]) >> 4;
		if (pointid >= FT_MAX_ID)
		if (pointid >= FT_MAX_ID)
			break;
			break;