Skip to content

Commit 8b5a359

Browse files
hadessdtor
authored andcommitted
Input: goodix - fix touch coordinates on WinBook TW100 and TW700
The touchscreen on the WinBook TW100 and TW700 don't match the default display, with 0,0 touches being reported when touching at the bottom right of the screen. 1280,800 0,800 +-------------+ | | | | | | +-------------+ 1280,0 0,0 It's unfortunately impossible to detect this problem with data from the DSDT, or other auxiliary metadata, so fallback to quirking this specific model of tablet instead. Signed-off-by: Bastien Nocera <hadess@hadess.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent b38ebd1 commit 8b5a359

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

drivers/input/touchscreen/goodix.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <linux/kernel.h>
18+
#include <linux/dmi.h>
1819
#include <linux/i2c.h>
1920
#include <linux/input.h>
2021
#include <linux/input/mt.h>
@@ -34,6 +35,7 @@ struct goodix_ts_data {
3435
int abs_y_max;
3536
unsigned int max_touch_num;
3637
unsigned int int_trigger_type;
38+
bool rotated_screen;
3739
};
3840

3941
#define GOODIX_MAX_HEIGHT 4096
@@ -60,6 +62,30 @@ static const unsigned long goodix_irq_flags[] = {
6062
IRQ_TYPE_LEVEL_HIGH,
6163
};
6264

65+
/*
66+
* Those tablets have their coordinates origin at the bottom right
67+
* of the tablet, as if rotated 180 degrees
68+
*/
69+
static const struct dmi_system_id rotated_screen[] = {
70+
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
71+
{
72+
.ident = "WinBook TW100",
73+
.matches = {
74+
DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
75+
DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
76+
}
77+
},
78+
{
79+
.ident = "WinBook TW700",
80+
.matches = {
81+
DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
82+
DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
83+
},
84+
},
85+
#endif
86+
{}
87+
};
88+
6389
/**
6490
* goodix_i2c_read - read data from a register of the i2c slave device.
6591
*
@@ -129,6 +155,11 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
129155
int input_y = get_unaligned_le16(&coor_data[3]);
130156
int input_w = get_unaligned_le16(&coor_data[5]);
131157

158+
if (ts->rotated_screen) {
159+
input_x = ts->abs_x_max - input_x;
160+
input_y = ts->abs_y_max - input_y;
161+
}
162+
132163
input_mt_slot(ts->input_dev, id);
133164
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
134165
input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x);
@@ -223,6 +254,11 @@ static void goodix_read_config(struct goodix_ts_data *ts)
223254
ts->abs_y_max = GOODIX_MAX_HEIGHT;
224255
ts->max_touch_num = GOODIX_MAX_CONTACTS;
225256
}
257+
258+
ts->rotated_screen = dmi_check_system(rotated_screen);
259+
if (ts->rotated_screen)
260+
dev_dbg(&ts->client->dev,
261+
"Applying '180 degrees rotated screen' quirk\n");
226262
}
227263

228264
/**

0 commit comments

Comments
 (0)