]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'input/next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:36:17 +0000 (14:36 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:36:17 +0000 (14:36 +0200)
31 files changed:
Documentation/input/gamepad.txt
drivers/input/keyboard/gpio_keys.c
drivers/input/keyboard/gpio_keys_polled.c
drivers/input/keyboard/lpc32xx-keys.c
drivers/input/keyboard/nspire-keypad.c
drivers/input/keyboard/pxa27x_keypad.c
drivers/input/keyboard/tegra-kbc.c
drivers/input/misc/Kconfig
drivers/input/misc/ad714x-spi.c
drivers/input/misc/cobalt_btns.c
drivers/input/misc/pwm-beeper.c
drivers/input/misc/rb532_button.c
drivers/input/misc/rotary_encoder.c
drivers/input/misc/sirfsoc-onkey.c
drivers/input/misc/uinput.c
drivers/input/mouse/alps.c
drivers/input/mouse/cypress_ps2.c
drivers/input/serio/Kconfig
drivers/input/serio/Makefile
drivers/input/serio/hyperv-keyboard.c [new file with mode: 0644]
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h
drivers/input/touchscreen/ad7877.c
drivers/input/touchscreen/ad7879-spi.c
drivers/input/touchscreen/cyttsp4_core.c
drivers/input/touchscreen/egalax_ts.c
drivers/input/touchscreen/htcpen.c
drivers/input/touchscreen/st1232.c
drivers/input/touchscreen/ti_am335x_tsc.c
drivers/input/touchscreen/tsc2005.c

index 8002c894c6b052f3dc8443b82a69ec2ba36faae1..31bb6a4029ef84863a8f1341e023ed8961142a23 100644 (file)
@@ -122,12 +122,14 @@ D-Pad:
       BTN_DPAD_*
     Analog buttons are reported as:
       ABS_HAT0X and ABS_HAT0Y
+      (for ABS values negative is left/up, positive is right/down)
 
 Analog-Sticks:
   The left analog-stick is reported as ABS_X, ABS_Y. The right analog stick is
   reported as ABS_RX, ABS_RY. Zero, one or two sticks may be present.
   If analog-sticks provide digital buttons, they are mapped accordingly as
   BTN_THUMBL (first/left) and BTN_THUMBR (second/right).
+    (for ABS values negative is left/up, positive is right/down)
 
 Triggers:
   Trigger buttons can be available as digital or analog buttons or both. User-
@@ -138,6 +140,7 @@ Triggers:
   ABS_HAT2X (right/ZR) and BTN_TL2 or ABS_HAT2Y (left/ZL).
   If only one trigger-button combination is present (upper+lower), they are
   reported as "right" triggers (BTN_TR/ABS_HAT1X).
+    (ABS trigger values start at 0, pressure is reported as positive values)
 
 Menu-Pad:
   Menu buttons are always digital and are mapped according to their location
index 440ce32462baefafcabdda55c5c168c27753757c..2db13246eb8e0ba360a9cddc8c7d82b842f62ff8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/workqueue.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 #include <linux/spinlock.h>
index cd5ed9e221686625ba2ef92916c155c84732cb81..4e428199e580f36c1c9228870d8b4b1a8d02ef0f 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 
index 42181435fe6759f4302ac8ffdd68f0ea41d1df0f..8b1b01361ec6feb9f9670713717f72e0a57a63ff 100644 (file)
@@ -383,7 +383,7 @@ static struct platform_driver lpc32xx_kscan_driver = {
                .name   = DRV_NAME,
                .owner  = THIS_MODULE,
                .pm     = &lpc32xx_kscan_pm_ops,
-               .of_match_table = of_match_ptr(lpc32xx_kscan_match),
+               .of_match_table = lpc32xx_kscan_match,
        }
 };
 
index b3e3edab6d9f208050bf029a85c0b63ab755969b..b31064981e9687d0c448c8b7410bbf802d256cce 100644 (file)
@@ -143,8 +143,10 @@ static int nspire_keypad_open(struct input_dev *input)
                return error;
 
        error = nspire_keypad_chip_init(keypad);
-       if (error)
+       if (error) {
+               clk_disable_unprepare(keypad->clk);
                return error;
+       }
 
        return 0;
 }
@@ -267,7 +269,7 @@ static struct platform_driver nspire_keypad_driver = {
        .driver = {
                .name = "nspire-keypad",
                .owner = THIS_MODULE,
-               .of_match_table = of_match_ptr(nspire_keypad_dt_match),
+               .of_match_table = nspire_keypad_dt_match,
        },
        .probe = nspire_keypad_probe,
 };
index a2e758d27584c0117a5c941d36b8042ab20f425f..186138c720c79ebfee4ef896c61aeee78c770289 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/err.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index 9cd20e6905a08274bff3d55a48fa7e26d8f2b2c6..8508879f6fafd2663d393cb6afad9f00340b341c 100644 (file)
@@ -614,7 +614,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
        unsigned int keymap_rows;
        const struct of_device_id *match;
 
-       match = of_match_device(of_match_ptr(tegra_kbc_of_match), &pdev->dev);
+       match = of_match_device(tegra_kbc_of_match, &pdev->dev);
 
        kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL);
        if (!kbc) {
index aa51baaa9b1ec273acc95c7edcb838ed81fe5fe2..5f4967d01bc36a621655f64eea7e2c1408ef43b7 100644 (file)
@@ -156,7 +156,7 @@ config INPUT_MAX8925_ONKEY
 
 config INPUT_MAX8997_HAPTIC
        tristate "MAXIM MAX8997 haptic controller support"
-       depends on HAVE_PWM && MFD_MAX8997
+       depends on PWM && HAVE_PWM && MFD_MAX8997
        select INPUT_FF_MEMLESS
        help
          This option enables device driver support for the haptic controller
@@ -461,7 +461,7 @@ config INPUT_PCF8574
 
 config INPUT_PWM_BEEPER
        tristate "PWM beeper support"
-       depends on HAVE_PWM || PWM
+       depends on PWM && HAVE_PWM
        help
          Say Y here to get support for PWM based beeper devices.
 
index 61891486067cab2a585303398182ffb721688658..3a90b710e30960e95421c1d486058ade968fd6bc 100644 (file)
@@ -108,7 +108,6 @@ static int ad714x_spi_remove(struct spi_device *spi)
        struct ad714x_chip *chip = spi_get_drvdata(spi);
 
        ad714x_remove(chip);
-       spi_set_drvdata(spi, NULL);
 
        return 0;
 }
