]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 17 Dec 2012 06:04:14 +0000 (22:04 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 17 Dec 2012 06:04:14 +0000 (22:04 -0800)
Prepare first set of updates for 3.8 merge window.

1  2 
drivers/input/matrix-keymap.c
drivers/input/tablet/wacom_wac.c

index d88d9be1d1b7881b5fe5acfd674bf1ca12c17793,419cb6b88e2a8188e916d5d8167b4a6f142dbd47..3ae496ea5fe6b52d6620443d937dd3ea5bbda44e
   */
  
  #include <linux/device.h>
+ #include <linux/gfp.h>
  #include <linux/kernel.h>
  #include <linux/types.h>
  #include <linux/input.h>
  #include <linux/of.h>
  #include <linux/export.h>
 +#include <linux/module.h>
  #include <linux/input/matrix_keypad.h>
  
  static bool matrix_keypad_map_key(struct input_dev *input_dev,
@@@ -123,6 -123,11 +124,11 @@@ static int matrix_keypad_parse_of_keyma
   * it will attempt load the keymap from property specified by @keymap_name
   * argument (or "linux,keymap" if @keymap_name is %NULL).
   *
+  * If @keymap is %NULL the function will automatically allocate managed
+  * block of memory to store the keymap. This memory will be associated with
+  * the parent device and automatically freed when device unbinds from the
+  * driver.
+  *
   * Callers are expected to set up input_dev->dev.parent before calling this
   * function.
   */
@@@ -133,12 -138,27 +139,27 @@@ int matrix_keypad_build_keymap(const st
                               struct input_dev *input_dev)
  {
        unsigned int row_shift = get_count_order(cols);
+       size_t max_keys = rows << row_shift;
        int i;
        int error;
  
+       if (WARN_ON(!input_dev->dev.parent))
+               return -EINVAL;
+       if (!keymap) {
+               keymap = devm_kzalloc(input_dev->dev.parent,
+                                     max_keys * sizeof(*keymap),
+                                     GFP_KERNEL);
+               if (!keymap) {
+                       dev_err(input_dev->dev.parent,
+                               "Unable to allocate memory for keymap");
+                       return -ENOMEM;
+               }
+       }
        input_dev->keycode = keymap;
        input_dev->keycodesize = sizeof(*keymap);
-       input_dev->keycodemax = rows << row_shift;
+       input_dev->keycodemax = max_keys;
  
        __set_bit(EV_KEY, input_dev->evbit);
  
        return 0;
  }
  EXPORT_SYMBOL(matrix_keypad_build_keymap);
 +
 +MODULE_LICENSE("GPL");
index c2bfe9242cc5055cf00c16db6572f877d3653709,c0f3e9104832a76f51da0b22f27e97f5525d3398..264138f3217eb9fe2cc32cb23c84ee0b20d5d329
@@@ -467,9 -467,7 +467,7 @@@ static void wacom_intuos_general(struc
        /* general pen packet */
        if ((data[1] & 0xb8) == 0xa0) {
                t = (data[6] << 2) | ((data[7] >> 6) & 3);
-               if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
-                     (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
-                   (features->type >= WACOM_21UX2 && features->type <= WACOM_24HD)) {
+               if (features->type >= INTUOS4S && features->type <= WACOM_24HD) {
                        t = (t << 1) | (data[1] & 1);
                }
                input_report_abs(input, ABS_PRESSURE, t);
@@@ -877,6 -875,11 +875,11 @@@ static int wacom_mt_touch(struct wacom_
        int i;
        int current_num_contacts = data[2];
        int contacts_to_send = 0;
+       int x_offset = 0;
+       /* MTTPC does not support Height and Width */
+       if (wacom->features.type == MTTPC)
+               x_offset = -4;
  
        /*
         * First packet resets the counter since only the first
        contacts_to_send = min(5, wacom->num_contacts_left);
  
        for (i = 0; i < contacts_to_send; i++) {
-               int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3;
+               int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
                bool touch = data[offset] & 0x1;
                int id = le16_to_cpup((__le16 *)&data[offset + 1]);
                int slot = find_slot_from_contactid(wacom, id);
                input_mt_slot(input, slot);
                input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
                if (touch) {
-                       int x = le16_to_cpup((__le16 *)&data[offset + 7]);
-                       int y = le16_to_cpup((__le16 *)&data[offset + 9]);
+                       int x = le16_to_cpup((__le16 *)&data[offset + x_offset + 7]);
+                       int y = le16_to_cpup((__le16 *)&data[offset + x_offset + 9]);
                        input_report_abs(input, ABS_MT_POSITION_X, x);
                        input_report_abs(input, ABS_MT_POSITION_Y, y);
                }
@@@ -1336,6 -1339,7 +1339,7 @@@ void wacom_wac_irq(struct wacom_wac *wa
        case TABLETPCE:
        case TABLETPC2FG:
        case MTSCREEN:
+       case MTTPC:
                sync = wacom_tpc_irq(wacom_wac, len);
                break;
  
@@@ -1657,6 -1661,7 +1661,7 @@@ int wacom_setup_input_capabilities(stru
                /* fall through */
  
        case MTSCREEN:
+       case MTTPC:
                if (features->device_type == BTN_TOOL_FINGER) {
                        wacom_wac->slots = kmalloc(features->touch_max *
                                                        sizeof(int),
@@@ -2018,6 -2023,15 +2023,15 @@@ static const struct wacom_features waco
  static const struct wacom_features wacom_features_0xEF =
        { "Wacom ISDv4 EF",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+ static const struct wacom_features wacom_features_0x100 =
+       { "Wacom ISDv4 100",      WACOM_PKGLEN_MTTPC,     26202, 16325,  255,
+         0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+ static const struct wacom_features wacom_features_0x101 =
+       { "Wacom ISDv4 101",      WACOM_PKGLEN_MTTPC,     26202, 16325,  255,
+         0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+ static const struct wacom_features wacom_features_0x4001 =
+       { "Wacom ISDv4 4001",      WACOM_PKGLEN_MTTPC,     26202, 16325,  255,
+         0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
  static const struct wacom_features wacom_features_0x47 =
        { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023,
          31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@@ -2034,8 -2048,7 +2048,8 @@@ static const struct wacom_features waco
          .touch_max = 2 };
  static const struct wacom_features wacom_features_0xD2 =
        { "Wacom Bamboo Craft",   WACOM_PKGLEN_BBFUN,     14720,  9200, 1023,
 -        31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 +        31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
 +        .touch_max = 2 };
  static const struct wacom_features wacom_features_0xD3 =
        { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN,     21648, 13700, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@@ -2195,6 -2208,9 +2209,9 @@@ const struct usb_device_id wacom_ids[] 
        { USB_DEVICE_WACOM(0xEC) },
        { USB_DEVICE_WACOM(0xED) },
        { USB_DEVICE_WACOM(0xEF) },
+       { USB_DEVICE_WACOM(0x100) },
+       { USB_DEVICE_WACOM(0x101) },
+       { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x47) },
        { USB_DEVICE_WACOM(0xF4) },
        { USB_DEVICE_WACOM(0xF8) },