Skip to content

Commit 68334db

Browse files
osctobedtor
authored andcommitted
Input: elants - override touchscreen info with DT properties
Allow overriding of information from hardware and support additional common DT properties like axis inversion. This is required for eg. Nexus 7 and TF300T where the programmed values in firmware differ from reality. Signed-off-by: Dmitry Osipenko <[email protected]> [moved "prop" before DMA buffer] Signed-off-by: Michał Mirosław <[email protected]> Link: https://lore.kernel.org/r/49ea996878264f7c8bde25204e4ddf4b1e85ae71.1587923061.git.mirq-linux@rere.qmqm.pl Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 6def17b commit 68334db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/input/touchscreen/elants_i2c.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/slab.h>
3434
#include <linux/firmware.h>
3535
#include <linux/input/mt.h>
36+
#include <linux/input/touchscreen.h>
3637
#include <linux/acpi.h>
3738
#include <linux/of.h>
3839
#include <linux/gpio/consumer.h>
@@ -137,6 +138,7 @@ struct elants_data {
137138
unsigned int y_res;
138139
unsigned int x_max;
139140
unsigned int y_max;
141+
struct touchscreen_properties prop;
140142

141143
enum elants_state state;
142144
enum elants_iap_mode iap_mode;
@@ -876,8 +878,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
876878

877879
input_mt_slot(input, i);
878880
input_mt_report_slot_state(input, tool_type, true);
879-
input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
880-
input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
881+
touchscreen_report_pos(input, &ts->prop, x, y, true);
881882
input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
882883
input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, w);
883884

@@ -1328,6 +1329,8 @@ static int elants_i2c_probe(struct i2c_client *client,
13281329
input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
13291330
input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
13301331

1332+
touchscreen_parse_properties(ts->input, true, &ts->prop);
1333+
13311334
error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM,
13321335
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
13331336
if (error) {

0 commit comments

Comments
 (0)