index 4f77f87847e805ef33abf52f72f21a2dd92b2c81..b5d71d245854684a33d8baeead24b78148a087c7 100644 (file)
@@ -131,7 +131,6 @@ static int cobalt_buttons_probe(struct platform_device *pdev)
  err_free_mem:
        input_free_polled_device(poll_dev);
        kfree(bdev);
-       dev_set_drvdata(&pdev->dev, NULL);
        return error;
 }
 
@@ -144,7 +143,6 @@ static int cobalt_buttons_remove(struct platform_device *pdev)
        input_free_polled_device(bdev->poll_dev);
        iounmap(bdev->reg);
        kfree(bdev);
-       dev_set_drvdata(dev, NULL);
 
        return 0;
 }
index 2ff4d1c78ab8ff91c4338c6e40d6ff91fac349c3..940566e7be1322751689027166653845173d6004 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
index fb4f8ac3343bd5c47c987e4ffb11c2540cf60267..83fff38b86b367ccdd2728095cafc769b6d00531 100644 (file)
@@ -87,7 +87,6 @@ static int rb532_button_remove(struct platform_device *pdev)
 
        input_unregister_polled_device(poll_dev);
        input_free_polled_device(poll_dev);
-       dev_set_drvdata(&pdev->dev, NULL);
 
        return 0;
 }
index 5b1aff825138a1b9db5d2b216f7389168bb7bf9f..f920ba7ab51f5e1399649fa75c158a3770ae86e7 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/gpio.h>
 #include <linux/rotary_encoder.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 
index 0621c367049a3e8a0183af7f9d50611c3c0f3a11..7b8b03e0d0bef905cd793a158cfaba2f135eeb5f 100644 (file)
@@ -153,7 +153,7 @@ static struct platform_driver sirfsoc_pwrc_driver = {
                .name   = "sirfsoc-pwrc",
                .owner  = THIS_MODULE,
                .pm     = &sirfsoc_pwrc_pm_ops,
-               .of_match_table = of_match_ptr(sirfsoc_pwrc_of_match),
+               .of_match_table = sirfsoc_pwrc_of_match,
        }
 };
 
index a0a4bbaef02c242a8ee16e54bdb9337e8f80407e..772835938a526ed2575f6bc187619fe962ac0e6c 100644 (file)
@@ -430,20 +430,30 @@ static int uinput_setup_device(struct uinput_device *udev,
        return retval;
 }
 
-static ssize_t uinput_inject_event(struct uinput_device *udev,
-                                  const char __user *buffer, size_t count)
+static ssize_t uinput_inject_events(struct uinput_device *udev,
+                                   const char __user *buffer, size_t count)
 {
        struct input_event ev;
+       size_t bytes = 0;
 
-       if (count < input_event_size())
+       if (count != 0 && count < input_event_size())
                return -EINVAL;
 
-       if (input_event_from_user(buffer, &ev))
-               return -EFAULT;
+       while (bytes + input_event_size() <= count) {
+               /*
+                * Note that even if some events were fetched successfully
+                * we are still going to return EFAULT instead of partial
+                * count to let userspace know that it got it's buffers
+                * all wrong.
+                */
+               if (input_event_from_user(buffer + bytes, &ev))
+                       return -EFAULT;
 
-       input_event(udev->dev, ev.type, ev.code, ev.value);
+               input_event(udev->dev, ev.type, ev.code, ev.value);
+               bytes += input_event_size();
+       }
 
-       return input_event_size();
+       return bytes;
 }
 
 static ssize_t uinput_write(struct file *file, const char __user *buffer,
@@ -460,7 +470,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer,
                return retval;
 
        retval = udev->state == UIST_CREATED ?
-                       uinput_inject_event(udev, buffer, count) :
+                       uinput_inject_events(udev, buffer, count) :
                        uinput_setup_device(udev, buffer, count);
 
        mutex_unlock(&udev->mutex);
index 7c5d72a6a26a3400fbedfcbe19e37e1abb298f1f..ca7a26f1dce81c37c6cd8524f8c4698effbfd739 100644 (file)
@@ -1792,7 +1792,7 @@ int alps_init(struct psmouse *psmouse)
        snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys);
        dev2->phys = priv->phys;
        dev2->name = (priv->flags & ALPS_DUALPOINT) ?
-                    "DualPoint Stick" : "PS/2 Mouse";
+                    "DualPoint Stick" : "ALPS PS/2 Device";
        dev2->id.bustype = BUS_I8042;
        dev2->id.vendor  = 0x0002;
        dev2->id.product = PSMOUSE_ALPS;
