diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 19:24:28 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 19:24:28 -0400 |
| commit | 0f1b1e6d73cb989ce2c071edc57deade3b084dfe (patch) | |
| tree | 1bd8f2d3ea66dbc3fadd9a9ca522caa99d9b5277 | |
| parent | 159d8133d0b54a501a41a66fe3a0e7d16405e36d (diff) | |
| parent | 3ae821effdfea47dcb36b52e0a8dffd9757a96a6 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
- substantial cleanup of the generic and transport layers, in the
direction of an ultimate goal of making struct hid_device completely
transport independent, by Benjamin Tissoires
- cp2112 driver from David Barksdale
- a lot of fixes and new hardware support (Dualshock 4) to hid-sony
driver, by Frank Praznik
- support for Win 8.1 multitouch protocol by Andrew Duggan
- other smaller fixes / device ID additions
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (75 commits)
HID: sony: fix force feedback mismerge
HID: sony: Set the quriks flag for Bluetooth controllers
HID: sony: Fix Sixaxis cable state detection
HID: uhid: Add UHID_CREATE2 + UHID_INPUT2
HID: hyperv: fix _raw_request() prototype
HID: hyperv: Implement a stub raw_request() entry point
HID: hid-sensor-hub: fix sleeping function called from invalid context
HID: multitouch: add support for Win 8.1 multitouch touchpads
HID: remove hid_output_raw_report transport implementations
HID: sony: do not rely on hid_output_raw_report
HID: cp2112: remove the last hid_output_raw_report() call
HID: cp2112: remove various hid_out_raw_report calls
HID: multitouch: add support of other generic collections in hid-mt
HID: multitouch: remove pen special handling
HID: multitouch: remove registered devices with default behavior
HID: hidp: Add a comment that some devices depend on the current behavior of uniq
HID: sony: Prevent duplicate controller connections.
HID: sony: Perform a boundry check on the sixaxis battery level index.
HID: sony: Fix work queue issues
HID: sony: Fix multi-line comment styling
...
29 files changed, 3022 insertions, 658 deletions
diff --git a/Documentation/hid/hid-transport.txt b/Documentation/hid/hid-transport.txt new file mode 100644 index 000000000000..3dcba9fd4a3a --- /dev/null +++ b/Documentation/hid/hid-transport.txt | |||
| @@ -0,0 +1,317 @@ | |||
| 1 | HID I/O Transport Drivers | ||
| 2 | =========================== | ||
| 3 | |||
| 4 | The HID subsystem is independent of the underlying transport driver. Initially, | ||
| 5 | only USB was supported, but other specifications adopted the HID design and | ||
| 6 | provided new transport drivers. The kernel includes at least support for USB, | ||
| 7 | Bluetooth, I2C and user-space I/O drivers. | ||
| 8 | |||
| 9 | 1) HID Bus | ||
| 10 | ========== | ||
| 11 | |||
| 12 | The HID subsystem is designed as a bus. Any I/O subsystem may provide HID | ||
| 13 | devices and register them with the HID bus. HID core then loads generic device | ||
| 14 | drivers on top of it. The transport drivers are responsible of raw data | ||
| 15 | transport and device setup/management. HID core is responsible of | ||
| 16 | report-parsing, report interpretation and the user-space API. Device specifics | ||
| 17 | and quirks are handled by all layers depending on the quirk. | ||
| 18 | |||
| 19 | +-----------+ +-----------+ +-----------+ +-----------+ | ||
| 20 | | Device #1 | | Device #i | | Device #j | | Device #k | | ||
| 21 | +-----------+ +-----------+ +-----------+ +-----------+ | ||
| 22 | \\ // \\ // | ||
| 23 | +------------+ +------------+ | ||
| 24 | | I/O Driver | | I/O Driver | | ||
| 25 | +------------+ +------------+ | ||
| 26 | || || | ||
| 27 | +------------------+ +------------------+ | ||
| 28 | | Transport Driver | | Transport Driver | | ||
| 29 | +------------------+ +------------------+ | ||
| 30 | \___ ___/ | ||
| 31 | \ / | ||
| 32 | +----------------+ | ||
| 33 | | HID Core | | ||
| 34 | +----------------+ | ||
| 35 | / | | \ | ||
| 36 | / | | \ | ||
| 37 | ____________/ | | \_________________ | ||
| 38 | / | | \ | ||
| 39 | / | | \ | ||
| 40 | +----------------+ +-----------+ +------------------+ +------------------+ | ||
| 41 | | Generic Driver | | MT Driver | | Custom Driver #1 | | Custom Driver #2 | | ||
| 42 | +----------------+ +-----------+ +------------------+ +------------------+ | ||
| 43 | |||
| 44 | Example Drivers: | ||
| 45 | I/O: USB, I2C, Bluetooth-l2cap | ||
| 46 | Transport: USB-HID, I2C-HID, BT-HIDP | ||
| 47 | |||
| 48 | Everything below "HID Core" is simplified in this graph as it is only of | ||
| 49 | interest to HID device drivers. Transport drivers do not need to know the | ||
| 50 | specifics. | ||
| 51 | |||
| 52 | 1.1) Device Setup | ||
| 53 | ----------------- | ||
| 54 | |||
| 55 | I/O drivers normally provide hotplug detection or device enumeration APIs to the | ||
| 56 | transport drivers. Transport drivers use this to find any suitable HID device. | ||
| 57 | They allocate HID device objects and register them with HID core. Transport | ||
| 58 | drivers are not required to register themselves with HID core. HID core is never | ||
| 59 | aware of which transport drivers are available and is not interested in it. It | ||
| 60 | is only interested in devices. | ||
| 61 | |||
| 62 | Transport drivers attach a constant "struct hid_ll_driver" object with each | ||
| 63 | device. Once a device is registered with HID core, the callbacks provided via | ||
| 64 | this struct are used by HID core to communicate with the device. | ||
| 65 | |||
| 66 | Transport drivers are responsible of detecting device failures and unplugging. | ||
| 67 | HID core will operate a device as long as it is registered regardless of any | ||
| 68 | device failures. Once transport drivers detect unplug or failure events, they | ||
| 69 | must unregister the device from HID core and HID core will stop using the | ||
| 70 | provided callbacks. | ||
| 71 | |||
| 72 | 1.2) Transport Driver Requirements | ||
| 73 | ---------------------------------- | ||
| 74 | |||
| 75 | The terms "asynchronous" and "synchronous" in this document describe the | ||
| 76 | transmission behavior regarding acknowledgements. An asynchronous channel must | ||
| 77 | not perform any synchronous operations like waiting for acknowledgements or | ||
| 78 | verifications. Generally, HID calls operating on asynchronous channels must be | ||
| 79 | running in atomic-context just fine. | ||
| 80 | On the other hand, synchronous channels can be implemented by the transport | ||
| 81 | driver in whatever way they like. They might just be the same as asynchronous | ||
| 82 | channels, but they can also provide acknowledgement reports, automatic | ||
| 83 | retransmission on failure, etc. in a blocking manner. If such functionality is | ||
| 84 | required on asynchronous channels, a transport-driver must implement that via | ||
| 85 | its own worker threads. | ||
| 86 | |||
| 87 | HID core requires transport drivers to follow a given design. A Transport | ||
| 88 | driver must provide two bi-directional I/O channels to each HID device. These | ||
| 89 | channels must not necessarily be bi-directional in the hardware itself. A | ||
| 90 | transport driver might just provide 4 uni-directional channels. Or it might | ||
| 91 | multiplex all four on a single physical channel. However, in this document we | ||
| 92 | will describe them as two bi-directional channels as they have several | ||
| 93 | properties in common. | ||
| 94 | |||
| 95 | - Interrupt Channel (intr): The intr channel is used for asynchronous data | ||
| 96 | reports. No management commands or data acknowledgements are sent on this | ||
| 97 | channel. Any unrequested incoming or outgoing data report must be sent on | ||
| 98 | this channel and is never acknowledged by the remote side. Devices usually | ||
| 99 | send their input events on this channel. Outgoing events are normally | ||
| 100 | not send via intr, except if high throughput is required. | ||
| 101 | - Control Channel (ctrl): The ctrl channel is used for synchronous requests and | ||
| 102 | device management. Unrequested data input events must not be sent on this | ||
| 103 | channel and are normally ignored. Instead, devices only send management | ||
| 104 | events or answers to host requests on this channel. | ||
| 105 | The control-channel is used for direct blocking queries to the device | ||
| 106 | independent of any events on the intr-channel. | ||
| 107 | Outgoing reports are usually sent on the ctrl channel via synchronous | ||
| 108 | SET_REPORT requests. | ||
| 109 | |||
| 110 | Communication between devices and HID core is mostly done via HID reports. A | ||
| 111 | report can be of one of three types: | ||
| 112 | |||
| 113 | - INPUT Report: Input reports provide data from device to host. This | ||
| 114 | data may include button events, axis events, battery status or more. This | ||
| 115 | data is generated by the device and sent to the host with or without | ||
| 116 | requiring explicit requests. Devices can choose to send data continuously or | ||
| 117 | only on change. | ||
| 118 | - OUTPUT Report: Output reports change device states. They are sent from host | ||
| 119 | to device and may include LED requests, rumble requests or more. Output | ||
| 120 | reports are never sent from device to host, but a host can retrieve their | ||
| 121 | current state. | ||
| 122 | Hosts may choose to send output reports either continuously or only on | ||
| 123 | change. | ||
| 124 | - FEATURE Report: Feature reports are used for specific static device features | ||
| 125 | and never reported spontaneously. A host can read and/or write them to access | ||
| 126 | data like battery-state or device-settings. | ||
| 127 | Feature reports are never sent without requests. A host must explicitly set | ||
| 128 | or retrieve a feature report. This also means, feature reports are never sent | ||
| 129 | on the intr channel as this channel is asynchronous. | ||
| 130 | |||
| 131 | INPUT and OUTPUT reports can be sent as pure data reports on the intr channel. | ||
