Merge branch 'next' into for-linus
[pandora-kernel.git] / drivers / input / tablet / wacom_wac.c
index db747e4..5187829 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "wacom_wac.h"
 #include "wacom.h"
+#include <linux/input/mt.h>
 
 static int wacom_penpartner_irq(struct wacom_wac *wacom)
 {
@@ -862,19 +863,21 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
        struct wacom_features *features = &wacom->features;
        struct input_dev *input = wacom->input;
        unsigned char *data = wacom->data;
-       int sp = 0, sx = 0, sy = 0, count = 0;
        int i;
 
        for (i = 0; i < 2; i++) {
                int p = data[9 * i + 2];
+               bool touch = p && !wacom->shared->stylus_in_proximity;
+
                input_mt_slot(input, i);
+               input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
                /*
                 * Touch events need to be disabled while stylus is
                 * in proximity because user's hand is resting on touchpad
                 * and sending unwanted events.  User expects tablet buttons
                 * to continue working though.
                 */
-               if (p && !wacom->shared->stylus_in_proximity) {
+               if (touch) {
                        int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
                        int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
                        if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
@@ -884,23 +887,10 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
                        input_report_abs(input, ABS_MT_PRESSURE, p);
                        input_report_abs(input, ABS_MT_POSITION_X, x);
                        input_report_abs(input, ABS_MT_POSITION_Y, y);
-                       if (wacom->id[i] < 0)
-                               wacom->id[i] = wacom->trk_id++ & MAX_TRACKING_ID;
-                       if (!count++)
-                               sp = p, sx = x, sy = y;
-               } else {
-                       wacom->id[i] = -1;
                }
-               input_report_abs(input, ABS_MT_TRACKING_ID, wacom->id[i]);
        }
 
-       input_report_key(input, BTN_TOUCH, count > 0);
-       input_report_key(input, BTN_TOOL_FINGER, count == 1);
-       input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
-
-       input_report_abs(input, ABS_PRESSURE, sp);
-       input_report_abs(input, ABS_X, sx);
-       input_report_abs(input, ABS_Y, sy);
+       input_mt_report_pointer_emulation(input, true);
 
        input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
        input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
@@ -1272,7 +1262,7 @@ void 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_create_slots(input_dev, 2);
+                       input_mt_init_slots(input_dev, 2);
                        input_set_abs_params(input_dev, ABS_MT_POSITION_X,
                                             0, features->x_max,
                                             features->x_fuzz, 0);
@@ -1282,8 +1272,6 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
                        input_set_abs_params(input_dev, ABS_MT_PRESSURE,
                                             0, features->pressure_max,
                                             features->pressure_fuzz, 0);
-                       input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
-                                            MAX_TRACKING_ID, 0, 0);
                } else if (features->device_type == BTN_TOOL_PEN) {
                        __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
                        __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -1436,15 +1424,25 @@ static struct wacom_features wacom_features_0xD2 =
        { "Wacom Bamboo Craft",   WACOM_PKGLEN_BBFUN,     14720,  9200, 1023, 63, BAMBOO_PT };
 static struct wacom_features wacom_features_0xD3 =
        { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN,     21648, 13530, 1023, 63, BAMBOO_PT };
+static const struct wacom_features wacom_features_0xD4 =
+       { "Wacom Bamboo Pen",     WACOM_PKGLEN_BBFUN,     14720,  9200,  255, 63, BAMBOO_PT };
 static struct wacom_features wacom_features_0xD8 =
        { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN,   21648, 13530, 1023, 63, BAMBOO_PT };
 static struct wacom_features wacom_features_0xDA =
        { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN,  14720,  9200, 1023, 63, BAMBOO_PT };
+static struct wacom_features wacom_features_0xDB =
+       { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN,  21648, 13530, 1023, 63, BAMBOO_PT };
+static const struct wacom_features wacom_features_0x6004 =
+       { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800, 8000, 255, 0, TABLETPC };
 
 #define USB_DEVICE_WACOM(prod)                                 \
        USB_DEVICE(USB_VENDOR_ID_WACOM, prod),                  \
        .driver_info = (kernel_ulong_t)&wacom_features_##prod
 
+#define USB_DEVICE_LENOVO(prod)                                        \
+       USB_DEVICE(USB_VENDOR_ID_LENOVO, prod),                 \
+       .driver_info = (kernel_ulong_t)&wacom_features_##prod
+
 const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x00) },
        { USB_DEVICE_WACOM(0x10) },
@@ -1508,8 +1506,10 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0xD1) },
        { USB_DEVICE_WACOM(0xD2) },
        { USB_DEVICE_WACOM(0xD3) },
+       { USB_DEVICE_WACOM(0xD4) },
        { USB_DEVICE_WACOM(0xD8) },
        { USB_DEVICE_WACOM(0xDA) },
+       { USB_DEVICE_WACOM(0xDB) },
        { USB_DEVICE_WACOM(0xF0) },
        { USB_DEVICE_WACOM(0xCC) },
        { USB_DEVICE_WACOM(0x90) },
@@ -1519,6 +1519,7 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0xE2) },
        { USB_DEVICE_WACOM(0xE3) },
        { USB_DEVICE_WACOM(0x47) },
+       { USB_DEVICE_LENOVO(0x6004) },
        { }
 };
 MODULE_DEVICE_TABLE(usb, wacom_ids);