index f51765fff0545e91be567942255cf19532f94a71..ef651ccf130f5fa39d8bd6317efed46892dca3e1 100644 (file)
@@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
 {
        struct cytp_data *cytp;
 
-       cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+       cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
        psmouse->private = (void *)cytp;
        if (cytp == NULL)
                return -ENOMEM;
index 33b3e88fe4a2312f0047a4a700a2733c9ef81ee4..296cb88d70080eaae14c06a5179ffb11cfae107f 100644 (file)
@@ -266,4 +266,14 @@ config SERIO_OLPC_APSP
          To compile this driver as a module, choose M here: the module will
          be called olpc_apsp.
 
+config HYPERV_KEYBOARD
+       tristate "Microsoft Synthetic Keyboard driver"
+       depends on HYPERV
+       default HYPERV
+       help
+         Select this option to enable the Hyper-V Keyboard driver.
+
+         To compile this driver as a module, choose M here: the module will
+         be called hyperv_keyboard.
+
 endif
index 12298b1c0e716b62a771b9255b9f4f5c24b9e08e..815d874fe72469bd49a93edda8ea28c6aa3c7e58 100644 (file)
@@ -28,3 +28,4 @@ obj-$(CONFIG_SERIO_ALTERA_PS2)        += altera_ps2.o
 obj-$(CONFIG_SERIO_ARC_PS2)    += arc_ps2.o
 obj-$(CONFIG_SERIO_APBPS2)     += apbps2.o
 obj-$(CONFIG_SERIO_OLPC_APSP)  += olpc_apsp.o
+obj-$(CONFIG_HYPERV_KEYBOARD)  += hyperv-keyboard.o
diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
new file mode 100644 (file)
index 0000000..3a83c3c
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ *  Copyright (c) 2013, Microsoft Corporation.
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms and conditions of the GNU General Public License,
+ *  version 2, as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope it will be useful, but WITHOUT
+ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ *  more details.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/completion.h>
+#include <linux/hyperv.h>
+#include <linux/serio.h>
+#include <linux/slab.h>
+
+/*
+ * Current version 1.0
+ *
+ */
+#define SYNTH_KBD_VERSION_MAJOR 1
+#define SYNTH_KBD_VERSION_MINOR        0
+#define SYNTH_KBD_VERSION              (SYNTH_KBD_VERSION_MINOR | \
+                                        (SYNTH_KBD_VERSION_MAJOR << 16))
+
+
+/*
+ * Message types in the synthetic input protocol
+ */
+enum synth_kbd_msg_type {
+       SYNTH_KBD_PROTOCOL_REQUEST = 1,
+       SYNTH_KBD_PROTOCOL_RESPONSE = 2,
+       SYNTH_KBD_EVENT = 3,
+       SYNTH_KBD_LED_INDICATORS = 4,
+};
+
+/*
+ * Basic message structures.
+ */
+struct synth_kbd_msg_hdr {
+       __le32 type;
+};
+
+struct synth_kbd_msg {
+       struct synth_kbd_msg_hdr header;
+       char data[]; /* Enclosed message */
+};
+
+union synth_kbd_version {
+       __le32 version;
+};
+
+/*
+ * Protocol messages
+ */
+struct synth_kbd_protocol_request {
+       struct synth_kbd_msg_hdr header;
+       union synth_kbd_version version_requested;
+};
+
+#define PROTOCOL_ACCEPTED      BIT(0)
+struct synth_kbd_protocol_response {
+       struct synth_kbd_msg_hdr header;
+       __le32 proto_status;
+};
+
+#define IS_UNICODE     BIT(0)
+#define IS_BREAK       BIT(1)
+#define IS_E0          BIT(2)
+#define IS_E1          BIT(3)
+struct synth_kbd_keystroke {
+       struct synth_kbd_msg_hdr header;
+       __le16 make_code;
+       __le16 reserved0;
+       __le32 info; /* Additional information */
+};
+
+
+#define HK_MAXIMUM_MESSAGE_SIZE 256
+
+#define KBD_VSC_SEND_RING_BUFFER_SIZE          (10 * PAGE_SIZE)
+#define KBD_VSC_RECV_RING_BUFFER_SIZE          (10 * PAGE_SIZE)
+
+#define XTKBD_EMUL0     0xe0
+#define XTKBD_EMUL1     0xe1
+#define XTKBD_RELEASE   0x80
+
+
+/*
+ * Represents a keyboard device
+ */
+struct hv_kbd_dev {
+       struct hv_device *hv_dev;
+       struct serio *hv_serio;
+       struct synth_kbd_protocol_request protocol_req;
+       struct synth_kbd_protocol_response protocol_resp;
+       /* Synchronize the request/response if needed */
+       struct completion wait_event;
+       spinlock_t lock; /* protects 'started' field */
+       bool started;
+};
+
+static void hv_kbd_on_receive(struct hv_device *hv_dev,
+                             struct synth_kbd_msg *msg, u32 msg_length)
+{
+       struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
+       struct synth_kbd_keystroke *ks_msg;
+       unsigned long flags;
+       u32 msg_type = __le32_to_cpu(msg->header.type);
+       u32 info;
+       u16 scan_code;
+
+       switch (msg_type) {
+       case SYNTH_KBD_PROTOCOL_RESPONSE:
+               /*
+                * Validate the information provided by the host.
+                * If the host is giving us a bogus packet,
+                * drop the packet (hoping the problem
+                * goes away).
+                */
+               if (msg_length < sizeof(struct synth_kbd_protocol_response)) {
+                       dev_err(&hv_dev->device,
+                               "Illegal protocol response packet (len: %d)\n",
+                               msg_length);
+                       break;
+               }
+
+               memcpy(&kbd_dev->protocol_resp, msg,
+                       sizeof(struct synth_kbd_protocol_response));
+               complete(&kbd_dev->wait_event);
+               break;
+
+       case SYNTH_KBD_EVENT:
+               /*
+                * Validate the information provided by the host.
+                * If the host is giving us a bogus packet,
+                * drop the packet (hoping the problem
+                * goes away).
+                */
+               if (msg_length < sizeof(struct  synth_kbd_keystroke)) {
+                       dev_err(&hv_dev->device,
+                               "Illegal keyboard event packet (len: %d)\n",
+                               msg_length);
+                       break;
+               }
+
+               ks_msg = (struct synth_kbd_keystroke *)msg;
+               info = __le32_to_cpu(ks_msg->info);
+
+               /*
+                * Inject the information through the serio interrupt.
+                */
+               spin_lock_irqsave(&kbd_dev->lock, flags);
+               if (kbd_dev->started) {
+                       if (info & IS_E0)
+                               serio_interrupt(kbd_dev->hv_serio,
+                                               XTKBD_EMUL0, 0);
+
+                       scan_code = __le16_to_cpu(ks_msg->make_code);
+                       if (info & IS_BREAK)
+                               scan_code |= XTKBD_RELEASE;
+
+                       serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
+               }
+               spin_unlock_irqrestore(&kbd_dev->lock, flags);
+               break;
+
+       default:
+               dev_err(&hv_dev->device,
+                       "unhandled message type %d\n", msg_type);
+       }
+}
+
+static void hv_kbd_handle_received_packet(struct hv_device *hv_dev,
+                                         struct vmpacket_descriptor *desc,
+                                         u32 bytes_recvd,
+                                         u64 req_id)
+{
+       struct synth_kbd_msg *msg;
+       u32 msg_sz;
+
+       switch (desc->type) {
+       case VM_PKT_COMP:
+               break;
+
+       case VM_PKT_DATA_INBAND:
+               /*
+                * We have a packet that has "inband" data. The API used
+                * for retrieving the packet guarantees that the complete
+                * packet is read. So, minimally, we should be able to
+                * parse the payload header safely (assuming that the host
+                * can be trusted.  Trusting the host seems to be a
+                * reasonable assumption because in a virtualized
+                * environment there is not whole lot you can do if you
+                * don't trust the host.
+                *
+                * Nonetheless, let us validate if the host can be trusted
+                * (in a trivial way).  The interesting aspect of this
+                * validation is how do you recover if we discover that the
+                * host is not to be trusted? Simply dropping the packet, I
+                * don't think is an appropriate recovery.  In the interest
+                * of failing fast, it may be better to crash the guest.
+                * For now, I will just drop the packet!
+                */
+
+               msg_sz = bytes_recvd - (desc->offset8 << 3);
+               if (msg_sz <= sizeof(struct synth_kbd_msg_hdr)) {
+                       /*
+                        * Drop the packet and hope
+                        * the problem magically goes away.
+                        */
+                       dev_err(&hv_dev->device,
+                               "Illegal packet (type: %d, tid: %llx, size: %d)\n",
+                               desc->type, req_id, msg_sz);
+                       break;
+               }
+
+               msg = (void *)desc + (desc->offset8 << 3);
+               hv_kbd_on_receive(hv_dev, msg, msg_sz);
+               break;
+
+       default:
+               dev_err(&hv_dev->device,
+                       "unhandled packet type %d, tid %llx len %d\n",
+                       desc->type, req_id, bytes_recvd);
+               break;
+       }
+}
+
+static void hv_kbd_on_channel_callback(void *context)
+{
+       struct hv_device *hv_dev = context;
+       void *buffer;
+       int bufferlen = 0x100; /* Start with sensible size */
+       u32 bytes_recvd;
+       u64 req_id;
+       int error;
+
+       buffer = kmalloc(bufferlen, GFP_ATOMIC);
+       if (!buffer)
+               return;
+
+       while (1) {
+               error = vmbus_recvpacket_raw(hv_dev->channel, buffer, bufferlen,
+                                            &bytes_recvd, &req_id);
+               switch (error) {
+               case 0:
+                       if (bytes_recvd == 0) {
+                               kfree(buffer);
+                               return;
+                       }
+
+                       hv_kbd_handle_received_packet(hv_dev, buffer,
+                                                     bytes_recvd, req_id);
+                       break;
+
+               case -ENOBUFS:
+                       kfree(buffer);
+                       /* Handle large packet */
+                       bufferlen = bytes_recvd;
+                       buffer = kmalloc(bytes_recvd, GFP_ATOMIC);
+                       if (!buffer)
+                               return;
+                       break;
+               }
+       }
+}
+
+static int hv_kbd_connect_to_vsp(struct hv_device *hv_dev)
+{
+       struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
+       struct synth_kbd_protocol_request *request;
+       struct synth_kbd_protocol_response *response;
+       u32 proto_status;
+       int error;
+
+       request = &kbd_dev->protocol_req;
+       memset(request, 0, sizeof(struct synth_kbd_protocol_request));
+       request->header.type = __cpu_to_le32(SYNTH_KBD_PROTOCOL_REQUEST);
+       request->version_requested.version = __cpu_to_le32(SYNTH_KBD_VERSION);
+
+       error = vmbus_sendpacket(hv_dev->channel, request,
+                                sizeof(struct synth_kbd_protocol_request),
+                                (unsigned long)request,
+                                VM_PKT_DATA_INBAND,
+                                VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
+       if (error)
+               return error;
+
+       if (!wait_for_completion_timeout(&kbd_dev->wait_event, 10 * HZ))
+               return -ETIMEDOUT;
+
+       response = &kbd_dev->protocol_resp;
+       proto_status = __le32_to_cpu(response->proto_status);
+       if (!(proto_status & PROTOCOL_ACCEPTED)) {
+               dev_err(&hv_dev->device,
+                       "synth_kbd protocol request failed (version %d)\n",
+                       SYNTH_KBD_VERSION);
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
+static int hv_kbd_start(struct serio *serio)
+{
+       struct hv_kbd_dev *kbd_dev = serio->port_data;
+       unsigned long flags;
+
+       spin_lock_irqsave(&kbd_dev->lock, flags);
+       kbd_dev->started = true;
+       spin_unlock_irqrestore(&kbd_dev->lock, flags);
+
+       return 0;
+}
+
+static void hv_kbd_stop(struct serio *serio)
+{
+       struct hv_kbd_dev *kbd_dev = serio->port_data;
+       unsigned long flags;
+
+       spin_lock_irqsave(&kbd_dev->lock, flags);
+       kbd_dev->started = false;
+       spin_unlock_irqrestore(&kbd_dev->lock, flags);
+}
+
+static int hv_kbd_probe(struct hv_device *hv_dev,
+                       const struct hv_vmbus_device_id *dev_id)
+{
+       struct hv_kbd_dev *kbd_dev;
+       struct serio *hv_serio;
+       int error;
+
+       kbd_dev = kzalloc(sizeof(struct hv_kbd_dev), GFP_KERNEL);
+       hv_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+       if (!kbd_dev || !hv_serio) {
+               error = -ENOMEM;
+               goto err_free_mem;
+       }
+
+       kbd_dev->hv_dev = hv_dev;
+       kbd_dev->hv_serio = hv_serio;
+       spin_lock_init(&kbd_dev->lock);
+       init_completion(&kbd_dev->wait_event);
+       hv_set_drvdata(hv_dev, kbd_dev);
+
+       hv_serio->dev.parent  = &hv_dev->device;
+       hv_serio->id.type = SERIO_8042_XL;
+       hv_serio->port_data = kbd_dev;
+       strlcpy(hv_serio->name, dev_name(&hv_dev->device),
+               sizeof(hv_serio->name));
+       strlcpy(hv_serio->phys, dev_name(&hv_dev->device),
+               sizeof(hv_serio->phys));
+
+       hv_serio->start = hv_kbd_start;
+       hv_serio->stop = hv_kbd_stop;
+
+       error = vmbus_open(hv_dev->channel,
+                          KBD_VSC_SEND_RING_BUFFER_SIZE,
+                          KBD_VSC_RECV_RING_BUFFER_SIZE,
+                          NULL, 0,
+                          hv_kbd_on_channel_callback,
+                          hv_dev);
+       if (error)
+               goto err_free_mem;
+
+       error = hv_kbd_connect_to_vsp(hv_dev);
+       if (error)
+               goto err_close_vmbus;
+
+       serio_register_port(kbd_dev->hv_serio);
+       return 0;
+
+err_close_vmbus:
+       vmbus_close(hv_dev->channel);
+err_free_mem:
+       kfree(hv_serio);
+       kfree(kbd_dev);
+       return error;
+}
+
+static int hv_kbd_remove(struct hv_device *hv_dev)
+{
+       struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
+
+       serio_unregister_port(kbd_dev->hv_serio);
+       vmbus_close(hv_dev->channel);
+       kfree(kbd_dev);
+
+       hv_set_drvdata(hv_dev, NULL);
+
+       return 0;
+}
+
+/*
+ * Keyboard GUID
+ * {f912ad6d-2b17-48ea-bd65-f927a61c7684}
+ */
+#define HV_KBD_GUID \
+       .guid = { \
+                       0x6d, 0xad, 0x12, 0xf9, 0x17, 0x2b, 0xea, 0x48, \
+                       0xbd, 0x65, 0xf9, 0x27, 0xa6, 0x1c, 0x76, 0x84 \
+       }
+
+static const struct hv_vmbus_device_id id_table[] = {
+       /* Keyboard guid */
+       { HV_KBD_GUID, },
+       { },
+};
+
+MODULE_DEVICE_TABLE(vmbus, id_table);
+
+static struct  hv_driver hv_kbd_drv = {
+       .name = KBUILD_MODNAME,
+       .id_table = id_table,
+       .probe = hv_kbd_probe,
+       .remove = hv_kbd_remove,
+};
+
+static int __init hv_kbd_init(void)
+{
+       return vmbus_driver_register(&hv_kbd_drv);
+}
+
+static void __exit hv_kbd_exit(void)
+{
+       vmbus_driver_unregister(&hv_kbd_drv);
+}
+
+MODULE_LICENSE("GPL");
+module_init(hv_kbd_init);
+module_exit(hv_kbd_exit);
index e53416a4d7f3275ea2fd8f53f6a55dcbb6de02ad..867e7c33ac55072b19f2ff339705c4e90f6b428d 100644 (file)
@@ -524,9 +524,6 @@ static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int
 
                error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
                                         report_id, rep_data, length, 1);
-               if (error >= 0)
-                       error = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
-                                                report_id, rep_data, length, 1);
        } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES);
 
        kfree(rep_data);
