lkml.org 
[lkml]   [2019]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 4/6] input: elants: detect max_x/y from hardware
Read max_x/y from hardware when not specified in devicetree.

elants_i2c_initialize() call is moved after inputdev allocation (but
still before making it visible) to allow the function to see DT-provided
values.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/input/touchscreen/elants_i2c.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 02bd5e3e2171..2e6c9aa60496 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -498,9 +498,11 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
rows, cols, osr);
} else {
/* translate trace number to TS resolution */
- ts->prop.max_x = ELAN_TS_RESOLUTION(rows, osr);
+ if (!ts->prop.max_x)
+ ts->prop.max_x = ELAN_TS_RESOLUTION(rows, osr);
ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, phy_x);
- ts->prop.max_y = ELAN_TS_RESOLUTION(cols, osr);
+ if (!ts->prop.max_y)
+ ts->prop.max_y = ELAN_TS_RESOLUTION(cols, osr);
ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, phy_y);
}

@@ -1235,12 +1237,6 @@ static int elants_i2c_probe(struct i2c_client *client,
return -ENXIO;
}

- error = elants_i2c_initialize(ts);
- if (error) {
- dev_err(&client->dev, "failed to initialize: %d\n", error);
- return error;
- }
-
ts->input = devm_input_allocate_device(&client->dev);
if (!ts->input) {
dev_err(&client->dev, "Failed to allocate input device\n");
@@ -1252,6 +1248,12 @@ static int elants_i2c_probe(struct i2c_client *client,

touchscreen_parse_properties(ts->input, true, &ts->prop);

+ error = elants_i2c_initialize(ts);
+ if (error) {
+ dev_err(&client->dev, "failed to initialize: %d\n", error);
+ return error;
+ }
+
__set_bit(BTN_TOUCH, ts->input->keybit);
__set_bit(EV_ABS, ts->input->evbit);
__set_bit(EV_KEY, ts->input->evbit);
--
2.20.1
\
 
 \ /
  Last update: 2019-12-10 01:19    [W:0.111 / U:33.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site