History

Input: MT - Add flags to input_mt_init_slots()

Preparing to move more repeated code into the mt core, add a flags argument to the input_mt_slots_init() function.

Henrik Rydberg committed 14 years ago

Commit b4adbbe1 parent a274ac118 files · +27 −22Browse files

Unified · Split

18 files
  1. drivers/hid/hid-magicmouse.c +1 −1
  2. drivers/hid/hid-multitouch.c +1 −1
  3. drivers/input/input-mt.c +3 −1
  4. drivers/input/misc/uinput.c +1 −1
  5. drivers/input/mouse/alps.c +1 −1
  6. drivers/input/mouse/elantech.c +2 −2
  7. drivers/input/mouse/sentelic.c +1 −1
  8. drivers/input/mouse/synaptics.c +2 −2
  9. drivers/input/tablet/wacom_wac.c +3 −3
  10. drivers/input/touchscreen/atmel_mxt_ts.c +1 −1
  11. drivers/input/touchscreen/cyttsp_core.c +1 −1
  12. drivers/input/touchscreen/edt-ft5x06.c +1 −1
  13. drivers/input/touchscreen/egalax_ts.c +1 −1
  14. drivers/input/touchscreen/ili210x.c +1 −1
  15. drivers/input/touchscreen/mms114.c +1 −1
  16. drivers/input/touchscreen/penmount.c +1 −1
  17. drivers/input/touchscreen/wacom_w8001.c +1 −1
  18. include/linux/input/mt.h +4 −1