@@ -548,7 +545,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
                        /* MT Tablet PC touch */
                        return wacom_set_device_mode(intf, 3, 4, 4);
                }
-               else if (features->type == WACOM_24HDT) {
+               else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) {
                        return wacom_set_device_mode(intf, 18, 3, 2);
                }
        } else if (features->device_type == BTN_TOOL_PEN) {
@@ -719,7 +716,7 @@ static int wacom_led_control(struct wacom *wacom)
                return -ENOMEM;
 
        if (wacom->wacom_wac.features.type >= INTUOS5S &&
-           wacom->wacom_wac.features.type <= INTUOS5L) {
+           wacom->wacom_wac.features.type <= INTUOSPL) {
                /*
                 * Touch Ring and crop mark LED luminance may take on
                 * one of four values:
@@ -981,14 +978,20 @@ static int wacom_initialize_leds(struct wacom *wacom)
        case INTUOS5S:
        case INTUOS5:
        case INTUOS5L:
-               wacom->led.select[0] = 0;
-               wacom->led.select[1] = 0;
-               wacom->led.llv = 32;
-               wacom->led.hlv = 0;
-               wacom->led.img_lum = 0;
-
-               error = sysfs_create_group(&wacom->intf->dev.kobj,
-                                          &intuos5_led_attr_group);
+       case INTUOSPS:
+       case INTUOSPM:
+       case INTUOSPL:
+               if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) {
+                       wacom->led.select[0] = 0;
+                       wacom->led.select[1] = 0;
+                       wacom->led.llv = 32;
+                       wacom->led.hlv = 0;
+                       wacom->led.img_lum = 0;
+
+                       error = sysfs_create_group(&wacom->intf->dev.kobj,
+                                                 &intuos5_led_attr_group);
+               } else
+                       return 0;
                break;
 
        default:
@@ -1024,8 +1027,12 @@ static void wacom_destroy_leds(struct wacom *wacom)
        case INTUOS5S:
        case INTUOS5:
        case INTUOS5L:
-               sysfs_remove_group(&wacom->intf->dev.kobj,
-                                  &intuos5_led_attr_group);
+       case INTUOSPS:
+       case INTUOSPM:
+       case INTUOSPL:
+               if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN)
+                       sysfs_remove_group(&wacom->intf->dev.kobj,
+                                          &intuos5_led_attr_group);
                break;
        }
 }
@@ -1185,34 +1192,47 @@ static void wacom_wireless_work(struct work_struct *work)
                wacom_wac1->features =
                        *((struct wacom_features *)id->driver_info);
                wacom_wac1->features.device_type = BTN_TOOL_PEN;
+               snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
+                        wacom_wac1->features.name);
                error = wacom_register_input(wacom1);
                if (error)
-                       goto fail1;
+                       goto fail;
 
                /* Touch interface */
-               wacom_wac2->features =
-                       *((struct wacom_features *)id->driver_info);
-               wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
-               wacom_wac2->features.device_type = BTN_TOOL_FINGER;
-               wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
-               error = wacom_register_input(wacom2);
-               if (error)
-                       goto fail2;
+               if (wacom_wac1->features.touch_max) {
+                       wacom_wac2->features =
+                               *((struct wacom_features *)id->driver_info);
+                       wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
+                       wacom_wac2->features.device_type = BTN_TOOL_FINGER;
+                       wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
+                       if (wacom_wac2->features.touch_max)
+                               snprintf(wacom_wac2->name, WACOM_NAME_MAX,
+                                        "%s (WL) Finger",wacom_wac2->features.name);
+                       else
+                               snprintf(wacom_wac2->name, WACOM_NAME_MAX,
+                                        "%s (WL) Pad",wacom_wac2->features.name);
+                       error = wacom_register_input(wacom2);
+                       if (error)
+                               goto fail;
+               }
 
                error = wacom_initialize_battery(wacom);
                if (error)
-                       goto fail3;
+                       goto fail;
        }
 
        return;
 
-fail3:
-       input_unregister_device(wacom_wac2->input);
-       wacom_wac2->input = NULL;
-fail2:
-       input_unregister_device(wacom_wac1->input);
-       wacom_wac1->input = NULL;
-fail1:
+fail:
+       if (wacom_wac2->input) {
+               input_unregister_device(wacom_wac2->input);
+               wacom_wac2->input = NULL;
+       }
+
+       if (wacom_wac1->input) {
+               input_unregister_device(wacom_wac1->input);
+               wacom_wac1->input = NULL;
+       }
        return;
 }
 
