diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2014-04-01 12:45:27 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-04-01 12:45:27 -0400 |
| commit | b95dd3ca034a044471242fcbc8b8256f272b5062 (patch) | |
| tree | 32a59028a1823e89214fce3149e80d65a0dda778 | |
| parent | 2078b9bb240ea31ff3ea715881d1ec03d83e6de4 (diff) | |
| parent | c3d77fab51f40821de91a744e4b514e9e4e76a7c (diff) | |
Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-3.15/sony
| -rw-r--r-- | Documentation/hid/hid-transport.txt | 3 | ||||
| -rw-r--r-- | drivers/hid/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/hid/Makefile | 1 | ||||
| -rw-r--r-- | drivers/hid/hid-core.c | 51 | ||||
| -rw-r--r-- | drivers/hid/hid-cp2112.c | 1073 | ||||
| -rw-r--r-- | drivers/hid/hid-hyperv.c | 10 | ||||
| -rw-r--r-- | drivers/hid/hid-ids.h | 1 | ||||
| -rw-r--r-- | drivers/hid/hid-input.c | 10 | ||||
| -rw-r--r-- | drivers/hid/hid-lg.c | 8 | ||||
| -rw-r--r-- | drivers/hid/hid-logitech-dj.c | 21 | ||||
| -rw-r--r-- | drivers/hid/hid-magicmouse.c | 4 | ||||
| -rw-r--r-- | drivers/hid/hid-sony.c | 64 | ||||
| -rw-r--r-- | drivers/hid/hid-thingm.c | 4 | ||||
| -rw-r--r-- | drivers/hid/hid-wacom.c | 26 | ||||
| -rw-r--r-- | drivers/hid/hid-wiimote-core.c | 4 | ||||
| -rw-r--r-- | drivers/hid/hidraw.c | 20 | ||||
| -rw-r--r-- | drivers/hid/i2c-hid/i2c-hid.c | 70 | ||||
| -rw-r--r-- | drivers/hid/uhid.c | 37 | ||||
| -rw-r--r-- | drivers/hid/usbhid/hid-core.c | 21 | ||||
| -rw-r--r-- | include/linux/hid.h | 37 | ||||
| -rw-r--r-- | net/bluetooth/hidp/core.c | 14 |
21 files changed, 1288 insertions, 200 deletions
diff --git a/Documentation/hid/hid-transport.txt b/Documentation/hid/hid-transport.txt index 9dbbceaef4f3..3dcba9fd4a3a 100644 --- a/Documentation/hid/hid-transport.txt +++ b/Documentation/hid/hid-transport.txt | |||
| @@ -283,7 +283,8 @@ The available HID callbacks are: | |||
| 283 | int reqtype) | 283 | int reqtype) |
| 284 | Same as ->request() but provides the report as raw buffer. This request shall | 284 | Same as ->request() but provides the report as raw buffer. This request shall |
| 285 | be synchronous. A transport driver must not use ->wait() to complete such | 285 | be synchronous. A transport driver must not use ->wait() to complete such |
| 286 | requests. | 286 | requests. This request is mandatory and hid core will reject the device if |
| 287 | it is missing. | ||
| 287 | 288 | ||
| 288 | - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) | 289 | - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) |
| 289 | Send raw output report via intr channel. Used by some HID device drivers | 290 | Send raw output report via intr channel. Used by some HID device drivers |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 0c3de7ae6946..7af9d0b5dea1 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -175,6 +175,15 @@ config HID_PRODIKEYS | |||
| 175 | multimedia keyboard, but will lack support for the musical keyboard | 175 | multimedia keyboard, but will lack support for the musical keyboard |
| 176 | and some additional multimedia keys. | 176 | and some additional multimedia keys. |
| 177 | 177 | ||
| 178 | config HID_CP2112 | ||
| 179 | tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support" | ||
| 180 | depends on USB_HID && I2C && GPIOLIB | ||
| 181 | ---help--- | ||
| 182 | Support for Silicon Labs CP2112 HID USB to SMBus Master Bridge. | ||
| 183 | This is a HID device driver which registers as an i2c adapter | ||
| 184 | and gpiochip to expose these functions of the CP2112. The | ||
| 185 | customizable USB descriptor fields are exposed as sysfs attributes. | ||
| 186 | |||
| 178 | config HID_CYPRESS | 187 | config HID_CYPRESS |
| 179 | tristate "Cypress mouse and barcode readers" if EXPERT | 188 | tristate "Cypress mouse and barcode readers" if EXPERT |
| 180 | depends on HID | 189 | depends on HID |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 30e44318f87f..fc712dde02a4 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
| @@ -41,6 +41,7 @@ obj-$(CONFIG_HID_AUREAL) += hid-aureal.o | |||
| 41 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o | 41 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o |
| 42 | obj-$(CONFIG_HID_CHERRY) += hid-cherry.o | 42 | obj-$(CONFIG_HID_CHERRY) += hid-cherry.o |
| 43 | obj-$(CONFIG_HID_CHICONY) += hid-chicony.o | 43 | obj-$(CONFIG_HID_CHICONY) += hid-chicony.o |
| 44 | obj-$(CONFIG_HID_CP2112) += hid-cp2112.o | ||
| 44 | obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o | 45 | obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o |
| 45 | obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o | 46 | obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o |
| 46 | obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o | 47 | obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 026ab0fc06f7..ddb981db08bd 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1248,6 +1248,11 @@ void hid_output_report(struct hid_report *report, __u8 *data) | |||
| 1248 | } | 1248 | } |
| 1249 | EXPORT_SYMBOL_GPL(hid_output_report); | 1249 | EXPORT_SYMBOL_GPL(hid_output_report); |
| 1250 | 1250 | ||
| 1251 | static int hid_report_len(struct hid_report *report) | ||
| 1252 | { | ||
| 1253 | return ((report->size - 1) >> 3) + 1 + (report->id > 0) + 7; | ||
| 1254 | } | ||
| 1255 | |||
| 1251 | /* | 1256 | /* |
| 1252 | * Allocator for buffer that is going to be passed to hid_output_report() | 1257 | * Allocator for buffer that is going to be passed to hid_output_report() |
| 1253 | */ | 1258 | */ |
| @@ -1258,7 +1263,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) | |||
| 1258 | * of implement() working on 8 byte chunks | 1263 | * of implement() working on 8 byte chunks |
| 1259 | */ | 1264 | */ |
| 1260 | 1265 | ||
| 1261 | int len = ((report->size - 1) >> 3) + 1 + (report->id > 0) + 7; | 1266 | int len = hid_report_len(report); |
| 1262 | 1267 | ||
| 1263 | return kmalloc(len, flags); | 1268 | return kmalloc(len, flags); |
| 1264 | } | 1269 | } |
| @@ -1314,6 +1319,41 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, | |||
| 1314 | return report; | 1319 | return report; |
| 1315 | } | 1320 | } |
| 1316 | 1321 | ||
| 1322 | /* | ||
| 1323 | * Implement a generic .request() callback, using .raw_request() | ||
| 1324 | * DO NOT USE in hid drivers directly, but through hid_hw_request instead. | ||
| 1325 | */ | ||
| 1326 | void __hid_request(struct hid_device *hid, struct hid_report *report, | ||
| 1327 | int reqtype) | ||
| 1328 | { | ||
| 1329 | char *buf; | ||
| 1330 | int ret; | ||
| 1331 | int len; | ||
| 1332 | |||
| 1333 | buf = hid_alloc_report_buf(report, GFP_KERNEL); | ||
| 1334 | if (!buf) | ||
| 1335 | return; | ||
| 1336 | |||
| 1337 | len = hid_report_len(report); | ||
| 1338 | |||
| 1339 | if (reqtype == HID_REQ_SET_REPORT) | ||
| 1340 | hid_output_report(report, buf); | ||
| 1341 | |||
| 1342 | ret = hid->ll_driver->raw_request(hid, report->id, buf, len, | ||
| 1343 | report->type, reqtype); | ||
| 1344 | if (ret < 0) { | ||
| 1345 | dbg_hid("unable to complete request: %d\n", ret); | ||
| 1346 | goto out; | ||
| 1347 | } | ||
| 1348 | |||
| 1349 | if (reqtype == HID_REQ_GET_REPORT) | ||
| 1350 | hid_input_report(hid, report->type, buf, ret, 0); | ||
| 1351 | |||
| 1352 | out: | ||
| 1353 | kfree(buf); | ||
| 1354 | } | ||
| 1355 | EXPORT_SYMBOL_GPL(__hid_request); | ||
| 1356 | |||
| 1317 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 1357 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
| 1318 | int interrupt) | 1358 | int interrupt) |
| 1319 | { | 1359 | { |
| @@ -1692,6 +1732,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1692 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, | 1732 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
| 1693 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, | 1733 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
| 1694 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | 1734 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
| 1735 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, | ||
| 1695 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | 1736 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
| 1696 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, | 1737 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
| 1697 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, | 1738 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
| @@ -2429,6 +2470,14 @@ int hid_add_device(struct hid_device *hdev) | |||
| 2429 | return -ENODEV; | 2470 | return -ENODEV; |
| 2430 | 2471 | ||
| 2431 | /* | 2472 | /* |
| 2473 | * Check for the mandatory transport channel. | ||
| 2474 | */ | ||
| 2475 | if (!hdev->ll_driver->raw_request) { | ||
| 2476 | hid_err(hdev, "transport driver missing .raw_request()\n"); | ||
| 2477 | return -EINVAL; | ||
| 2478 | } | ||
| 2479 | |||
| 2480 | /* | ||
| 2432 | * Read the device report descriptor once and use as template | 2481 | * Read the device report descriptor once and use as template |
| 2433 | * for the driver-specific modifications. | 2482 | * for the driver-specific modifications. |
| 2434 | */ | 2483 | */ |
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c new file mode 100644 index 000000000000..56be85a9a77c --- /dev/null +++ b/drivers/hid/hid-cp2112.c | |||
| @@ -0,0 +1,1073 @@ | |||
| 1 | /* | ||
| 2 | * hid-cp2112.c - Silicon Labs HID USB to SMBus master bridge | ||
| 3 | * Copyright (c) 2013,2014 Uplogix, Inc. | ||
| 4 | * David Barksdale <dbarksdale@uplogix.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PU | ||
