diff mbox series

Input: iqs5xx - get axis info before calling input_mt_init_slots()

Message ID 1559529481-3817-1-git-send-email-jeff@labundy.com (mailing list archive)
State Superseded
Headers show
Series Input: iqs5xx - get axis info before calling input_mt_init_slots() | expand

Commit Message

Jeff LaBundy June 3, 2019, 2:38 a.m. UTC
Calling input_mt_init_slots() copies ABS_MT_POSITION_X to ABS_X and
so on, but doing so before calling touchscreen_parse_properties()
leaves ABS_X min = max = 0 which may prompt an X server to ignore
the device.

To solve this problem, wait to call input_mt_init_slots() until all
absolute axis information has been resolved (whether that's through
device tree via touchscreen_parse_properties() or from reading from
the device directly).

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
---
 drivers/input/touchscreen/iqs5xx.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c
index 1587078..dd7a925 100644
--- a/drivers/input/touchscreen/iqs5xx.c
+++ b/drivers/input/touchscreen/iqs5xx.c
@@ -502,14 +502,6 @@  static int iqs5xx_axis_init(struct i2c_client *client)
 		input_set_capability(input, EV_ABS, ABS_MT_POSITION_Y);
 		input_set_capability(input, EV_ABS, ABS_MT_PRESSURE);
 
-		error = input_mt_init_slots(input,
-				IQS5XX_NUM_CONTACTS, INPUT_MT_DIRECT);
-		if (error) {
-			dev_err(&client->dev,
-				"Failed to initialize slots: %d\n", error);
-			return error;
-		}
-
 		input_set_drvdata(input, iqs5xx);
 		iqs5xx->input = input;
 	}
@@ -580,6 +572,14 @@  static int iqs5xx_axis_init(struct i2c_client *client)
 		max_y = (u16)prop.max_y;
 	}
 
+	error = input_mt_init_slots(iqs5xx->input, IQS5XX_NUM_CONTACTS,
+				    INPUT_MT_DIRECT);
+	if (error) {
+		dev_err(&client->dev, "Failed to initialize slots: %d\n",
+			error);
+		return error;
+	}
+
 	/*
 	 * Write horizontal and vertical resolution to the device in case its
 	 * original defaults were overridden or swapped as per the properties