@@ -1302,7 +1322,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
         * HID descriptor. If this is the touch interface (wMaxPacketSize
         * of WACOM_PKGLEN_BBTOUCH3), override the table values.
         */
-       if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+       if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
                if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
                        features->device_type = BTN_TOOL_FINGER;
                        features->pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1329,10 +1349,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
                struct usb_device *other_dev;
 
                /* Append the device type to the name */
-               strlcat(wacom_wac->name,
-                       features->device_type == BTN_TOOL_PEN ?
-                               " Pen" : " Finger",
-                       sizeof(wacom_wac->name));
+               if (features->device_type != BTN_TOOL_FINGER)
+                       strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
+               else if (features->touch_max)
+                       strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
+               else
+                       strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
 
                other_dev = wacom_get_sibling(dev, features->oVid, features->oPid);
                if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL)
index c59b797eeafaa4f6258552389437cb8d113e1642..782c2535f1d81a26db96716ac406405b2b03a78b 100644 (file)
@@ -427,6 +427,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
                        (features->type == WACOM_21UX2))
                return 1;
 
+       /* Range Report */
+       if ((data[1] & 0xfe) == 0x20) {
+               input_report_key(input, BTN_TOUCH, 0);
+               input_report_abs(input, ABS_PRESSURE, 0);
+               input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
+       }
+
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
                if (features->quirks == WACOM_QUIRK_MULTI_INPUT)
