]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Input: MT - Add flags to input_mt_init_slots()
authorHenrik Rydberg <rydberg@euromail.se>
Sat, 11 Aug 2012 20:07:55 +0000 (22:07 +0200)
committerHenrik Rydberg <rydberg@euromail.se>
Wed, 19 Sep 2012 17:50:18 +0000 (19:50 +0200)
Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
18 files changed:
drivers/hid/hid-magicmouse.c
drivers/hid/hid-multitouch.c
drivers/input/input-mt.c
drivers/input/misc/uinput.c
drivers/input/mouse/alps.c
drivers/input/mouse/elantech.c
drivers/input/mouse/sentelic.c
drivers/input/mouse/synaptics.c
drivers/input/tablet/wacom_wac.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/cyttsp_core.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/input/touchscreen/egalax_ts.c
drivers/input/touchscreen/ili210x.c
drivers/input/touchscreen/mms114.c
drivers/input/touchscreen/penmount.c
drivers/input/touchscreen/wacom_w8001.c
include/linux/input/mt.h

index 73647266daadc57ecd36a948e50ff6df80aeed21..25ddf3e3aec641fd4d883843e87e59bc0e3b0c51 100644 (file)
@@ -392,7 +392,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
 
        __set_bit(EV_ABS, input->evbit);
 
-       error = input_mt_init_slots(input, 16);
+       error = input_mt_init_slots(input, 16, 0);
        if (error)
                return error;
        input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
index 59c8b5c1d2de62b9a1d5a910dfa7f3ad5e470c51..c400d90087747f174a151cdde1159b78babe6f1e 100644 (file)
@@ -390,7 +390,7 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                case HID_DG_CONTACTID:
                        if (!td->maxcontacts)
                                td->maxcontacts = MT_DEFAULT_MAXCONTACT;
-                       input_mt_init_slots(hi->input, td->maxcontacts);
+                       input_mt_init_slots(hi->input, td->maxcontacts, 0);
                        mt_store_field(usage, td, hi);
                        td->last_field_index = field->index;
                        td->touches_by_report++;
index 6020d06652a89f388224e14e853c0aa3f84f67a9..1985f27f427a583aaec4caf7fb29bdee2b9196aa 100644 (file)
@@ -25,7 +25,8 @@
  * May be called repeatedly. Returns -EINVAL if attempting to
  * reinitialize with a different number of slots.
  */
-int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
+int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
+                       unsigned int flags)
 {
        struct input_mt *mt = dev->mt;
        int i;
@@ -40,6 +41,7 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
                return -ENOMEM;
 
        mt->num_slots = num_slots;
+       mt->flags = flags;
        input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
        input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);
 
index 736056897e5008219cf12ba0f3bbcafee5e1c164..6b1797503e343a8cdae57e25ce84e9ac2dbe3a8c 100644 (file)
@@ -405,7 +405,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu
                        goto exit;
                if (test_bit(ABS_MT_SLOT, dev->absbit)) {
                        int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
-                       input_mt_init_slots(dev, nslot);
+                       input_mt_init_slots(dev, nslot, 0);
                } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
                        input_set_events_per_packet(dev, 60);
                }
index 4a1347e91bdcae3a72562b0f966b0025b5afec21..cf5af1f495ec5351125b43ee71ce725cc4644b21 100644 (file)
@@ -1620,7 +1620,7 @@ int alps_init(struct psmouse *psmouse)
        case ALPS_PROTO_V3:
        case ALPS_PROTO_V4:
                set_bit(INPUT_PROP_SEMI_MT, dev1->propbit);
-               input_mt_init_slots(dev1, 2);
+               input_mt_init_slots(dev1, 2, 0);
                input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0);
                input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0);
 
index 479011004a111dcf41cc344356da29e3deb74902..1e8e42fb03a4258d0b04f34d5872440ee293fe5b 100644 (file)
@@ -1004,7 +1004,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
                        input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
                                             ETP_WMAX_V2, 0, 0);
                }
