diff options
| -rw-r--r-- | drivers/hid/hid-cp2112.c | 28 | ||||
| -rw-r--r-- | drivers/hid/hid-ids.h | 3 | ||||
| -rw-r--r-- | drivers/hid/hid-lg.c | 2 | ||||
| -rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 1 | ||||
| -rw-r--r-- | drivers/hid/wacom_wac.c | 28 |
5 files changed, 32 insertions, 30 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index f31a778b0851..b22d0f83f8e3 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c | |||
| @@ -168,7 +168,7 @@ struct cp2112_device { | |||
| 168 | atomic_t xfer_avail; | 168 | atomic_t xfer_avail; |
| 169 | struct gpio_chip gc; | 169 | struct gpio_chip gc; |
| 170 | u8 *in_out_buffer; | 170 | u8 *in_out_buffer; |
| 171 | spinlock_t lock; | 171 | struct mutex lock; |
| 172 | 172 | ||
| 173 | struct gpio_desc *desc[8]; | 173 | struct gpio_desc *desc[8]; |
| 174 | bool gpio_poll; | 174 | bool gpio_poll; |
| @@ -186,10 +186,9 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
| 186 | struct cp2112_device *dev = gpiochip_get_data(chip); | 186 | struct cp2112_device *dev = gpiochip_get_data(chip); |
| 187 | struct hid_device *hdev = dev->hdev; | 187 | struct hid_device *hdev = dev->hdev; |
| 188 | u8 *buf = dev->in_out_buffer; | 188 | u8 *buf = dev->in_out_buffer; |
| 189 | unsigned long flags; | ||
| 190 | int ret; | 189 | int ret; |
| 191 | 190 | ||
| 192 | spin_lock_irqsave(&dev->lock, flags); | 191 | mutex_lock(&dev->lock); |
| 193 | 192 | ||
| 194 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, | 193 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
| 195 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, | 194 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
| @@ -213,8 +212,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
| 213 | ret = 0; | 212 | ret = 0; |
| 214 | 213 | ||
| 215 | exit: | 214 | exit: |
| 216 | spin_unlock_irqrestore(&dev->lock, flags); | 215 | mutex_unlock(&dev->lock); |
| 217 | return ret <= 0 ? ret : -EIO; | 216 | return ret < 0 ? ret : -EIO; |
| 218 | } | 217 | } |
| 219 | 218 | ||
| 220 | static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 219 | static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
| @@ -222,10 +221,9 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
| 222 | struct cp2112_device *dev = gpiochip_get_data(chip); | 221 | struct cp2112_device *dev = gpiochip_get_data(chip); |
| 223 | struct hid_device *hdev = dev->hdev; | 222 | struct hid_device *hdev = dev->hdev; |
| 224 | u8 *buf = dev->in_out_buffer; | 223 | u8 *buf = dev->in_out_buffer; |
| 225 | unsigned long flags; | ||
| 226 | int ret; | 224 | int ret; |
| 227 | 225 | ||
| 228 | spin_lock_irqsave(&dev->lock, flags); | 226 | mutex_lock(&dev->lock); |
| 229 | 227 | ||
| 230 | buf[0] = CP2112_GPIO_SET; | 228 | buf[0] = CP2112_GPIO_SET; |
| 231 | buf[1] = value ? 0xff : 0; | 229 | buf[1] = value ? 0xff : 0; |
| @@ -237,7 +235,7 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
| 237 | if (ret < 0) | 235 | if (ret < 0) |
| 238 | hid_err(hdev, "error setting GPIO values: %d\n", ret); | 236 | hid_err(hdev, "error setting GPIO values: %d\n", ret); |
| 239 | 237 | ||
| 240 | spin_unlock_irqrestore(&dev->lock, flags); | 238 | mutex_unlock(&dev->lock); |
| 241 | } | 239 | } |
| 242 | 240 | ||
| 243 | static int cp2112_gpio_get_all(struct gpio_chip *chip) | 241 | static int cp2112_gpio_get_all(struct gpio_chip *chip) |
| @@ -245,10 +243,9 @@ static int cp2112_gpio_get_all(struct gpio_chip *chip) | |||
| 245 | struct cp2112_device *dev = gpiochip_get_data(chip); | 243 | struct cp2112_device *dev = gpiochip_get_data(chip); |
| 246 | struct hid_device *hdev = dev->hdev; | 244 | struct hid_device *hdev = dev->hdev; |
| 247 | u8 *buf = dev->in_out_buffer; | 245 | u8 *buf = dev->in_out_buffer; |
| 248 | unsigned long flags; | ||
| 249 | int ret; | 246 | int ret; |
| 250 | 247 | ||
| 251 | spin_lock_irqsave(&dev->lock, flags); | 248 | mutex_lock(&dev->lock); |
| 252 | 249 | ||
| 253 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, | 250 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, |
| 254 | CP2112_GPIO_GET_LENGTH, HID_FEATURE_REPORT, | 251 | CP2112_GPIO_GET_LENGTH, HID_FEATURE_REPORT, |
| @@ -262,7 +259,7 @@ static int cp2112_gpio_get_all(struct gpio_chip *chip) | |||
| 262 | ret = buf[1]; | 259 | ret = buf[1]; |
| 263 | 260 | ||
| 264 | exit: | 261 | exit: |
| 265 | spin_unlock_irqrestore(&dev->lock, flags); | 262 | mutex_unlock(&dev->lock); |
| 266 | 263 | ||
| 267 | return ret; | 264 | return ret; |
| 268 | } | 265 | } |
| @@ -284,10 +281,9 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, | |||
| 284 | struct cp2112_device *dev = gpiochip_get_data(chip); | 281 | struct cp2112_device *dev = gpiochip_get_data(chip); |
| 285 | struct hid_device *hdev = dev->hdev; | 282 | struct hid_device *hdev = dev->hdev; |
| 286 | u8 *buf = dev->in_out_buffer; | 283 | u8 *buf = dev->in_out_buffer; |
| 287 | unsigned long flags; | ||
| 288 | int ret; | 284 | int ret; |
| 289 | 285 | ||
| 290 | spin_lock_irqsave(&dev->lock, flags); | 286 | mutex_lock(&dev->lock); |
| 291 | 287 | ||
| 292 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, | 288 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
| 293 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, | 289 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
| @@ -308,7 +304,7 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, | |||
| 308 | goto fail; | 304 | goto fail; |
| 309 | } | 305 | } |
| 310 | 306 | ||
| 311 | spin_unlock_irqrestore(&dev->lock, flags); | 307 | mutex_unlock(&dev->lock); |
| 312 | 308 | ||
| 313 | /* | 309 | /* |
| 314 | * Set gpio value when output direction is already set, | 310 | * Set gpio value when output direction is already set, |
| @@ -319,7 +315,7 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, | |||
| 319 | return 0; | 315 | return 0; |
| 320 | 316 | ||
| 321 | fail: | 317 | fail: |
| 322 | spin_unlock_irqrestore(&dev->lock, flags); | 318 | mutex_unlock(&dev->lock); |
| 323 | return ret < 0 ? ret : -EIO; | 319 | return ret < 0 ? ret : -EIO; |
| 324 | } | 320 | } |
| 325 | 321 | ||
| @@ -1235,7 +1231,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 1235 | if (!dev->in_out_buffer) | 1231 | if (!dev->in_out_buffer) |
| 1236 | return -ENOMEM; | 1232 | return -ENOMEM; |
| 1237 | 1233 | ||
| 1238 | spin_lock_init(&dev->lock); | 1234 | mutex_init(&dev->lock); |
| 1239 | 1235 | ||
| 1240 | ret = hid_parse(hdev); | 1236 | ret = hid_parse(hdev); |
| 1241 | if (ret) { | 1237 | if (ret) { |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index f46f2c5117fa..350accfee8e8 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -76,6 +76,9 @@ | |||
| 76 | #define USB_VENDOR_ID_ALPS_JP 0x044E | 76 | #define USB_VENDOR_ID_ALPS_JP 0x044E |
| 77 | #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B | 77 | #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B |
| 78 | 78 | ||
| 79 | #define USB_VENDOR_ID_AMI 0x046b | ||
| 80 | #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10 | ||
| 81 | |||
| 79 | #define USB_VENDOR_ID_ANTON 0x1130 | 82 | #define USB_VENDOR_ID_ANTON 0x1130 |
| 80 | #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 | 83 | #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 |
| 81 | 84 | ||
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index c5c5fbe9d605..52026dc94d5c 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
| @@ -872,7 +872,7 @@ static const struct hid_device_id lg_devices[] = { | |||
| 872 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), | 872 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), |
| 873 | .driver_data = LG_NOGET | LG_FF4 }, | 873 | .driver_data = LG_NOGET | LG_FF4 }, |
| 874 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), | 874 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), |
| 875 | .driver_data = LG_FF2 }, | 875 | .driver_data = LG_NOGET | LG_FF2 }, |
| 876 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), | 876 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), |
| 877 | .driver_data = LG_FF3 }, | 877 | .driver_data = LG_FF3 }, |
| 878 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), | 878 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index e9d6cc7cdfc5..30a2977e2645 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -57,6 +57,7 @@ static const struct hid_blacklist { | |||
| 57 | { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, | 57 | { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, |
| 58 | { USB_VENDOR_ID_AKAI, USB_DEVICE_ID_AKAI_MPKMINI2, HID_QUIRK_NO_INIT_REPORTS }, | 58 | { USB_VENDOR_ID_AKAI, USB_DEVICE_ID_AKAI_MPKMINI2, HID_QUIRK_NO_INIT_REPORTS }, |
| 59 | { USB_VENDOR_ID_AKAI_09E8, USB_DEVICE_ID_AKAI_09E8_MIDIMIX, HID_QUIRK_NO_INIT_REPORTS }, | 59 | { USB_VENDOR_ID_AKAI_09E8, USB_DEVICE_ID_AKAI_09E8_MIDIMIX, HID_QUIRK_NO_INIT_REPORTS }, |
| 60 | { USB_VENDOR_ID_AMI, USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE, HID_QUIRK_ALWAYS_POLL }, | ||
| 60 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, |
| 61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, | 62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, |
| 62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 0884dc9554fd..672145b0d8f5 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
| @@ -166,19 +166,21 @@ static int wacom_pl_irq(struct wacom_wac *wacom) | |||
| 166 | wacom->id[0] = STYLUS_DEVICE_ID; | 166 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | 169 | if (prox) { |
| 170 | if (features->pressure_max > 255) | 170 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
| 171 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); | 171 | if (features->pressure_max > 255) |
| 172 | pressure += (features->pressure_max + 1) / 2; | 172 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
| 173 | 173 | pressure += (features->pressure_max + 1) / 2; | |
| 174 | input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | 174 | |
| 175 | input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | 175 | input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
| 176 | input_report_abs(input, ABS_PRESSURE, pressure); | 176 | input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
| 177 | 177 | input_report_abs(input, ABS_PRESSURE, pressure); | |
| 178 | input_report_key(input, BTN_TOUCH, data[4] & 0x08); | 178 | |
| 179 | input_report_key(input, BTN_STYLUS, data[4] & 0x10); | 179 | input_report_key(input, BTN_TOUCH, data[4] & 0x08); |
| 180 | /* Only allow the stylus2 button to be reported for the pen tool. */ | 180 | input_report_key(input, BTN_STYLUS, data[4] & 0x10); |
| 181 | input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); | 181 | /* Only allow the stylus2 button to be reported for the pen tool. */ |
| 182 | input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); | ||
| 183 | } | ||
| 182 | 184 | ||
| 183 | if (!prox) | 185 | if (!prox) |
| 184 | wacom->id[0] = 0; | 186 | wacom->id[0] = 0; |