@@ -477,7 +484,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
        /* general pen packet */
        if ((data[1] & 0xb8) == 0xa0) {
                t = (data[6] << 2) | ((data[7] >> 6) & 3);
-               if (features->type >= INTUOS4S && features->type <= WACOM_24HD) {
+               if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) {
                        t = (t << 1) | (data[1] & 1);
                }
                input_report_abs(input, ABS_PRESSURE, t);
@@ -621,14 +628,30 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
                        } else {
                                input_report_abs(input, ABS_MISC, 0);
                        }
-               } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+               } else if (features->type == CINTIQ_HYBRID) {
+                       /*
+                        * Do not send hardware buttons under Android. They
+                        * are already sent to the system through GPIO (and
+                        * have different meaning).
+                        */
+                       input_report_key(input, BTN_1, (data[4] & 0x01));
+                       input_report_key(input, BTN_2, (data[4] & 0x02));
+                       input_report_key(input, BTN_3, (data[4] & 0x04));
+                       input_report_key(input, BTN_4, (data[4] & 0x08));
+
+                       input_report_key(input, BTN_5, (data[4] & 0x10));  /* Right  */
+                       input_report_key(input, BTN_6, (data[4] & 0x20));  /* Up     */
+                       input_report_key(input, BTN_7, (data[4] & 0x40));  /* Left   */
+                       input_report_key(input, BTN_8, (data[4] & 0x80));  /* Down   */
+                       input_report_key(input, BTN_0, (data[3] & 0x01));  /* Center */
+               } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
                        int i;
 
                        /* Touch ring mode switch has no capacitive sensor */
                        input_report_key(input, BTN_0, (data[3] & 0x01));
 
                        /*
-                        * ExpressKeys on Intuos5 have a capacitive sensor in
+                        * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
                         * addition to the mechanical switch. Switch data is
                         * stored in data[4], capacitive data in data[5].
                         */
@@ -716,7 +739,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
             features->type == INTUOS4 ||
             features->type == INTUOS4S ||
             features->type == INTUOS5 ||
-            features->type == INTUOS5S)) {
+            features->type == INTUOS5S ||
+            features->type == INTUOSPM ||
+            features->type == INTUOSPS)) {
 
                return 0;
        }
@@ -769,8 +794,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
 
                } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
                        /* I4 mouse */