-               input_mt_init_slots(dev, 2);
+               input_mt_init_slots(dev, 2, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
                break;
@@ -1035,7 +1035,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
                input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
                                     ETP_WMAX_V2, 0, 0);
                /* Multitouch capable pad, up to 5 fingers. */
-               input_mt_init_slots(dev, ETP_MAX_FINGERS);
+               input_mt_init_slots(dev, ETP_MAX_FINGERS, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
                input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
index 3f5649f190824408a25c495bdfd4da88b8febe9a..b47155d8bc8c3ef0effc46b565f18f9371dffab3 100644 (file)
@@ -960,7 +960,7 @@ static int fsp_set_input_params(struct psmouse *psmouse)
 
                input_set_abs_params(dev, ABS_X, 0, abs_x, 0, 0);
                input_set_abs_params(dev, ABS_Y, 0, abs_y, 0, 0);
-               input_mt_init_slots(dev, 2);
+               input_mt_init_slots(dev, 2, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_X, 0, abs_x, 0, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, abs_y, 0, 0);
        }
index 14eaecea2b70660f7377c0a3196809e28c406d4a..37033ade79d3c70881517f128d7a3d0141919099 100644 (file)
@@ -1232,7 +1232,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
        input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
 
        if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
-               input_mt_init_slots(dev, 2);
+               input_mt_init_slots(dev, 2, 0);
                set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
                                        ABS_MT_POSITION_Y);
                /* Image sensors can report per-contact pressure */
@@ -1244,7 +1244,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
        } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
                /* Non-image sensors with AGM use semi-mt */
                __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
-               input_mt_init_slots(dev, 2);
+               input_mt_init_slots(dev, 2, 0);
                set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
                                        ABS_MT_POSITION_Y);
        }
index 002041975de9c902f193f2448865d051f0ce98dc..5837d07e3c9ea60c788bfc37e1b336f5289efa85 100644 (file)
@@ -1530,7 +1530,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                        __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
                        __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
 
-                       input_mt_init_slots(input_dev, features->touch_max);
+                       input_mt_init_slots(input_dev, features->touch_max, 0);
 
                        input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
                                             0, 255, 0, 0);
@@ -1575,7 +1575,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
        case TABLETPC2FG:
                if (features->device_type == BTN_TOOL_FINGER) {
-                       input_mt_init_slots(input_dev, features->touch_max);
+                       input_mt_init_slots(input_dev, features->touch_max, 0);
                        input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
                                        0, MT_TOOL_MAX, 0, 0);
                        input_set_abs_params(input_dev, ABS_MT_POSITION_X,
@@ -1631,7 +1631,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
                        __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
                        __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
-                       input_mt_init_slots(input_dev, features->touch_max);
+                       input_mt_init_slots(input_dev, features->touch_max, 0);
 
                        if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
                                __set_bit(BTN_TOOL_TRIPLETAP,
index 4623cc69fc603ab6825a9793dd3e9e4e887b2657..e92615d0b1b0330b334b1a54a603354fdc3a8960 100644 (file)
@@ -1152,7 +1152,7 @@ static int __devinit mxt_probe(struct i2c_client *client,
 
        /* For multi touch */
        num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1;
-       error = input_mt_init_slots(input_dev, num_mt_slots);
+       error = input_mt_init_slots(input_dev, num_mt_slots, 0);
        if (error)
                goto err_free_object;
        input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
index f030d9ec795d0ae062a76260ff2943a28101e384..8e60437ac85b46569e57ae78f2bea455fd1b9ab5 100644 (file)
@@ -571,7 +571,7 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
        input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
                             0, CY_MAXZ, 0, 0);
 
-       input_mt_init_slots(input_dev, CY_MAX_ID);
+       input_mt_init_slots(input_dev, CY_MAX_ID, 0);
 
        error = request_threaded_irq(ts->irq, NULL, cyttsp_irq,
                                     IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
index 9afc777a40a7077a5bbd667944f1c1ee3bac38d7..7b786e757ba26c075b9617170f2da9269f51ccfd 100644 (file)
@@ -778,7 +778,7 @@ static int __devinit edt_ft5x06_ts_probe(struct i2c_client *client,
                             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);
-       error = input_mt_init_slots(input, MAX_SUPPORT_POINTS);
+       error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0);
        if (error) {
                dev_err(&client->dev, "Unable to init MT slots.\n");
                goto err_free_mem;
index 70524dd34f4277f3934f48c8b07e0d3cc84d6b21..c1e3460f1195aed3953c0e09542c9718d8664421 100644 (file)
@@ -204,7 +204,7 @@ static int __devinit egalax_ts_probe(struct i2c_client *client,
                             ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0);
        input_set_abs_params(input_dev,
                             ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0);
-       input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS);
+       input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0);
 
        input_set_drvdata(input_dev, ts);
 
index c0044175a921b1703842facefd0d7f9fd36cde3e..4ac69760ec08702577100b65a98d5288a24daf46 100644 (file)
@@ -252,7 +252,7 @@ static int __devinit ili210x_i2c_probe(struct i2c_client *client,
        input_set_abs_params(input, ABS_Y, 0, ymax, 0, 0);
 
        /* Multi touch */
-       input_mt_init_slots(input, MAX_TOUCHES);
+       input_mt_init_slots(input, MAX_TOUCHES, 0);
        input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0);
        input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0);
 
