diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2012-06-28 09:08:22 -0400 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2012-06-29 09:58:06 -0400 |
commit | cb15911509164f052f103e85a935f513f82e6b54 (patch) | |
tree | 4b5b7770115e65d213b6dd5a599c66260a5f2410 /drivers/input | |
parent | 04a79181c40d3ad99885e7f799c799c153e93431 (diff) |
Input: atmel_mxt_ts - use T9 reportid range to init number of mt slots
Atmel mxt devices can report one finger for each T9 reportid.
Therefore, this range can be used to report the max number of MT-B slots
to userspace instead of assuming a fixed 10.
Note that mxt_initialized() must complete early, since the input_dev
properties now depend on values in the object table.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a9e0b541c638..2746b0dc7f36 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -212,8 +212,6 @@ | |||
212 | /* Touchscreen absolute values */ | 212 | /* Touchscreen absolute values */ |
213 | #define MXT_MAX_AREA 0xff | 213 | #define MXT_MAX_AREA 0xff |
214 | 214 | ||
215 | #define MXT_MAX_FINGER 10 | ||
216 | |||
217 | struct mxt_info { | 215 | struct mxt_info { |
218 | u8 family_id; | 216 | u8 family_id; |
219 | u8 variant_id; | 217 | u8 variant_id; |
@@ -1086,6 +1084,7 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
1086 | struct mxt_data *data; | 1084 | struct mxt_data *data; |
1087 | struct input_dev *input_dev; | 1085 | struct input_dev *input_dev; |
1088 | int error; | 1086 | int error; |
1087 | unsigned int num_mt_slots; | ||
1089 | 1088 | ||
1090 | if (!pdata) | 1089 | if (!pdata) |
1091 | return -EINVAL; | 1090 | return -EINVAL; |
@@ -1115,6 +1114,10 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
1115 | 1114 | ||
1116 | mxt_calc_resolution(data); | 1115 | mxt_calc_resolution(data); |
1117 | 1116 | ||
1117 | error = mxt_initialize(data); | ||
1118 | if (error) | ||
1119 | goto err_free_mem; | ||
1120 | |||
1118 | __set_bit(EV_ABS, input_dev->evbit); | 1121 | __set_bit(EV_ABS, input_dev->evbit); |
1119 | __set_bit(EV_KEY, input_dev->evbit); | 1122 | __set_bit(EV_KEY, input_dev->evbit); |
1120 | __set_bit(BTN_TOUCH, input_dev->keybit); | 1123 | __set_bit(BTN_TOUCH, input_dev->keybit); |
@@ -1128,9 +1131,10 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
1128 | 0, 255, 0, 0); | 1131 | 0, 255, 0, 0); |
1129 | 1132 | ||
1130 | /* For multi touch */ | 1133 | /* For multi touch */ |
1131 | error = input_mt_init_slots(input_dev, MXT_MAX_FINGER); | 1134 | num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; |
1135 | error = input_mt_init_slots(input_dev, num_mt_slots); | ||
1132 | if (error) | 1136 | if (error) |
1133 | goto err_free_mem; | 1137 | goto err_free_object; |
1134 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | 1138 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, |
1135 | 0, MXT_MAX_AREA, 0, 0); | 1139 | 0, MXT_MAX_AREA, 0, 0); |
1136 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1140 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
@@ -1143,10 +1147,6 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
1143 | input_set_drvdata(input_dev, data); | 1147 | input_set_drvdata(input_dev, data); |
1144 | i2c_set_clientdata(client, data); | 1148 | i2c_set_clientdata(client, data); |
1145 | 1149 | ||
1146 | error = mxt_initialize(data); | ||
1147 | if (error) | ||
1148 | goto err_free_mem; | ||
1149 | |||
1150 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, | 1150 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, |
1151 | pdata->irqflags, client->name, data); | 1151 | pdata->irqflags, client->name, data); |
1152 | if (error) { | 1152 | if (error) { |