-                       if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
-                           (features->type >= INTUOS5S && features->type <= INTUOS5L)) {
+                       if (features->type >= INTUOS4S && features->type <= INTUOSPL) {
                                input_report_key(input, BTN_LEFT,   data[6] & 0x01);
                                input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
                                input_report_key(input, BTN_RIGHT,  data[6] & 0x04);
@@ -797,7 +821,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
                                }
                        }
                } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
-                               features->type == INTUOS4L || features->type == INTUOS5L) &&
+                               features->type == INTUOS4L || features->type == INTUOS5L ||
+                               features->type == INTUOSPL) &&
                           wacom->tool[idx] == BTN_TOOL_LENS) {
                        /* Lens cursor packets */
                        input_report_key(input, BTN_LEFT,   data[8] & 0x01);
@@ -1107,6 +1132,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
 
 static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 {
+       struct wacom_features *features = &wacom->features;
        struct input_dev *input = wacom->input;
        bool touch = data[1] & 0x80;
        int slot = input_mt_get_slot_by_key(input, data[0]);
@@ -1122,14 +1148,23 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
        if (touch) {
                int x = (data[2] << 4) | (data[4] >> 4);
                int y = (data[3] << 4) | (data[4] & 0x0f);
-               int a = data[5];
+               int width, height;
 
-               // "a" is a scaled-down area which we assume is roughly
-               // circular and which can be described as: a=(pi*r^2)/C.
-               int x_res  = input_abs_get_res(input, ABS_X);
-               int y_res  = input_abs_get_res(input, ABS_Y);
-               int width  = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
-               int height = width * y_res / x_res;
+               if (features->type >= INTUOSPS && features->type <= INTUOSPL) {
+                       width  = data[5];
+                       height = data[6];
+               } else {
+                       /*
+                        * "a" is a scaled-down area which we assume is
+                        * roughly circular and which can be described as:
+                        * a=(pi*r^2)/C.
+                        */
+                       int a = data[5];
+                       int x_res  = input_abs_get_res(input, ABS_X);
+                       int y_res  = input_abs_get_res(input, ABS_Y);
+                       width  = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
+                       height = width * y_res / x_res;
+               }
 
                input_report_abs(input, ABS_MT_POSITION_X, x);
                input_report_abs(input, ABS_MT_POSITION_Y, y);
@@ -1327,6 +1362,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
        case WACOM_22HD:
        case WACOM_24HD:
        case DTK:
+       case CINTIQ_HYBRID:
                sync = wacom_intuos_irq(wacom_wac);
                break;
 
@@ -1337,6 +1373,9 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
        case INTUOS5S:
        case INTUOS5:
        case INTUOS5L:
+       case INTUOSPS:
+       case INTUOSPM:
+       case INTUOSPL:
                if (len == WACOM_PKGLEN_BBTOUCH3)
                        sync = wacom_bpt3_touch(wacom_wac);
                else
@@ -1420,7 +1459,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 
        /* these device have multiple inputs */
        if (features->type >= WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
+           (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
            (features->oVid && features->oPid))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
@@ -1627,6 +1666,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
        case INTUOS5:
        case INTUOS5L:
+       case INTUOSPM:
+       case INTUOSPL:
                if (features->device_type == BTN_TOOL_PEN) {
                        __set_bit(BTN_7, input_dev->keybit);
                        __set_bit(BTN_8, input_dev->keybit);
@@ -1634,6 +1675,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                /* fall through */
 
        case INTUOS5S:
+       case INTUOSPS:
                __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
 
                if (features->device_type == BTN_TOOL_PEN) {
@@ -1765,6 +1807,24 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                                              0, 0);
                }
                break;
+
+       case CINTIQ_HYBRID:
+               __set_bit(BTN_1, input_dev->keybit);
+               __set_bit(BTN_2, input_dev->keybit);
+               __set_bit(BTN_3, input_dev->keybit);
+               __set_bit(BTN_4, input_dev->keybit);
+
+               __set_bit(BTN_5, input_dev->keybit);
+               __set_bit(BTN_6, input_dev->keybit);
+               __set_bit(BTN_7, input_dev->keybit);
+               __set_bit(BTN_8, input_dev->keybit);
+               __set_bit(BTN_0, input_dev->keybit);
+
+               input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
+               __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
+
+               wacom_setup_cintiq(wacom_wac);
+               break;
        }
        return 0;
 }
@@ -1952,6 +2012,18 @@ static const struct wacom_features wacom_features_0x29 =
 static const struct wacom_features wacom_features_0x2A =
        { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS,  44704, 27940, 2047,
          63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
+static const struct wacom_features wacom_features_0x314 =
+       { "Wacom Intuos Pro S", WACOM_PKGLEN_INTUOS,  31496, 19685, 2047,
+         63, INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x315 =
+       { "Wacom Intuos Pro M", WACOM_PKGLEN_INTUOS,  44704, 27940, 2047,
+         63, INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x317 =
+       { "Wacom Intuos Pro L", WACOM_PKGLEN_INTUOS,  65024, 40640, 2047,
+         63, INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+         .touch_max = 16 };
 static const struct wacom_features wacom_features_0xF4 =
        { "Wacom Cintiq 24HD",       WACOM_PKGLEN_INTUOS,   104480, 65600, 2047,
          63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
@@ -2131,6 +2203,13 @@ static const struct wacom_features wacom_features_0x301 =
 static const struct wacom_features wacom_features_0x6004 =
        { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x0307 =
+       { "Wacom ISDv5 307", WACOM_PKGLEN_INTUOS,  59552,  33848, 2047,
+         63, CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+         .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
+static const struct wacom_features wacom_features_0x0309 =
+       { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */
+         .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10 };
 
 #define USB_DEVICE_WACOM(prod)                                 \
        USB_DEVICE(USB_VENDOR_ID_WACOM, prod),                  \
@@ -2259,12 +2338,17 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x300) },
        { USB_DEVICE_WACOM(0x301) },
        { USB_DEVICE_WACOM(0x304) },
+       { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x47) },
        { USB_DEVICE_WACOM(0xF4) },
        { USB_DEVICE_WACOM(0xF8) },
        { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0xFA) },
+       { USB_DEVICE_WACOM(0x0307) },
+       { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_LENOVO(0x6004) },
        { }
 };
index dfc9e08e7f70458c0a41378ae7034a027e52d0ea..fd23a3790605070a41ec37f19eff051b0e89be5a 100644 (file)
@@ -14,6 +14,8 @@
 /* maximum packet length for USB devices */
 #define WACOM_PKGLEN_MAX       64
 
+#define WACOM_NAME_MAX         64
+
 /* packet length for individual models */
 #define WACOM_PKGLEN_PENPRTN    7
 #define WACOM_PKGLEN_GRAPHIRE   8
@@ -76,10 +78,14 @@ enum {
        INTUOS5S,
        INTUOS5,
        INTUOS5L,
+       INTUOSPS,
+       INTUOSPM,
+       INTUOSPL,
        WACOM_21UX2,
        WACOM_22HD,
        DTK,
        WACOM_24HD,
+       CINTIQ_HYBRID,
        CINTIQ,
        WACOM_BEE,
        WACOM_13HD,
@@ -126,7 +132,7 @@ struct wacom_shared {
 };
 
 struct wacom_wac {
-       char name[64];
+       char name[WACOM_NAME_MAX];
        unsigned char *data;
        int tool[2];
        int id[2];
index f3a174a83c82ced113c265ba1b1601774f23e765..69834dd3c313b95dcab54dcd23d51a6730727868 100644 (file)
@@ -806,7 +806,6 @@ err_free_irq:
 err_free_mem:
        input_free_device(input_dev);
        kfree(ts);
-       spi_set_drvdata(spi, NULL);
        return err;
 }
 
@@ -823,7 +822,6 @@ static int ad7877_remove(struct spi_device *spi)
        kfree(ts);
 
        dev_dbg(&spi->dev, "unregistered touchscreen\n");
-       spi_set_drvdata(spi, NULL);
 
        return 0;
 }
index 606da5bd61150958afca42a472c230a6e70ad26e..1a7b1143536e1d4a68dd6fb9e1c85cf992afee04 100644 (file)
@@ -142,7 +142,6 @@ static int ad7879_spi_remove(struct spi_device *spi)
        struct ad7879 *ts = spi_get_drvdata(spi);
 
        ad7879_remove(ts);
-       spi_set_drvdata(spi, NULL);
 
        return 0;
 }
index d038575f49db3a6d70e16ee640fb67cfbcab24be..42d830efa316ec9c44f53306123e0ffb2a2d04b5 100644 (file)
@@ -2113,7 +2113,6 @@ error_startup:
 error_request_irq:
        if (cd->cpdata->init)
                cd->cpdata->init(cd->cpdata, 0, dev);
-       dev_set_drvdata(dev, NULL);
 error_free_xfer:
        kfree(cd->xfer_buf);
 error_free_cd:
@@ -2151,7 +2150,6 @@ int cyttsp4_remove(struct cyttsp4 *cd)
        free_irq(cd->irq, cd);
        if (cd->cpdata->init)
                cd->cpdata->init(cd->cpdata, 0, dev);
-       dev_set_drvdata(dev, NULL);
        cyttsp4_free_si_ptrs(cd);
        kfree(cd);
        return 0;
index ef5fcb0945e910b11918b26159a2860cec2cba2a..054d22583248386a5d392c0df90fed81d950e083 100644 (file)
@@ -273,7 +273,7 @@ static struct i2c_driver egalax_ts_driver = {
                .name   = "egalax_ts",
                .owner  = THIS_MODULE,
                .pm     = &egalax_ts_pm_ops,
-               .of_match_table = of_match_ptr(egalax_ts_dt_ids),
+               .of_match_table = egalax_ts_dt_ids,
        },
        .id_table       = egalax_ts_id,
        .probe          = egalax_ts_probe,
index 66500852341b66319b634133b3f0930f3dc3f2ec..92e2243fb77d9a3b1b3e13316ea38e0072aed7aa 100644 (file)
@@ -186,8 +186,6 @@ static int htcpen_isa_remove(struct device *dev, unsigned int id)
        release_region(HTCPEN_PORT_INIT, 1);
        release_region(HTCPEN_PORT_IRQ_CLEAR, 1);
 
-       dev_set_drvdata(dev, NULL);
-
        return 0;
 }
 
index 1740a2496371d5988d2d550a4312988bafcf850b..2f03b2f289dd365fe3053338d09d049b7d724244 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/pm_qos.h>
 #include <linux/slab.h>
index e1c5300cacfc2044f83175dccffd864a8bd01fbc..df9b24f7e2cb44efdb18e6b57fe4fa68562858b9 100644 (file)
@@ -505,7 +505,7 @@ static struct platform_driver ti_tsc_driver = {
                .name   = "TI-am335x-tsc",
                .owner  = THIS_MODULE,
                .pm     = TITSC_PM_OPS,
-               .of_match_table = of_match_ptr(ti_tsc_dt_ids),
+               .of_match_table = ti_tsc_dt_ids,
        },
 };
 module_platform_driver(ti_tsc_driver);
index 7213e8b07e79bfa48d8b0e5d1f89d5684fee711c..811353353917d2b5f0440b8c5a5f5a704cd6c1e9 100644 (file)
@@ -678,7 +678,6 @@ static int tsc2005_probe(struct spi_device *spi)
 err_remove_sysfs:
        sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
 err_clear_drvdata:
-       spi_set_drvdata(spi, NULL);
        free_irq(spi->irq, ts);
 err_free_mem:
        input_free_device(input_dev);
@@ -696,7 +695,6 @@ static int tsc2005_remove(struct spi_device *spi)
        input_unregister_device(ts->idev);
        kfree(ts);
 
-       spi_set_drvdata(spi, NULL);
        return 0;
 }