index 49c44bbf548d1a308b53bad306450aab66831f28..560cf09d1c5a893215f9aca033a6ea4327dfed7c 100644 (file)
@@ -404,7 +404,7 @@ static int __devinit mms114_probe(struct i2c_client *client,
        input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0);
 
        /* For multi touch */
-       input_mt_init_slots(input_dev, MMS114_MAX_TOUCH);
+       input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 0);
        input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
                             0, MMS114_MAX_AREA, 0, 0);
        input_set_abs_params(input_dev, ABS_MT_POSITION_X,
index 4ccde45b9da2bfac620f81c62aa9c6b95d5f873c..b49f0b836925a63c5142990cb87975900e7f5323 100644 (file)
@@ -264,7 +264,7 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv)
        input_set_abs_params(pm->dev, ABS_Y, 0, max_y, 0, 0);
 
        if (pm->maxcontacts > 1) {
-               input_mt_init_slots(pm->dev, pm->maxcontacts);
+               input_mt_init_slots(pm->dev, pm->maxcontacts, 0);
                input_set_abs_params(pm->dev,
                                     ABS_MT_POSITION_X, 0, max_x, 0, 0);
                input_set_abs_params(pm->dev,
index 8f9ad2f893b825a0c2d3afc5a9777ec098003308..9a83be6b6584f8f3af131767197916c65c8c1000 100644 (file)
@@ -471,7 +471,7 @@ static int w8001_setup(struct w8001 *w8001)
                case 5:
                        w8001->pktlen = W8001_PKTLEN_TOUCH2FG;
 
-                       input_mt_init_slots(dev, 2);
+                       input_mt_init_slots(dev, 2, 0);
                        input_set_abs_params(dev, ABS_MT_POSITION_X,
                                                0, touch.x, 0, 0);
                        input_set_abs_params(dev, ABS_MT_POSITION_Y,
index 63458bced77d8338963af873978e0a3feae0988f..53f5bf168ff907c5b0ac158689fc65b6ab2f2f1a 100644 (file)
@@ -28,12 +28,14 @@ struct input_mt_slot {
  * @trkid: stores MT tracking ID for the next contact
  * @num_slots: number of MT slots the device uses
  * @slot: MT slot currently being transmitted
+ * @flags: input_mt operation flags
  * @slots: array of slots holding current values of tracked contacts
  */
 struct input_mt {
        int trkid;
        int num_slots;
        int slot;
+       unsigned int flags;
        struct input_mt_slot slots[];
 };
 
@@ -49,7 +51,8 @@ static inline int input_mt_get_value(const struct input_mt_slot *slot,
        return slot->abs[code - ABS_MT_FIRST];
 }
 
-int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
+int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
+                       unsigned int flags);
 void input_mt_destroy_slots(struct input_dev *dev);
 
 static inline int input_mt_new_trkid(struct input_mt *mt)