Skip to content

Commit 0cb8741

Browse files
xNombreonettboots
authored andcommitted
input: goodix: Remove leftover pen feature
This driver doesn't support pen so remove expensive logic in interrupt handler. Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com> Signed-off-by: onettboots <blackcocopet@gmail.com>
1 parent 16f3f71 commit 0cb8741

2 files changed

Lines changed: 1 addition & 66 deletions

File tree

drivers/input/touchscreen/goodix_driver_gt9886/goodix_ts_core.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ extern struct goodix_ts_core *goodix_core_data;
872872
#define GOODIX_DRIVER_VERSION "v1.2.0.1"
873873
#define GOODIX_BUS_RETRY_TIMES 3
874874
#define GOODIX_MAX_TOUCH 10
875-
#define GOODIX_MAX_PEN 1
876875
#define GOODIX_MAX_KEY 3
877876
#define GOODIX_PEN_MAX_KEY 2
878877
#define GOODIX_CFG_MAX_SIZE 1024
@@ -970,7 +969,6 @@ struct goodix_ts_board_data {
970969
/*add by lishuai*/
971970
unsigned int x2x;
972971
unsigned int y2y;
973-
bool pen_enable;
974972
unsigned int tp_key_num;
975973
/*add end*/
976974

@@ -1066,9 +1064,6 @@ struct goodix_touch_data {
10661064
/* key */
10671065
u8 key_value;
10681066
bool have_key;
1069-
/*pen*/
1070-
struct goodix_ts_coords pen_coords[GOODIX_MAX_PEN];
1071-
bool pen_down;
10721067
};
10731068

10741069
/* request event data */

drivers/input/touchscreen/goodix_driver_gt9886/goodix_ts_i2c.c

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,6 @@ static int goodix_parse_dt(struct device_node *node,
263263
return r;
264264
}
265265

266-
/*get pen-enable switch and pen keys, must after "key map"*/
267-
board_data->pen_enable = of_property_read_bool(node, "goodix,pen-enable");
268-
if (board_data->pen_enable) {
269-
prop = of_find_property(node, "goodix,key-of-pen", NULL);
270-
if (prop && prop->length) {
271-
if (prop->length / sizeof(u32) > GOODIX_PEN_MAX_KEY) {
272-
ts_err("Size of key-of-pen is invalid");
273-
return r;
274-
}
275-
r = of_property_read_u32_array(node,
276-
"goodix,key-of-pen",
277-
&board_data->panel_key_map[board_data->panel_max_key],
278-
prop->length / sizeof(u32));
279-
if (r)
280-
return r;
281-
board_data->panel_max_key += (prop->length / sizeof(u32));
282-
}
283-
}
284266
ts_info("***key:%d, %d, %d, %d, %d",
285267
board_data->panel_key_map[0],
286268
board_data->panel_key_map[1],
@@ -1794,9 +1776,6 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
17941776
touch_data->have_key = (coord_sta >> 4) & 0x01;
17951777
if (unlikely(touch_data->have_key)) {
17961778
touch_data->key_value = buffer[touch_num * BYTES_PER_COORD + 2];
1797-
if (dev->board_data->pen_enable)
1798-
touch_data->key_value = (touch_data->key_value & 0x0f) |
1799-
((touch_data->key_value & 0xf0) >> (4 - dev->board_data->tp_key_num));
18001779
}
18011780
/*ts_info("$$$$$$coord_sta:0x%02x, have_key:%d, key_value:0x%02x",
18021781
coord_sta, touch_data->have_key, touch_data->key_value);*/
@@ -1820,12 +1799,11 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
18201799

18211800
/*clear buffer*/
18221801
memset(touch_data->coords, 0x00, sizeof(touch_data->coords));
1823-
memset(touch_data->pen_coords, 0x00, sizeof(touch_data->pen_coords));
18241802

18251803
if (likely(touch_num >= 1)) {
18261804
/*"0 ~ touch_num - 2" is finger, "touch_num - 1" may be a finger or a pen*/
18271805
/*process "0 ~ touch_num -2"*/
1828-
for (i = 0; i < touch_num - 1; i++) {
1806+
for (i = 0; i < touch_num; i++) {
18291807
coords->id = buffer[i * BYTES_PER_COORD + 2] & 0x0f;
18301808
coords->x = buffer[i * BYTES_PER_COORD + 3] |
18311809
(buffer[i * BYTES_PER_COORD + 4] << 8);
@@ -1838,48 +1816,10 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
18381816
coords->area = buffer[i * BYTES_PER_COORD + 9];
18391817
coords++;
18401818
}
1841-
1842-
/*process "touch_num - 1", it may be a finger or a pen*/
1843-
/*it's a pen*/
1844-
i = touch_num - 1;
1845-
//ts_err("%s:i=%d touch_num=%d\n",__func__,i,touch_num);
1846-
if (unlikely(touch_num >= 1 && buffer[i * BYTES_PER_COORD + 2] >= 0x80)) {
1847-
if (dev->board_data->pen_enable) {/*pen_enable*/
1848-
touch_data->pen_down = true;
1849-
/*change pen's trace ID, let it equal to "panel_max_id - 1"*/
1850-
/*touch_data->pen_coords[0].id = dev->board_data->panel_max_id - 1;*/
1851-
touch_data->pen_coords[0].id = dev->board_data->panel_max_id * 2;
1852-
touch_data->pen_coords[0].x = buffer[i * BYTES_PER_COORD + 3] |
1853-
(buffer[i * BYTES_PER_COORD + 4] << 8);
1854-
touch_data->pen_coords[0].y = buffer[i * BYTES_PER_COORD + 5] |
1855-
(buffer[i * BYTES_PER_COORD + 6] << 8);
1856-
touch_data->pen_coords[0].w = 6;
1857-
touch_data->pen_coords[0].p =
1858-
buffer[i * BYTES_PER_COORD + 7] |
1859-
(buffer[i * BYTES_PER_COORD + 8] << 8);
1860-
}
1861-
} else {/*it's a finger*/
1862-
coords->id = buffer[i * BYTES_PER_COORD + 2] & 0x0f;
1863-
coords->x = buffer[i * BYTES_PER_COORD + 3] |
1864-
(buffer[i * BYTES_PER_COORD + 4] << 8);
1865-
coords->y = buffer[i * BYTES_PER_COORD + 5] |
1866-
(buffer[i * BYTES_PER_COORD + 6] << 8);
1867-
coords->w = coords->p / 16;
1868-
coords->p = buffer[i * BYTES_PER_COORD + 7] |
1869-
(buffer[i * BYTES_PER_COORD + 8] << 8);
1870-
coords->overlapping_area = buffer[8];
1871-
coords->area = buffer[i * BYTES_PER_COORD + 9];
1872-
/*ts_debug("EF:[%d](%d, %d)", coords->id, coords->x, coords->y);*/
1873-
if (touch_data->pen_down == true) {
1874-
touch_data->pen_down = false;
1875-
/*ts_info("***pen leave");*/
1876-
}
1877-
}
18781819
}
18791820

18801821
/*swap coord*/
18811822
goodix_swap_coords(dev, &touch_data->coords[0], touch_num);
1882-
goodix_swap_coords(dev, &touch_data->pen_coords[0], 1);
18831823

18841824
touch_data->touch_num = touch_num;
18851825
/* mark this event as touch event */

0 commit comments

Comments
 (0)