Commit 875c69b2c37ba94f9e38d2c9211bd66f604ad7cc
1 parent
92e014a929
Exists in
smarc-ti-linux-3.14.y
and in
1 other branch
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 <j-stiffler@ti.com>
Showing 1 changed file with 20 additions and 6 deletions Side-by-side Diff
drivers/input/touchscreen/edt-ft5x06.c
... | ... | @@ -963,6 +963,7 @@ |
963 | 963 | struct input_dev *input; |
964 | 964 | int error; |
965 | 965 | char fw_version[EDT_NAME_LEN]; |
966 | + unsigned int max_x, max_y; | |
966 | 967 | |
967 | 968 | dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); |
968 | 969 | |
... | ... | @@ -1038,12 +1039,25 @@ |
1038 | 1039 | __set_bit(EV_KEY, input->evbit); |
1039 | 1040 | __set_bit(EV_ABS, input->evbit); |
1040 | 1041 | __set_bit(BTN_TOUCH, input->keybit); |
1041 | - input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0); | |
1042 | - input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0); | |
1043 | - input_set_abs_params(input, ABS_MT_POSITION_X, | |
1044 | - 0, tsdata->num_x * 64 - 1, 0, 0); | |
1045 | - input_set_abs_params(input, ABS_MT_POSITION_Y, | |
1046 | - 0, tsdata->num_y * 64 - 1, 0, 0); | |
1042 | + | |
1043 | + if ( of_property_read_u32(client->dev.of_node, "touchscreen-size-x", &max_x) == 0 ) { | |
1044 | + input_set_abs_params(input, ABS_X, 0, max_x - 1, 0, 0); | |
1045 | + input_set_abs_params(input, ABS_MT_POSITION_X, | |
1046 | + 0, max_x - 1, 0, 0); | |
1047 | + } else { | |
1048 | + input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0); | |
1049 | + input_set_abs_params(input, ABS_MT_POSITION_X, | |
1050 | + 0, tsdata->num_x * 64 - 1, 0, 0); | |
1051 | + } | |
1052 | + if ( of_property_read_u32(client->dev.of_node, "touchscreen-size-y", &max_y) == 0 ) { | |
1053 | + input_set_abs_params(input, ABS_Y, 0, max_y - 1, 0, 0); | |
1054 | + input_set_abs_params(input, ABS_MT_POSITION_Y, | |
1055 | + 0, max_y - 1, 0, 0); | |
1056 | + } else { | |
1057 | + input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0); | |
1058 | + input_set_abs_params(input, ABS_MT_POSITION_Y, | |
1059 | + 0, tsdata->num_y * 64 - 1, 0, 0); | |
1060 | + } | |
1047 | 1061 | error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0); |
1048 | 1062 | if (error) { |
1049 | 1063 | dev_err(&client->dev, "Unable to init MT slots.\n"); |