aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-core.c3
-rw-r--r--drivers/hid/hid-ids.h8
-rw-r--r--drivers/hid/hid-microsoft.c2
-rw-r--r--drivers/hid/hid-saitek.c2
-rw-r--r--drivers/hid/hid-sensor-hub.c8
-rw-r--r--drivers/hid/hid-sony.c6
-rw-r--r--drivers/hid/hid-tivo.c1
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c7
-rw-r--r--drivers/hid/usbhid/hid-quirks.c3
-rw-r--r--drivers/hid/wacom_wac.c95
-rw-r--r--include/linux/hid-sensor-hub.h5
11 files changed, 97 insertions, 43 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index db4fb6e1cc5b..56ce8c2b5530 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1872 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, 1872 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
1873 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, 1873 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
1874 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, 1874 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
1875 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
1875 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, 1876 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
1876 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1877 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
1877 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, 1878 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
@@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1926#endif 1927#endif
1927#if IS_ENABLED(CONFIG_HID_SAITEK) 1928#if IS_ENABLED(CONFIG_HID_SAITEK)
1928 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, 1929 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
1930 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) },
1929 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, 1931 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
1930 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, 1932 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
1931 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, 1933 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
@@ -1957,6 +1959,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1957 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, 1959 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) },
1958 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, 1960 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
1959 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, 1961 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
1962 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
1960 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1963 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1961 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 1964 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
1962 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1965 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 46edb4d3ed28..7fe5590b328b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -459,6 +459,10 @@
459#define USB_DEVICE_ID_UGCI_FLYING 0x0020 459#define USB_DEVICE_ID_UGCI_FLYING 0x0020
460#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 460#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
461 461
462#define USB_VENDOR_ID_HP 0x03f0
463#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
464#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
465
462#define USB_VENDOR_ID_HUION 0x256c 466#define USB_VENDOR_ID_HUION 0x256c
463#define USB_DEVICE_ID_HUION_TABLET 0x006e 467#define USB_DEVICE_ID_HUION_TABLET 0x006e
464 468
@@ -586,6 +590,7 @@
586#define USB_VENDOR_ID_LOGITECH 0x046d 590#define USB_VENDOR_ID_LOGITECH 0x046d
587#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e 591#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
588#define USB_DEVICE_ID_LOGITECH_T651 0xb00c 592#define USB_DEVICE_ID_LOGITECH_T651 0xb00c
593#define USB_DEVICE_ID_LOGITECH_C077 0xc007
589#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 594#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
590#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 595#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
591#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f 596#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
@@ -654,6 +659,7 @@
654#define USB_DEVICE_ID_MS_LK6K 0x00f9 659#define USB_DEVICE_ID_MS_LK6K 0x00f9
655#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 660#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
656#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 661#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
662#define USB_DEVICE_ID_MS_NE7K 0x071d
657#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 663#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730
658#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c 664#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c
659#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 665#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
@@ -802,6 +808,7 @@
802#define USB_VENDOR_ID_SAITEK 0x06a3 808#define USB_VENDOR_ID_SAITEK 0x06a3
803#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 809#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
804#define USB_DEVICE_ID_SAITEK_PS1000 0x0621 810#define USB_DEVICE_ID_SAITEK_PS1000 0x0621
811#define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb
805#define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 812#define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7
806#define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 813#define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
807 814
@@ -896,6 +903,7 @@
896#define USB_VENDOR_ID_TIVO 0x150a 903#define USB_VENDOR_ID_TIVO 0x150a
897#define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 904#define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200
898#define USB_DEVICE_ID_TIVO_SLIDE 0x1201 905#define USB_DEVICE_ID_TIVO_SLIDE 0x1201
906#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203
899 907
900#define USB_VENDOR_ID_TOPSEED 0x0766 908#define USB_VENDOR_ID_TOPSEED 0x0766
901#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 909#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index fbaea6eb882e..af935eb198c9 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
264 .driver_data = MS_ERGONOMY }, 264 .driver_data = MS_ERGONOMY },
265 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), 265 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
266 .driver_data = MS_ERGONOMY }, 266 .driver_data = MS_ERGONOMY },
267 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
268 .driver_data = MS_ERGONOMY },
267 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), 269 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
268 .driver_data = MS_ERGONOMY | MS_RDESC }, 270 .driver_data = MS_ERGONOMY | MS_RDESC },
269 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), 271 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),
diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c
index 5632c54eadf0..a014f21275d8 100644
--- a/drivers/hid/hid-saitek.c
+++ b/drivers/hid/hid-saitek.c
@@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field,
177static const struct hid_device_id saitek_devices[] = { 177static const struct hid_device_id saitek_devices[] = {
178 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), 178 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000),
179 .driver_data = SAITEK_FIX_PS1000 }, 179 .driver_data = SAITEK_FIX_PS1000 },
180 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD),
181 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
180 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), 182 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
181 .driver_data = SAITEK_RELEASE_MODE_RAT7 }, 183 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
182 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9), 184 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 6a58b6c723aa..e54ce1097e2c 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
135{ 135{
136 struct hid_sensor_hub_callbacks_list *callback; 136 struct hid_sensor_hub_callbacks_list *callback;
137 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); 137 struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
138 unsigned long flags;
138 139
139 spin_lock(&pdata->dyn_callback_lock); 140 spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
140 list_for_each_entry(callback, &pdata->dyn_callback_list, list) 141 list_for_each_entry(callback, &pdata->dyn_callback_list, list)
141 if (callback->usage_id == usage_id && 142 if (callback->usage_id == usage_id &&
142 (collection_index >= 143 (collection_index >=
@@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
145 callback->hsdev->end_collection_index)) { 146 callback->hsdev->end_collection_index)) {
146 *priv = callback->priv; 147 *priv = callback->priv;
147 *hsdev = callback->hsdev; 148 *hsdev = callback->hsdev;
148 spin_unlock(&pdata->dyn_callback_lock); 149 spin_unlock_irqrestore(&pdata->dyn_callback_lock,
150 flags);
149 return callback->usage_callback; 151 return callback->usage_callback;
150 } 152 }
151 spin_unlock(&pdata->dyn_callback_lock); 153 spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
152 154
153 return NULL; 155 return NULL;
154} 156}
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 31e9d2561106..1896c019e302 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -804,7 +804,7 @@ union sixaxis_output_report_01 {
804#define DS4_REPORT_0x81_SIZE 7 804#define DS4_REPORT_0x81_SIZE 7
805#define SIXAXIS_REPORT_0xF2_SIZE 18 805#define SIXAXIS_REPORT_0xF2_SIZE 18
806 806
807static spinlock_t sony_dev_list_lock; 807static DEFINE_SPINLOCK(sony_dev_list_lock);
808static LIST_HEAD(sony_device_list); 808static LIST_HEAD(sony_device_list);
809static DEFINE_IDA(sony_device_id_allocator); 809static DEFINE_IDA(sony_device_id_allocator);
810 810
@@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
1944 return -ENOMEM; 1944 return -ENOMEM;
1945 } 1945 }
1946 1946
1947 spin_lock_init(&sc->lock);
1948
1947 sc->quirks = quirks; 1949 sc->quirks = quirks;
1948 hid_set_drvdata(hdev, sc); 1950 hid_set_drvdata(hdev, sc);
1949 sc->hdev = hdev; 1951 sc->hdev = hdev;
@@ -2147,8 +2149,8 @@ static void __exit sony_exit(void)
2147{ 2149{
2148 dbg_hid("Sony:%s\n", __func__); 2150 dbg_hid("Sony:%s\n", __func__);
2149 2151
2150 ida_destroy(&sony_device_id_allocator);
2151 hid_unregister_driver(&sony_driver); 2152 hid_unregister_driver(&sony_driver);
2153 ida_destroy(&sony_device_id_allocator);
2152} 2154}
2153module_init(sony_init); 2155module_init(sony_init);
2154module_exit(sony_exit); 2156module_exit(sony_exit);
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c
index d790d8d71f7f..d98696927453 100644
--- a/drivers/hid/hid-tivo.c
+++ b/drivers/hid/hid-tivo.c
@@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = {
64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ 64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
65 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, 65 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
67 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
67 { } 68 { }
68}; 69};
69MODULE_DEVICE_TABLE(hid, tivo_devices); 70MODULE_DEVICE_TABLE(hid, tivo_devices);
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index d43e967e7533..36053f33d6d9 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
370static void i2c_hid_get_input(struct i2c_hid *ihid) 370static void i2c_hid_get_input(struct i2c_hid *ihid)
371{ 371{
372 int ret, ret_size; 372 int ret, ret_size;
373 int size = ihid->bufsize; 373 int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
374
375 if (size > ihid->bufsize)
376 size = ihid->bufsize;
374 377
375 ret = i2c_master_recv(ihid->client, ihid->inbuf, size); 378 ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
376 if (ret != size) { 379 if (ret != size) {
@@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client)
785 dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); 788 dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
786 789
787 ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, 790 ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
788 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 791 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
789 client->name, ihid); 792 client->name, ihid);
790 if (ret < 0) { 793 if (ret < 0) {
791 dev_warn(&client->dev, 794 dev_warn(&client->dev,
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 9be99a67bfe2..4e3ae9fbb9b5 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -78,6 +78,9 @@ static const struct hid_blacklist {
78 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 78 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
79 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, 79 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
80 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, 80 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
81 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
82 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
83 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
81 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, 84 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
82 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, 85 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
83 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, 86 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 9406b128a44c..fa0578ecd7a1 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -581,9 +581,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
581 (features->type == CINTIQ && !(data[1] & 0x40))) 581 (features->type == CINTIQ && !(data[1] & 0x40)))
582 return 1; 582 return 1;
583 583
584 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) 584 if (wacom->shared) {
585 wacom->shared->stylus_in_proximity = true; 585 wacom->shared->stylus_in_proximity = true;
586 586
587 if (wacom->shared->touch_down)
588 return 1;
589 }
590
587 /* in Range while exiting */ 591 /* in Range while exiting */
588 if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { 592 if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
589 input_report_key(input, BTN_TOUCH, 0); 593 input_report_key(input, BTN_TOUCH, 0);
@@ -811,6 +815,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
811 input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); 815 input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
812 input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); 816 input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
813 input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); 817 input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
818 if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) {
819 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
820 } else {
821 input_report_abs(input, ABS_MISC, 0);
822 }
814 } else if (features->type == CINTIQ_HYBRID) { 823 } else if (features->type == CINTIQ_HYBRID) {
815 /* 824 /*
816 * Do not send hardware buttons under Android. They 825 * Do not send hardware buttons under Android. They
@@ -1065,27 +1074,28 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
1065 struct input_dev *input = wacom->input; 1074 struct input_dev *input = wacom->input;
1066 unsigned char *data = wacom->data; 1075 unsigned char *data = wacom->data;
1067 int i; 1076 int i;
1068 int current_num_contacts = 0; 1077 int current_num_contacts = data[61];
1069 int contacts_to_send = 0; 1078 int contacts_to_send = 0;
1070 int num_contacts_left = 4; /* maximum contacts per packet */ 1079 int num_contacts_left = 4; /* maximum contacts per packet */
1071 int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; 1080 int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET;
1072 int y_offset = 2; 1081 int y_offset = 2;
1082 static int contact_with_no_pen_down_count = 0;
1073 1083
1074 if (wacom->features.type == WACOM_27QHDT) { 1084 if (wacom->features.type == WACOM_27QHDT) {
1075 current_num_contacts = data[63]; 1085 current_num_contacts = data[63];
1076 num_contacts_left = 10; 1086 num_contacts_left = 10;
1077 byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; 1087 byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET;
1078 y_offset = 0; 1088 y_offset = 0;
1079 } else {
1080 current_num_contacts = data[61];
1081 } 1089 }
1082 1090
1083 /* 1091 /*
1084 * First packet resets the counter since only the first 1092 * First packet resets the counter since only the first
1085 * packet in series will have non-zero current_num_contacts. 1093 * packet in series will have non-zero current_num_contacts.
1086 */ 1094 */
1087 if (current_num_contacts) 1095 if (current_num_contacts) {
1088 wacom->num_contacts_left = current_num_contacts; 1096 wacom->num_contacts_left = current_num_contacts;
1097 contact_with_no_pen_down_count = 0;
1098 }
1089 1099
1090 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); 1100 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
1091 1101
@@ -1118,15 +1128,16 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
1118 input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); 1128 input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h));
1119 input_report_abs(input, ABS_MT_ORIENTATION, w > h); 1129 input_report_abs(input, ABS_MT_ORIENTATION, w > h);
1120 } 1130 }
1131 contact_with_no_pen_down_count++;
1121 } 1132 }
1122 } 1133 }
1123 input_mt_sync_frame(input); 1134 input_mt_sync_frame(input);
1124 1135
1125 wacom->num_contacts_left -= contacts_to_send; 1136 wacom->num_contacts_left -= contacts_to_send;
1126 if (wacom->num_contacts_left <= 0) 1137 if (wacom->num_contacts_left <= 0) {
1127 wacom->num_contacts_left = 0; 1138 wacom->num_contacts_left = 0;
1128 1139 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
1129 wacom->shared->touch_down = (wacom->num_contacts_left > 0); 1140 }
1130 return 1; 1141 return 1;
1131} 1142}
1132 1143
@@ -1138,6 +1149,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
1138 int current_num_contacts = data[2]; 1149 int current_num_contacts = data[2];
1139 int contacts_to_send = 0; 1150 int contacts_to_send = 0;
1140 int x_offset = 0; 1151 int x_offset = 0;
1152 static int contact_with_no_pen_down_count = 0;
1141 1153
1142 /* MTTPC does not support Height and Width */ 1154 /* MTTPC does not support Height and Width */
1143 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) 1155 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
@@ -1147,8 +1159,10 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
1147 * First packet resets the counter since only the first 1159 * First packet resets the counter since only the first
1148 * packet in series will have non-zero current_num_contacts. 1160 * packet in series will have non-zero current_num_contacts.
1149 */ 1161 */
1150 if (current_num_contacts) 1162 if (current_num_contacts) {
1151 wacom->num_contacts_left = current_num_contacts; 1163 wacom->num_contacts_left = current_num_contacts;
1164 contact_with_no_pen_down_count = 0;
1165 }
1152 1166
1153 /* There are at most 5 contacts per packet */ 1167 /* There are at most 5 contacts per packet */
1154 contacts_to_send = min(5, wacom->num_contacts_left); 1168 contacts_to_send = min(5, wacom->num_contacts_left);
@@ -1169,15 +1183,16 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
1169 int y = get_unaligned_le16(&data[offset + x_offset + 9]); 1183 int y = get_unaligned_le16(&data[offset + x_offset + 9]);
1170 input_report_abs(input, ABS_MT_POSITION_X, x); 1184 input_report_abs(input, ABS_MT_POSITION_X, x);
1171 input_report_abs(input, ABS_MT_POSITION_Y, y); 1185 input_report_abs(input, ABS_MT_POSITION_Y, y);
1186 contact_with_no_pen_down_count++;
1172 } 1187 }
1173 } 1188 }
1174 input_mt_sync_frame(input); 1189 input_mt_sync_frame(input);
1175 1190
1176 wacom->num_contacts_left -= contacts_to_send; 1191 wacom->num_contacts_left -= contacts_to_send;
1177 if (wacom->num_contacts_left < 0) 1192 if (wacom->num_contacts_left <= 0) {
1178 wacom->num_contacts_left = 0; 1193 wacom->num_contacts_left = 0;
1179 1194 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
1180 wacom->shared->touch_down = (wacom->num_contacts_left > 0); 1195 }
1181 return 1; 1196 return 1;
1182} 1197}
1183 1198
@@ -1215,29 +1230,25 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
1215{ 1230{
1216 unsigned char *data = wacom->data; 1231 unsigned char *data = wacom->data;
1217 struct input_dev *input = wacom->input; 1232 struct input_dev *input = wacom->input;
1218 bool prox; 1233 bool prox = !wacom->shared->stylus_in_proximity;
1219 int x = 0, y = 0; 1234 int x = 0, y = 0;
1220 1235
1221 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) 1236 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
1222 return 0; 1237 return 0;
1223 1238
1224 if (!wacom->shared->stylus_in_proximity) { 1239 if (len == WACOM_PKGLEN_TPC1FG) {
1225 if (len == WACOM_PKGLEN_TPC1FG) { 1240 prox = prox && (data[0] & 0x01);
1226 prox = data[0] & 0x01; 1241 x = get_unaligned_le16(&data[1]);
1227 x = get_unaligned_le16(&data[1]); 1242 y = get_unaligned_le16(&data[3]);
1228 y = get_unaligned_le16(&data[3]); 1243 } else if (len == WACOM_PKGLEN_TPC1FG_B) {
1229 } else if (len == WACOM_PKGLEN_TPC1FG_B) { 1244 prox = prox && (data[2] & 0x01);
1230 prox = data[2] & 0x01; 1245 x = get_unaligned_le16(&data[3]);
1231 x = get_unaligned_le16(&data[3]); 1246 y = get_unaligned_le16(&data[5]);
1232 y = get_unaligned_le16(&data[5]); 1247 } else {
1233 } else { 1248 prox = prox && (data[1] & 0x01);
1234 prox = data[1] & 0x01; 1249 x = le16_to_cpup((__le16 *)&data[2]);
1235 x = le16_to_cpup((__le16 *)&data[2]); 1250 y = le16_to_cpup((__le16 *)&data[4]);
1236 y = le16_to_cpup((__le16 *)&data[4]); 1251 }
1237 }
1238 } else
1239 /* force touch out when pen is in prox */
1240 prox = 0;
1241 1252
1242 if (prox) { 1253 if (prox) {
1243 input_report_abs(input, ABS_X, x); 1254 input_report_abs(input, ABS_X, x);
@@ -1635,6 +1646,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
1635 struct input_dev *pad_input = wacom->pad_input; 1646 struct input_dev *pad_input = wacom->pad_input;
1636 unsigned char *data = wacom->data; 1647 unsigned char *data = wacom->data;
1637 int i; 1648 int i;
1649 int contact_with_no_pen_down_count = 0;
1638 1650
1639 if (data[0] != 0x02) 1651 if (data[0] != 0x02)
1640 return 0; 1652 return 0;
@@ -1662,6 +1674,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
1662 } 1674 }
1663 input_report_abs(input, ABS_MT_POSITION_X, x); 1675 input_report_abs(input, ABS_MT_POSITION_X, x);
1664 input_report_abs(input, ABS_MT_POSITION_Y, y); 1676 input_report_abs(input, ABS_MT_POSITION_Y, y);
1677 contact_with_no_pen_down_count++;
1665 } 1678 }
1666 } 1679 }
1667 1680
@@ -1671,11 +1684,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
1671 input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); 1684 input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0);
1672 input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); 1685 input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0);
1673 input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); 1686 input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0);
1687 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
1674 1688
1675 return 1; 1689 return 1;
1676} 1690}
1677 1691
1678static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) 1692static int wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data, int last_touch_count)
1679{ 1693{
1680 struct wacom_features *features = &wacom->features; 1694 struct wacom_features *features = &wacom->features;
1681 struct input_dev *input = wacom->input; 1695 struct input_dev *input = wacom->input;
@@ -1683,7 +1697,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
1683 int slot = input_mt_get_slot_by_key(input, data[0]); 1697 int slot = input_mt_get_slot_by_key(input, data[0]);
1684 1698
1685 if (slot < 0) 1699 if (slot < 0)
1686 return; 1700 return 0;
1687 1701
1688 touch = touch && !wacom->shared->stylus_in_proximity; 1702 touch = touch && !wacom->shared->stylus_in_proximity;
1689 1703
@@ -1715,7 +1729,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
1715 input_report_abs(input, ABS_MT_POSITION_Y, y); 1729 input_report_abs(input, ABS_MT_POSITION_Y, y);
1716 input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); 1730 input_report_abs(input, ABS_MT_TOUCH_MAJOR, width);
1717 input_report_abs(input, ABS_MT_TOUCH_MINOR, height); 1731 input_report_abs(input, ABS_MT_TOUCH_MINOR, height);
1732 last_touch_count++;
1718 } 1733 }
1734 return last_touch_count;
1719} 1735}
1720 1736
1721static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) 1737static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
@@ -1740,6 +1756,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
1740 unsigned char *data = wacom->data; 1756 unsigned char *data = wacom->data;
1741 int count = data[1] & 0x07; 1757 int count = data[1] & 0x07;
1742 int i; 1758 int i;
1759 int contact_with_no_pen_down_count = 0;
1743 1760
1744 if (data[0] != 0x02) 1761 if (data[0] != 0x02)
1745 return 0; 1762 return 0;
@@ -1750,12 +1767,15 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
1750 int msg_id = data[offset]; 1767 int msg_id = data[offset];
1751 1768
1752 if (msg_id >= 2 && msg_id <= 17) 1769 if (msg_id >= 2 && msg_id <= 17)
1753 wacom_bpt3_touch_msg(wacom, data + offset); 1770 contact_with_no_pen_down_count =
1771 wacom_bpt3_touch_msg(wacom, data + offset,
1772 contact_with_no_pen_down_count);
1754 else if (msg_id == 128) 1773 else if (msg_id == 128)
1755 wacom_bpt3_button_msg(wacom, data + offset); 1774 wacom_bpt3_button_msg(wacom, data + offset);
1756 1775
1757 } 1776 }
1758 input_mt_sync_frame(input); 1777 input_mt_sync_frame(input);
1778 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
1759 1779
1760 return 1; 1780 return 1;
1761} 1781}
@@ -1770,6 +1790,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
1770 if (data[0] != WACOM_REPORT_PENABLED) 1790 if (data[0] != WACOM_REPORT_PENABLED)
1771 return 0; 1791 return 0;
1772 1792
1793 if (wacom->shared->touch_down)
1794 return 0;
1795
1773 prox = (data[1] & 0x20) == 0x20; 1796 prox = (data[1] & 0x20) == 0x20;
1774 1797
1775 /* 1798 /*
@@ -2875,9 +2898,9 @@ static const struct wacom_features wacom_features_0xF6 =
2875 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, 2898 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
2876 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 2899 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
2877static const struct wacom_features wacom_features_0x32A = 2900static const struct wacom_features wacom_features_0x32A =
2878 { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 2901 { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63,
2879 63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2902 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2880 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2903 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2881static const struct wacom_features wacom_features_0x32B = 2904static const struct wacom_features wacom_features_0x32B =
2882 { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, 2905 { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63,
2883 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2906 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 51f7ccadf923..4173a8fdad9e 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -33,6 +33,8 @@
33 * @units: Measurment unit for this attribute. 33 * @units: Measurment unit for this attribute.
34 * @unit_expo: Exponent used in the data. 34 * @unit_expo: Exponent used in the data.
35 * @size: Size in bytes for data size. 35 * @size: Size in bytes for data size.
36 * @logical_minimum: Logical minimum value for this attribute.
37 * @logical_maximum: Logical maximum value for this attribute.
36 */ 38 */
37struct hid_sensor_hub_attribute_info { 39struct hid_sensor_hub_attribute_info {
38 u32 usage_id; 40 u32 usage_id;
@@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
146 148
147/** 149/**
148* sensor_hub_input_attr_get_raw_value() - Synchronous read request 150* sensor_hub_input_attr_get_raw_value() - Synchronous read request
151* @hsdev: Hub device instance.
149* @usage_id: Attribute usage id of parent physical device as per spec 152* @usage_id: Attribute usage id of parent physical device as per spec
150* @attr_usage_id: Attribute usage id as per spec 153* @attr_usage_id: Attribute usage id as per spec
151* @report_id: Report id to look for 154* @report_id: Report id to look for
@@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
160 u32 attr_usage_id, u32 report_id); 163 u32 attr_usage_id, u32 report_id);
161/** 164/**
162* sensor_hub_set_feature() - Feature set request 165* sensor_hub_set_feature() - Feature set request
166* @hsdev: Hub device instance.
163* @report_id: Report id to look for 167* @report_id: Report id to look for
164* @field_index: Field index inside a report 168* @field_index: Field index inside a report
165* @value: Value to set 169* @value: Value to set
@@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
172 176
173/** 177/**
174* sensor_hub_get_feature() - Feature get request 178* sensor_hub_get_feature() - Feature get request
179* @hsdev: Hub device instance.
175* @report_id: Report id to look for 180* @report_id: Report id to look for
176* @field_index: Field index inside a report 181* @field_index: Field index inside a report
177* @value: Place holder for return value 182* @value: Place holder for return value