diff options
| -rw-r--r-- | drivers/input/touchscreen/goodix.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index b4d12e29abff..e36162b28c2a 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 18 | #include <linux/dmi.h> | ||
| 18 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
| 19 | #include <linux/input.h> | 20 | #include <linux/input.h> |
| 20 | #include <linux/input/mt.h> | 21 | #include <linux/input/mt.h> |
| @@ -34,6 +35,7 @@ struct goodix_ts_data { | |||
| 34 | int abs_y_max; | 35 | int abs_y_max; |
| 35 | unsigned int max_touch_num; | 36 | unsigned int max_touch_num; |
| 36 | unsigned int int_trigger_type; | 37 | unsigned int int_trigger_type; |
| 38 | bool rotated_screen; | ||
| 37 | }; | 39 | }; |
| 38 | 40 | ||
| 39 | #define GOODIX_MAX_HEIGHT 4096 | 41 | #define GOODIX_MAX_HEIGHT 4096 |
| @@ -60,6 +62,30 @@ static const unsigned long goodix_irq_flags[] = { | |||
| 60 | IRQ_TYPE_LEVEL_HIGH, | 62 | IRQ_TYPE_LEVEL_HIGH, |
| 61 | }; | 63 | }; |
| 62 | 64 | ||
| 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 | |||
| 63 | /** | 89 | /** |
| 64 | * goodix_i2c_read - read data from a register of the i2c slave device. | 90 | * goodix_i2c_read - read data from a register of the i2c slave device. |
| 65 | * | 91 | * |
| @@ -129,6 +155,11 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) | |||
| 129 | int input_y = get_unaligned_le16(&coor_data[3]); | 155 | int input_y = get_unaligned_le16(&coor_data[3]); |
| 130 | int input_w = get_unaligned_le16(&coor_data[5]); | 156 | int input_w = get_unaligned_le16(&coor_data[5]); |
| 131 | 157 | ||
| 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 | |||
| 132 | input_mt_slot(ts->input_dev, id); | 163 | input_mt_slot(ts->input_dev, id); |
| 133 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); | 164 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); |
| 134 | input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); | 165 | 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) | |||
| 223 | ts->abs_y_max = GOODIX_MAX_HEIGHT; | 254 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
| 224 | ts->max_touch_num = GOODIX_MAX_CONTACTS; | 255 | ts->max_touch_num = GOODIX_MAX_CONTACTS; |
| 225 | } | 256 | } |
| 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"); | ||
| 226 | } | 262 | } |
| 227 | 263 | ||
| 228 | /** | 264 | /** |
