From 875c69b2c37ba94f9e38d2c9211bd66f604ad7cc Mon Sep 17 00:00:00 2001 From: Jacob Stiffler Date: Mon, 6 Jul 2015 13:03:53 -0400 Subject: [PATCH] input: edt-ft5x06: Enable max axes values to be set in DT. * The edt-ft5x06 driver sets max axes values to quantities much larger than what is actually obtainable. * Use the device tree to get the actual max values. Signed-off-by: Jacob Stiffler --- drivers/input/touchscreen/edt-ft5x06.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index de9ae86..996a00a 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -963,6 +963,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, struct input_dev *input; int error; char fw_version[EDT_NAME_LEN]; + unsigned int max_x, max_y; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1038,12 +1039,25 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, __set_bit(EV_KEY, input->evbit); __set_bit(EV_ABS, input->evbit); __set_bit(BTN_TOUCH, input->keybit); - input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0); - input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_X, - 0, tsdata->num_x * 64 - 1, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, - 0, tsdata->num_y * 64 - 1, 0, 0); + + if ( of_property_read_u32(client->dev.of_node, "touchscreen-size-x", &max_x) == 0 ) { + input_set_abs_params(input, ABS_X, 0, max_x - 1, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_X, + 0, max_x - 1, 0, 0); + } else { + input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_X, + 0, tsdata->num_x * 64 - 1, 0, 0); + } + if ( of_property_read_u32(client->dev.of_node, "touchscreen-size-y", &max_y) == 0 ) { + input_set_abs_params(input, ABS_Y, 0, max_y - 1, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_Y, + 0, max_y - 1, 0, 0); + } else { + input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_Y, + 0, tsdata->num_y * 64 - 1, 0, 0); + } error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0); if (error) { dev_err(&client->dev, "Unable to init MT slots.\n"); -- 1.9.1