2020-04-26 17:51:03

by Michał Mirosław

[permalink] [raw]
Subject: [PATCH v5 04/10] 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]>
---
v5: rebase against dtor/input/for-linus
---
drivers/input/touchscreen/elants_i2c.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 61a9098f35d2..d2be61ae6722 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -33,6 +33,7 @@
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/gpio/consumer.h>
@@ -152,6 +153,7 @@ struct elants_data {
unsigned int y_res;
unsigned int x_max;
unsigned int y_max;
+ struct touchscreen_properties prop;

enum elants_state state;
enum elants_iap_mode iap_mode;
@@ -901,8 +903,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf,

input_mt_slot(input, i);
input_mt_report_slot_state(input, tool_type, true);
- input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
- input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
+ touchscreen_report_pos(input, &ts->prop, x, y, true);
input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, w);

@@ -1331,6 +1332,8 @@ static int elants_i2c_probe(struct i2c_client *client,
input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);

+ touchscreen_parse_properties(ts->input, true, &ts->prop);
+
error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
if (error) {
--
2.20.1


2020-05-18 04:05:10

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v5 04/10] input: elants: override touchscreen info with DT properties

On Sun, Apr 26, 2020 at 07:47:51PM +0200, Michał Mirosław wrote:
> 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]>

Applied, thank you.

--
Dmitry