drivers/hid/hid-magicmouse.c+1−1
@@ -392,7 +392,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd · 391 unmodified lines
392392
393393 __set_bit(EV_ABS, input->evbit);
394394
395− error = input_mt_init_slots(input, 16);
395+ error = input_mt_init_slots(input, 16, 0);
396396 if (error)
397397 return error;
398398 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
drivers/hid/hid-multitouch.c+1−1
@@ -390,7 +390,7 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 389 unmodified lines
390390 case HID_DG_CONTACTID:
391391 if (!td->maxcontacts)
392392 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
393− input_mt_init_slots(hi->input, td->maxcontacts);
393+ input_mt_init_slots(hi->input, td->maxcontacts, 0);
394394 mt_store_field(usage, td, hi);
395395 td->last_field_index = field->index;
396396 td->touches_by_report++;
drivers/input/input-mt.c+3−1
@@ -25,7 +25,8 @@ · 24 unmodified lines
2525 * May be called repeatedly. Returns -EINVAL if attempting to
2626 * reinitialize with a different number of slots.
2727 */
28−int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
28+int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
29+ unsigned int flags)
2930 {
3031 struct input_mt *mt = dev->mt;
3132 int i;
@@ -40,6 +41,7 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots) · 8 unmodified lines
4041 return -ENOMEM;
4142
4243 mt->num_slots = num_slots;
44+ mt->flags = flags;
4345 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
4446 input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);
4547
drivers/input/misc/uinput.c+1−1
@@ -405,7 +405,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu · 404 unmodified lines
405405 goto exit;
406406 if (test_bit(ABS_MT_SLOT, dev->absbit)) {
407407 int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
408− input_mt_init_slots(dev, nslot);
408+ input_mt_init_slots(dev, nslot, 0);
409409 } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
410410 input_set_events_per_packet(dev, 60);
411411 }
drivers/input/mouse/alps.c+1−1
@@ -1620,7 +1620,7 @@ int alps_init(struct psmouse *psmouse) · 1619 unmodified lines
16201620 case ALPS_PROTO_V3:
16211621 case ALPS_PROTO_V4:
16221622 set_bit(INPUT_PROP_SEMI_MT, dev1->propbit);
1623− input_mt_init_slots(dev1, 2);
1623+ input_mt_init_slots(dev1, 2, 0);
16241624 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0);
16251625 input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0);
16261626
drivers/input/mouse/elantech.c+2−2
@@ -1004,7 +1004,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) · 1003 unmodified lines
10041004 input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
10051005 ETP_WMAX_V2, 0, 0);
10061006 }
1007− input_mt_init_slots(dev, 2);
1007+ input_mt_init_slots(dev, 2, 0);
10081008 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
10091009 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
10101010 break;
@@ -1035,7 +1035,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) · 24 unmodified lines
10351035 input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
10361036 ETP_WMAX_V2, 0, 0);
10371037 /* Multitouch capable pad, up to 5 fingers. */
1038− input_mt_init_slots(dev, ETP_MAX_FINGERS);
1038+ input_mt_init_slots(dev, ETP_MAX_FINGERS, 0);
10391039 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
10401040 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
10411041 input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
drivers/input/mouse/sentelic.c+1−1
@@ -960,7 +960,7 @@ static int fsp_set_input_params(struct psmouse *psmouse) · 959 unmodified lines
960960
961961 input_set_abs_params(dev, ABS_X, 0, abs_x, 0, 0);
962962 input_set_abs_params(dev, ABS_Y, 0, abs_y, 0, 0);
963− input_mt_init_slots(dev, 2);
963+ input_mt_init_slots(dev, 2, 0);
964964 input_set_abs_params(dev, ABS_MT_POSITION_X, 0, abs_x, 0, 0);
965965 input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, abs_y, 0, 0);
966966 }
drivers/input/mouse/synaptics.c+2−2
@@ -1232,7 +1232,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) · 1231 unmodified lines
12321232 input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
12331233
12341234 if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
1235− input_mt_init_slots(dev, 2);
1235+ input_mt_init_slots(dev, 2, 0);
12361236 set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
12371237 ABS_MT_POSITION_Y);
12381238 /* Image sensors can report per-contact pressure */
@@ -1244,7 +1244,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) · 5 unmodified lines
12441244 } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
12451245 /* Non-image sensors with AGM use semi-mt */
12461246 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
1247− input_mt_init_slots(dev, 2);
1247+ input_mt_init_slots(dev, 2, 0);
12481248 set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
12491249 ABS_MT_POSITION_Y);
12501250 }
drivers/input/tablet/wacom_wac.c+3−3
@@ -1530,7 +1530,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, · 1529 unmodified lines
15301530 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
15311531 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
15321532
1533− input_mt_init_slots(input_dev, features->touch_max);
1533+ input_mt_init_slots(input_dev, features->touch_max, 0);
15341534
15351535 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
15361536 0, 255, 0, 0);
@@ -1575,7 +1575,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, · 38 unmodified lines
15751575
15761576 case TABLETPC2FG:
15771577 if (features->device_type == BTN_TOOL_FINGER) {
1578− input_mt_init_slots(input_dev, features->touch_max);
1578+ input_mt_init_slots(input_dev, features->touch_max, 0);
15791579 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
15801580 0, MT_TOOL_MAX, 0, 0);
15811581 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
@@ -1631,7 +1631,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, · 49 unmodified lines
16311631
16321632 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
16331633 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1634− input_mt_init_slots(input_dev, features->touch_max);
1634+ input_mt_init_slots(input_dev, features->touch_max, 0);
16351635
16361636 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
16371637 __set_bit(BTN_TOOL_TRIPLETAP,
drivers/input/touchscreen/atmel_mxt_ts.c+1−1
@@ -1152,7 +1152,7 @@ static int __devinit mxt_probe(struct i2c_client *client, · 1151 unmodified lines
11521152
11531153 /* For multi touch */
11541154 num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1;
1155− error = input_mt_init_slots(input_dev, num_mt_slots);
1155+ error = input_mt_init_slots(input_dev, num_mt_slots, 0);
11561156 if (error)
11571157 goto err_free_object;
11581158 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
drivers/input/touchscreen/cyttsp_core.c+1−1
@@ -571,7 +571,7 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, · 570 unmodified lines
571571 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
572572 0, CY_MAXZ, 0, 0);
573573
574− input_mt_init_slots(input_dev, CY_MAX_ID);
574+ input_mt_init_slots(input_dev, CY_MAX_ID, 0);
575575
576576 error = request_threaded_irq(ts->irq, NULL, cyttsp_irq,
577577 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
drivers/input/touchscreen/edt-ft5x06.c+1−1
@@ -778,7 +778,7 @@ static int __devinit edt_ft5x06_ts_probe(struct i2c_client *client, · 777 unmodified lines
778778 0, tsdata->num_x * 64 - 1, 0, 0);
779779 input_set_abs_params(input, ABS_MT_POSITION_Y,
780780 0, tsdata->num_y * 64 - 1, 0, 0);
781− error = input_mt_init_slots(input, MAX_SUPPORT_POINTS);
781+ error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0);
782782 if (error) {
783783 dev_err(&client->dev, "Unable to init MT slots.\n");
784784 goto err_free_mem;
drivers/input/touchscreen/egalax_ts.c+1−1
@@ -204,7 +204,7 @@ static int __devinit egalax_ts_probe(struct i2c_client *client, · 203 unmodified lines
204204 ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0);
205205 input_set_abs_params(input_dev,
206206 ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0);
207− input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS);
207+ input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0);
208208
209209 input_set_drvdata(input_dev, ts);
210210
drivers/input/touchscreen/ili210x.c+1−1
@@ -252,7 +252,7 @@ static int __devinit ili210x_i2c_probe(struct i2c_client *client, · 251 unmodified lines
252252 input_set_abs_params(input, ABS_Y, 0, ymax, 0, 0);
253253
254254 /* Multi touch */
255− input_mt_init_slots(input, MAX_TOUCHES);
255+ input_mt_init_slots(input, MAX_TOUCHES, 0);
256256 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0);
257257 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0);
258258
drivers/input/touchscreen/mms114.c+1−1
@@ -404,7 +404,7 @@ static int __devinit mms114_probe(struct i2c_client *client, · 403 unmodified lines
404404 input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0);
405405
406406 /* For multi touch */
407− input_mt_init_slots(input_dev, MMS114_MAX_TOUCH);
407+ input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 0);
408408 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
409409 0, MMS114_MAX_AREA, 0, 0);
410410 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
drivers/input/touchscreen/penmount.c+1−1
@@ -264,7 +264,7 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv) · 263 unmodified lines
264264 input_set_abs_params(pm->dev, ABS_Y, 0, max_y, 0, 0);
265265
266266 if (pm->maxcontacts > 1) {
267− input_mt_init_slots(pm->dev, pm->maxcontacts);
267+ input_mt_init_slots(pm->dev, pm->maxcontacts, 0);
268268 input_set_abs_params(pm->dev,
269269 ABS_MT_POSITION_X, 0, max_x, 0, 0);
270270 input_set_abs_params(pm->dev,
drivers/input/touchscreen/wacom_w8001.c+1−1
@@ -471,7 +471,7 @@ static int w8001_setup(struct w8001 *w8001) · 470 unmodified lines
471471 case 5:
472472 w8001->pktlen = W8001_PKTLEN_TOUCH2FG;
473473
474− input_mt_init_slots(dev, 2);
474+ input_mt_init_slots(dev, 2, 0);
475475 input_set_abs_params(dev, ABS_MT_POSITION_X,
476476 0, touch.x, 0, 0);
477477 input_set_abs_params(dev, ABS_MT_POSITION_Y,
include/linux/input/mt.h+4−1
@@ -28,12 +28,14 @@ struct input_mt_slot { · 27 unmodified lines
2828 * @trkid: stores MT tracking ID for the next contact
2929 * @num_slots: number of MT slots the device uses
3030 * @slot: MT slot currently being transmitted
31+ * @flags: input_mt operation flags
3132 * @slots: array of slots holding current values of tracked contacts
3233 */
3334 struct input_mt {
3435 int trkid;
3536 int num_slots;
3637 int slot;
38+ unsigned int flags;
3739 struct input_mt_slot slots[];
3840 };
3941
@@ -49,7 +51,8 @@ static inline int input_mt_get_value(const struct input_mt_slot *slot, · 9 unmodified lines
4951 return slot->abs[code - ABS_MT_FIRST];
5052 }
5153
52−int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
54+int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
55+ unsigned int flags);
5356 void input_mt_destroy_slots(struct input_dev *dev);
5457
5558 static inline int input_mt_new_trkid(struct input_mt *mt)