aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/Kconfig5
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-cp2112.c10
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/hid-input.c9
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c7
-rw-r--r--include/linux/hid.h1
7 files changed, 29 insertions, 8 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 374301fcbc86..779c5ae47f36 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -230,7 +230,7 @@ config HID_CMEDIA
230 230
231config HID_CP2112 231config HID_CP2112
232 tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support" 232 tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support"
233 depends on USB_HID && I2C && GPIOLIB 233 depends on USB_HID && HIDRAW && I2C && GPIOLIB
234 select GPIOLIB_IRQCHIP 234 select GPIOLIB_IRQCHIP
235 ---help--- 235 ---help---
236 Support for Silicon Labs CP2112 HID USB to SMBus Master Bridge. 236 Support for Silicon Labs CP2112 HID USB to SMBus Master Bridge.
@@ -750,11 +750,10 @@ config HID_PRIMAX
750 HID standard. 750 HID standard.
751 751
752config HID_RETRODE 752config HID_RETRODE
753 tristate "Retrode" 753 tristate "Retrode 2 USB adapter for vintage video games"
754 depends on USB_HID 754 depends on USB_HID
755 ---help--- 755 ---help---
756 Support for 756 Support for
757
758 * Retrode 2 cartridge and controller adapter 757 * Retrode 2 cartridge and controller adapter
759 758
760config HID_ROCCAT 759config HID_ROCCAT
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d3f983a4245a..f3fcb836a1f9 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1662,7 +1662,7 @@ static struct bin_attribute dev_bin_attr_report_desc = {
1662 .size = HID_MAX_DESCRIPTOR_SIZE, 1662 .size = HID_MAX_DESCRIPTOR_SIZE,
1663}; 1663};
1664 1664
1665static struct device_attribute dev_attr_country = { 1665static const struct device_attribute dev_attr_country = {
1666 .attr = { .name = "country", .mode = 0444 }, 1666 .attr = { .name = "country", .mode = 0444 },
1667 .show = show_country, 1667 .show = show_country,
1668}; 1668};
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 078026f63b6f..68cdc962265b 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -21,7 +21,7 @@
21 * Data Sheet: 21 * Data Sheet:
22 * http://www.silabs.com/Support%20Documents/TechnicalDocs/CP2112.pdf 22 * http://www.silabs.com/Support%20Documents/TechnicalDocs/CP2112.pdf
23 * Programming Interface Specification: 23 * Programming Interface Specification:
24 * http://www.silabs.com/Support%20Documents/TechnicalDocs/AN495.pdf 24 * https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
25 */ 25 */
26 26
27#include <linux/gpio.h> 27#include <linux/gpio.h>
@@ -196,6 +196,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
196 HID_REQ_GET_REPORT); 196 HID_REQ_GET_REPORT);
197 if (ret != CP2112_GPIO_CONFIG_LENGTH) { 197 if (ret != CP2112_GPIO_CONFIG_LENGTH) {
198 hid_err(hdev, "error requesting GPIO config: %d\n", ret); 198 hid_err(hdev, "error requesting GPIO config: %d\n", ret);
199 if (ret >= 0)
200 ret = -EIO;
199 goto exit; 201 goto exit;
200 } 202 }
201 203
@@ -205,8 +207,10 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
205 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, 207 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
206 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, 208 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
207 HID_REQ_SET_REPORT); 209 HID_REQ_SET_REPORT);
208 if (ret < 0) { 210 if (ret != CP2112_GPIO_CONFIG_LENGTH) {
209 hid_err(hdev, "error setting GPIO config: %d\n", ret); 211 hid_err(hdev, "error setting GPIO config: %d\n", ret);
212 if (ret >= 0)
213 ret = -EIO;
210 goto exit; 214 goto exit;
211 } 215 }
212 216
@@ -214,7 +218,7 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
214 218
215exit: 219exit:
216 mutex_unlock(&dev->lock); 220 mutex_unlock(&dev->lock);
217 return ret < 0 ? ret : -EIO; 221 return ret;
218} 222}
219 223
220static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 224static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c9f7c74b3b60..5da3d6256d25 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -513,6 +513,9 @@
513#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 513#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003
514#define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008 514#define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008
515 515
516#define I2C_VENDOR_ID_HANTICK 0x0911
517#define I2C_PRODUCT_ID_HANTICK_5288 0x5288
518
516#define USB_VENDOR_ID_HANWANG 0x0b57 519#define USB_VENDOR_ID_HANWANG 0x0b57
517#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 520#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000
518#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff 521#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 199f6a01fc62..04d01b57d94c 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -797,6 +797,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
797 map_key_clear(BTN_STYLUS); 797 map_key_clear(BTN_STYLUS);
798 break; 798 break;
799 799
800 case 0x45: /* ERASER */
801 /*
802 * This event is reported when eraser tip touches the surface.
803 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when
804 * tool gets in proximity.
805 */
806 map_key_clear(BTN_TOUCH);
807 break;
808
800 case 0x46: /* TabletPick */ 809 case 0x46: /* TabletPick */
801 case 0x5a: /* SecondaryBarrelSwitch */ 810 case 0x5a: /* SecondaryBarrelSwitch */
802 map_key_clear(BTN_STYLUS2); 811 map_key_clear(BTN_STYLUS2);
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 9145c2129a96..e054ee43c1e2 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -46,6 +46,7 @@
46 46
47/* quirks to control the device */ 47/* quirks to control the device */
48#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) 48#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
49#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
49 50
50/* flags */ 51/* flags */
51#define I2C_HID_STARTED 0 52#define I2C_HID_STARTED 0
@@ -168,6 +169,8 @@ static const struct i2c_hid_quirks {
168 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, 169 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
169 { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755, 170 { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,
170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, 171 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
172 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
173 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
171 { 0, 0 } 174 { 0, 0 }
172}; 175};
173 176
@@ -252,7 +255,9 @@ static int __i2c_hid_command(struct i2c_client *client,
252 255
253 ret = 0; 256 ret = 0;
254 257
255 if (wait) { 258 if (wait && (ihid->quirks & I2C_HID_QUIRK_NO_IRQ_AFTER_RESET)) {
259 msleep(100);
260 } else if (wait) {
256 i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); 261 i2c_hid_dbg(ihid, "%s: waiting...\n", __func__);
257 if (!wait_event_timeout(ihid->wait, 262 if (!wait_event_timeout(ihid->wait,
258 !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), 263 !test_bit(I2C_HID_RESET_PENDING, &ihid->flags),
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 47dd962d9a7a..d491027a7c22 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -754,6 +754,7 @@ struct hid_driver {
754 * @stop: called on remove 754 * @stop: called on remove
755 * @open: called by input layer on open 755 * @open: called by input layer on open
756 * @close: called by input layer on close 756 * @close: called by input layer on close
757 * @power: request underlying hardware to enter requested power mode
757 * @parse: this method is called only once to parse the device data, 758 * @parse: this method is called only once to parse the device data,
758 * shouldn't allocate anything to not leak memory 759 * shouldn't allocate anything to not leak memory
759 * @request: send report request to device (e.g. feature report) 760 * @request: send report request to device (e.g. feature report)