Message ID | 1559875085-21880-1-git-send-email-jeff@labundy.com (mailing list archive) |
---|---|
State | Accepted |
Commit | a876697b0ad1cba4d56c72395b330691aafa1593 |
Headers | show |
Series | [v2] Input: iqs5xx - get axis info before calling input_mt_init_slots() | expand |
On Thu, Jun 06, 2019 at 09:38:05PM -0500, Jeff LaBundy wrote: > 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> Applied, thank you. > --- > Changes in v2: > - Moved the call to input_mt_init_slots to the very end of iqs5xx_axis_init > to keep operations on max_x and max_y close to each other for readability > > drivers/input/touchscreen/iqs5xx.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c > index 1587078..5875bb1 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; > } > @@ -591,9 +583,19 @@ static int iqs5xx_axis_init(struct i2c_client *client) > if (error) > return error; > > - return iqs5xx_write_word(client, > - prop.swap_x_y ? IQS5XX_X_RES : IQS5XX_Y_RES, > - max_y); > + error = iqs5xx_write_word(client, > + prop.swap_x_y ? IQS5XX_X_RES : IQS5XX_Y_RES, > + max_y); > + if (error) > + return error; > + > + 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; > } > > static int iqs5xx_dev_init(struct i2c_client *client) > -- > 2.7.4 >
diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c index 1587078..5875bb1 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; } @@ -591,9 +583,19 @@ static int iqs5xx_axis_init(struct i2c_client *client) if (error) return error; - return iqs5xx_write_word(client, - prop.swap_x_y ? IQS5XX_X_RES : IQS5XX_Y_RES, - max_y); + error = iqs5xx_write_word(client, + prop.swap_x_y ? IQS5XX_X_RES : IQS5XX_Y_RES, + max_y); + if (error) + return error; + + 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; } static int iqs5xx_dev_init(struct i2c_client *client)
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> --- Changes in v2: - Moved the call to input_mt_init_slots to the very end of iqs5xx_axis_init to keep operations on max_x and max_y close to each other for readability drivers/input/touchscreen/iqs5xx.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.7.4