Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f8dd50e0
Commit
f8dd50e0
authored
Feb 23, 2021
by
Jiri Kosina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.12/doc' into for-linus
- HID documentation fixes from Randy Dunlap
parents
fcd89e77
0603616a
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
123 additions
and
109 deletions
+123
-109
Documentation/hid/amd-sfh-hid.rst
Documentation/hid/amd-sfh-hid.rst
+11
-11
Documentation/hid/hid-alps.rst
Documentation/hid/hid-alps.rst
+2
-2
Documentation/hid/hid-sensor.rst
Documentation/hid/hid-sensor.rst
+9
-9
Documentation/hid/hid-transport.rst
Documentation/hid/hid-transport.rst
+6
-6
Documentation/hid/hiddev.rst
Documentation/hid/hiddev.rst
+5
-5
Documentation/hid/hidraw.rst
Documentation/hid/hidraw.rst
+3
-2
Documentation/hid/intel-ish-hid.rst
Documentation/hid/intel-ish-hid.rst
+40
-38
Documentation/hid/uhid.rst
Documentation/hid/uhid.rst
+17
-17
drivers/hid/hid-quirks.c
drivers/hid/hid-quirks.c
+14
-11
include/linux/hid-sensor-hub.h
include/linux/hid-sensor-hub.h
+5
-4
include/linux/hid.h
include/linux/hid.h
+11
-4
No files found.
Documentation/hid/amd-sfh-hid.rst
View file @
f8dd50e0
...
@@ -3,13 +3,13 @@
...
@@ -3,13 +3,13 @@
AMD Sensor Fusion Hub
AMD Sensor Fusion Hub
=====================
=====================
AMD Sensor Fusion Hub (SFH) is part of an SOC starting from Ryzen
based platforms.
AMD Sensor Fusion Hub (SFH) is part of an SOC starting from Ryzen
-
based platforms.
The solution is working well on several OEM products. AMD SFH uses HID over PCIe bus.
The solution is working well on several OEM products. AMD SFH uses HID over PCIe bus.
In terms of architecture it resembles ISH, however the major difference is all
In terms of architecture it resembles ISH, however the major difference is all
the HID reports are generated as part of the kernel driver.
the HID reports are generated as part of the kernel driver.
1.
Block Diagram
Block Diagram
================
-------------
::
::
...
@@ -45,20 +45,20 @@ the HID reports are generated as part of the kernel driver.
...
@@ -45,20 +45,20 @@ the HID reports are generated as part of the kernel driver.
AMD HID Transport Layer
AMD HID Transport Layer
-----------------------
-----------------------
AMD SFH transport is also implemented as a bus. Each client application executing in the AMD MP2 is
AMD SFH transport is also implemented as a bus. Each client application executing in the AMD MP2 is
registered as a device on this bus. Here
: MP2 which
is an ARM core connected to x86 for processing
registered as a device on this bus. Here
, MP2
is an ARM core connected to x86 for processing
sensor data. The layer, which binds each device (AMD SFH HID driver) identifies the device type and
sensor data. The layer, which binds each device (AMD SFH HID driver) identifies the device type and
registers with the
hid core. Transport layer attach
a constant "struct hid_ll_driver" object with
registers with the
HID core. Transport layer attaches
a constant "struct hid_ll_driver" object with
each device. Once a device is registered with HID core, the callbacks provided via this struct are
each device. Once a device is registered with HID core, the callbacks provided via this struct are
used by HID core to communicate with the device. AMD HID Transport layer implements the synchronous calls.
used by HID core to communicate with the device. AMD HID Transport layer implements the synchronous calls.
AMD HID Client Layer
AMD HID Client Layer
--------------------
--------------------
This layer is responsible to implement HID request and descriptors. As firmware is OS agnostic, HID
This layer is responsible to implement HID request
s
and descriptors. As firmware is OS agnostic, HID
client layer fills the HID request structure and descriptors. HID client layer is complex as it is
client layer fills the HID request structure and descriptors. HID client layer is complex as it is
interface between MP2 PCIe layer and HID. HID client layer initialize
d
the MP2 PCIe layer and holds
interface between MP2 PCIe layer and HID. HID client layer initialize
s
the MP2 PCIe layer and holds
the instance of MP2 layer. It identifies the number of sensors connected using MP2-PCIe layer. Base
the instance of MP2 layer. It identifies the number of sensors connected using MP2-PCIe layer. Base
d
on that allocates the DRAM address for each and every sensor and pass
it to MP2-PCIe driver.
On
on that allocates the DRAM address for each and every sensor and pass
es it to MP2-PCIe driver.
On
enumeration of each
the sensor, client layer fills the HID Descriptor structure and HID input repor
enumeration of each
sensor, client layer fills the HID Descriptor structure and HID input report
structure. HID Feature report structure is optional. The report descriptor structure varies from
structure. HID Feature report structure is optional. The report descriptor structure varies from
sensor to sensor.
sensor to sensor.
...
@@ -72,7 +72,7 @@ The communication between X86 and MP2 is split into three parts.
...
@@ -72,7 +72,7 @@ The communication between X86 and MP2 is split into three parts.
2. Data transfer via DRAM.
2. Data transfer via DRAM.
3. Supported sensor info via P2C registers.
3. Supported sensor info via P2C registers.
Commands are sent to MP2 using C2P Mailbox registers. Writing into C2P Message registers generate
Commands are sent to MP2 using C2P Mailbox registers. Writing into C2P Message registers generate
s
interrupt to MP2. The client layer allocates the physical memory and the same is sent to MP2 via
interrupt to MP2. The client layer allocates the physical memory and the same is sent to MP2 via
the PCI layer. MP2 firmware writes the command output to the access DRAM memory which the client
the PCI layer. MP2 firmware writes the command output to the access DRAM memory which the client
layer has allocated. Firmware always writes minimum of 32 bytes into DRAM. So as a protocol driver
layer has allocated. Firmware always writes minimum of 32 bytes into DRAM. So as a protocol driver
...
...
Documentation/hid/hid-alps.rst
View file @
f8dd50e0
...
@@ -64,7 +64,7 @@ Case2 ReportID_3 TP Absolute
...
@@ -64,7 +64,7 @@ Case2 ReportID_3 TP Absolute
Command Read/Write
Command Read/Write
------------------
------------------
To read/write to RAM, need to send a command
s
to the device.
To read/write to RAM, need to send a command to the device.
The command format is as below.
The command format is as below.
...
@@ -80,7 +80,7 @@ Byte6 Value Byte
...
@@ -80,7 +80,7 @@ Byte6 Value Byte
Byte7 Checksum
Byte7 Checksum
===== ======================
===== ======================
Command Byte is read=0xD1/write=0xD2
.
Command Byte is read=0xD1/write=0xD2.
Address is read/write RAM address.
Address is read/write RAM address.
...
...
Documentation/hid/hid-sensor.rst
View file @
f8dd50e0
...
@@ -48,12 +48,12 @@ for different sensors. For example an accelerometer can send X,Y and Z data, whe
...
@@ -48,12 +48,12 @@ for different sensors. For example an accelerometer can send X,Y and Z data, whe
an ambient light sensor can send illumination data.
an ambient light sensor can send illumination data.
So the implementation has two parts:
So the implementation has two parts:
- Core
hid
driver
- Core
HID
driver
- Individual sensor processing part (sensor drivers)
- Individual sensor processing part (sensor drivers)
Core driver
Core driver
-----------
-----------
The core driver
registers
(hid-sensor-hub) registers as a HID driver. It parses
The core driver (hid-sensor-hub) registers as a HID driver. It parses
report descriptors and identifies all the sensors present. It adds an MFD device
report descriptors and identifies all the sensors present. It adds an MFD device
with name HID-SENSOR-xxxx (where xxxx is usage id from the specification).
with name HID-SENSOR-xxxx (where xxxx is usage id from the specification).
...
@@ -95,14 +95,14 @@ Registration functions::
...
@@ -95,14 +95,14 @@ Registration functions::
u32 usage_id,
u32 usage_id,
struct hid_sensor_hub_callbacks *usage_callback):
struct hid_sensor_hub_callbacks *usage_callback):
Registers callbacks for a
n
usage id. The callback functions are not allowed
Registers callbacks for a usage id. The callback functions are not allowed
to sleep::
to sleep::
int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
u32 usage_id):
u32 usage_id):
Removes callbacks for a
n
usage id.
Removes callbacks for a usage id.
Parsing function::
Parsing function::
...
@@ -166,7 +166,7 @@ This allows some differentiating use cases, where vendor can provide application
...
@@ -166,7 +166,7 @@ This allows some differentiating use cases, where vendor can provide application
Some common use cases are debug other sensors or to provide some events like
Some common use cases are debug other sensors or to provide some events like
keyboard attached/detached or lid open/close.
keyboard attached/detached or lid open/close.
To allow application to utilize these sensors, here they are exported us
es
sysfs
To allow application to utilize these sensors, here they are exported us
ing
sysfs
attribute groups, attributes and misc device interface.
attribute groups, attributes and misc device interface.
An example of this representation on sysfs::
An example of this representation on sysfs::
...
@@ -207,9 +207,9 @@ An example of this representation on sysfs::
...
@@ -207,9 +207,9 @@ An example of this representation on sysfs::
│ │ │ ├── input-1-200202-units
│ │ │ ├── input-1-200202-units
│ │ │ ├── input-1-200202-value
│ │ │ ├── input-1-200202-value
Here there is a custom sensor
s with four fields,
two feature and two inputs.
Here there is a custom sensor
with four fields:
two feature and two inputs.
Each field is represented by a set of attributes. All fields except the "value"
Each field is represented by a set of attributes. All fields except the "value"
are read only. The value field is a
RW
field.
are read only. The value field is a
read-write
field.
Example::
Example::
...
@@ -237,6 +237,6 @@ These reports are pushed using misc device interface in a FIFO order::
...
@@ -237,6 +237,6 @@ These reports are pushed using misc device interface in a FIFO order::
│ │ │ ├── 10:53 -> ../HID-SENSOR-2000e1.6.auto
│ │ │ ├── 10:53 -> ../HID-SENSOR-2000e1.6.auto
│ ├── HID-SENSOR-2000e1.6.auto
│ ├── HID-SENSOR-2000e1.6.auto
Each report
s
can be of variable length preceded by a header. This header
Each report can be of variable length preceded by a header. This header
consist
of a 32 bit usage id, 64 bit time stamp and 32
bit length field of raw
consist
s of a 32-bit usage id, 64-bit time stamp and 32-
bit length field of raw
data.
data.
Documentation/hid/hid-transport.rst
View file @
f8dd50e0
...
@@ -12,8 +12,8 @@ Bluetooth, I2C and user-space I/O drivers.
...
@@ -12,8 +12,8 @@ Bluetooth, I2C and user-space I/O drivers.
The HID subsystem is designed as a bus. Any I/O subsystem may provide HID
The HID subsystem is designed as a bus. Any I/O subsystem may provide HID
devices and register them with the HID bus. HID core then loads generic device
devices and register them with the HID bus. HID core then loads generic device
drivers on top of it. The transport drivers are responsible
of
raw data
drivers on top of it. The transport drivers are responsible
for
raw data
transport and device setup/management. HID core is responsible
of
transport and device setup/management. HID core is responsible
for
report-parsing, report interpretation and the user-space API. Device specifics
report-parsing, report interpretation and the user-space API. Device specifics
and quirks are handled by all layers depending on the quirk.
and quirks are handled by all layers depending on the quirk.
...
@@ -67,7 +67,7 @@ Transport drivers attach a constant "struct hid_ll_driver" object with each
...
@@ -67,7 +67,7 @@ Transport drivers attach a constant "struct hid_ll_driver" object with each
device. Once a device is registered with HID core, the callbacks provided via
device. Once a device is registered with HID core, the callbacks provided via
this struct are used by HID core to communicate with the device.
this struct are used by HID core to communicate with the device.
Transport drivers are responsible
of
detecting device failures and unplugging.
Transport drivers are responsible
for
detecting device failures and unplugging.
HID core will operate a device as long as it is registered regardless of any
HID core will operate a device as long as it is registered regardless of any
device failures. Once transport drivers detect unplug or failure events, they
device failures. Once transport drivers detect unplug or failure events, they
must unregister the device from HID core and HID core will stop using the
must unregister the device from HID core and HID core will stop using the
...
@@ -101,7 +101,7 @@ properties in common.
...
@@ -101,7 +101,7 @@ properties in common.
channel. Any unrequested incoming or outgoing data report must be sent on
channel. Any unrequested incoming or outgoing data report must be sent on
this channel and is never acknowledged by the remote side. Devices usually
this channel and is never acknowledged by the remote side. Devices usually
send their input events on this channel. Outgoing events are normally
send their input events on this channel. Outgoing events are normally
not sen
d
via intr, except if high throughput is required.
not sen
t
via intr, except if high throughput is required.
- Control Channel (ctrl): The ctrl channel is used for synchronous requests and
- Control Channel (ctrl): The ctrl channel is used for synchronous requests and
device management. Unrequested data input events must not be sent on this
device management. Unrequested data input events must not be sent on this
channel and are normally ignored. Instead, devices only send management
channel and are normally ignored. Instead, devices only send management
...
@@ -161,7 +161,7 @@ allowed on the intr channel and are the only means of data there.
...
@@ -161,7 +161,7 @@ allowed on the intr channel and are the only means of data there.
payload may be blocked by the underlying transport driver if the
payload may be blocked by the underlying transport driver if the
specification does not allow them.
specification does not allow them.
- SET_REPORT: A SET_REPORT request has a report ID plus data as payload. It is
- SET_REPORT: A SET_REPORT request has a report ID plus data as payload. It is
sent from host to device and a device must update it
'
s current report state
sent from host to device and a device must update its current report state
according to the given data. Any of the 3 report types can be used. However,
according to the given data. Any of the 3 report types can be used. However,
INPUT reports as payload might be blocked by the underlying transport driver
INPUT reports as payload might be blocked by the underlying transport driver
if the specification does not allow them.
if the specification does not allow them.
...
@@ -294,7 +294,7 @@ The available HID callbacks are:
...
@@ -294,7 +294,7 @@ The available HID callbacks are:
void (*request) (struct hid_device *hdev, struct hid_report *report,
void (*request) (struct hid_device *hdev, struct hid_report *report,
int reqtype)
int reqtype)
Send a
n
HID request on the ctrl channel. "report" contains the report that
Send a HID request on the ctrl channel. "report" contains the report that
should be sent and "reqtype" the request type. Request-type can be
should be sent and "reqtype" the request type. Request-type can be
HID_REQ_SET_REPORT or HID_REQ_GET_REPORT.
HID_REQ_SET_REPORT or HID_REQ_GET_REPORT.
...
...
Documentation/hid/hiddev.rst
View file @
f8dd50e0
...
@@ -27,7 +27,7 @@ the following::
...
@@ -27,7 +27,7 @@ the following::
--> hiddev.c ----> POWER / MONITOR CONTROL
--> hiddev.c ----> POWER / MONITOR CONTROL
In addition, other subsystems (apart from USB) can potentially feed
In addition, other subsystems (apart from USB) can potentially feed
events into the input subsystem, but these have no effect on the
hid
events into the input subsystem, but these have no effect on the
HID
device interface.
device interface.
Using the HID Device Interface
Using the HID Device Interface
...
@@ -73,7 +73,7 @@ The hiddev API uses a read() interface, and a set of ioctl() calls.
...
@@ -73,7 +73,7 @@ The hiddev API uses a read() interface, and a set of ioctl() calls.
HID devices exchange data with the host computer using data
HID devices exchange data with the host computer using data
bundles called "reports". Each report is divided into "fields",
bundles called "reports". Each report is divided into "fields",
each of which can have one or more "usages". In the hid-core,
each of which can have one or more "usages". In the hid-core,
each one of these usages has a single signed 32
bit value.
each one of these usages has a single signed 32
-
bit value.
read():
read():
-------
-------
...
@@ -113,7 +113,7 @@ HIDIOCAPPLICATION
...
@@ -113,7 +113,7 @@ HIDIOCAPPLICATION
- (none)
- (none)
This ioctl call returns the HID application usage associated with the
This ioctl call returns the HID application usage associated with the
hid
device. The third argument to ioctl() specifies which application
HID
device. The third argument to ioctl() specifies which application
index to get. This is useful when the device has more than one
index to get. This is useful when the device has more than one
application collection. If the index is invalid (greater or equal to
application collection. If the index is invalid (greater or equal to
the number of application collections this device has) the ioctl
the number of application collections this device has) the ioctl
...
@@ -181,7 +181,7 @@ looked up by type (input, output or feature) and id, so these fields
...
@@ -181,7 +181,7 @@ looked up by type (input, output or feature) and id, so these fields
must be filled in by the user. The ID can be absolute -- the actual
must be filled in by the user. The ID can be absolute -- the actual
report id as reported by the device -- or relative --
report id as reported by the device -- or relative --
HID_REPORT_ID_FIRST for the first report, and (HID_REPORT_ID_NEXT |
HID_REPORT_ID_FIRST for the first report, and (HID_REPORT_ID_NEXT |
report_id) for the next report after report_id. Without a
-
priori
report_id) for the next report after report_id. Without a
priori
information about report ids, the right way to use this ioctl is to
information about report ids, the right way to use this ioctl is to
use the relative IDs above to enumerate the valid IDs. The ioctl
use the relative IDs above to enumerate the valid IDs. The ioctl
returns non-zero when there is no more next ID. The real report ID is
returns non-zero when there is no more next ID. The real report ID is
...
@@ -200,7 +200,7 @@ HIDIOCGUCODE
...
@@ -200,7 +200,7 @@ HIDIOCGUCODE
- struct hiddev_usage_ref (read/write)
- struct hiddev_usage_ref (read/write)
Returns the usage_code in a hiddev_usage_ref structure, given that
Returns the usage_code in a hiddev_usage_ref structure, given that
given
its report type, report id, field index, and index within the
its report type, report id, field index, and index within the
field have already been filled into the structure.
field have already been filled into the structure.
HIDIOCGUSAGE
HIDIOCGUSAGE
...
...
Documentation/hid/hidraw.rst
View file @
f8dd50e0
...
@@ -21,7 +21,7 @@ Hidraw is the only alternative, short of writing a custom kernel driver, for
...
@@ -21,7 +21,7 @@ Hidraw is the only alternative, short of writing a custom kernel driver, for
these non-conformant devices.
these non-conformant devices.
A benefit of hidraw is that its use by userspace applications is independent
A benefit of hidraw is that its use by userspace applications is independent
of the underlying hardware type. Currently,
H
idraw is implemented for USB
of the underlying hardware type. Currently,
h
idraw is implemented for USB
and Bluetooth. In the future, as new hardware bus types are developed which
and Bluetooth. In the future, as new hardware bus types are developed which
use the HID specification, hidraw will be expanded to add support for these
use the HID specification, hidraw will be expanded to add support for these
new bus types.
new bus types.
...
@@ -31,9 +31,10 @@ create hidraw device nodes. Udev will typically create the device nodes
...
@@ -31,9 +31,10 @@ create hidraw device nodes. Udev will typically create the device nodes
directly under /dev (eg: /dev/hidraw0). As this location is distribution-
directly under /dev (eg: /dev/hidraw0). As this location is distribution-
and udev rule-dependent, applications should use libudev to locate hidraw
and udev rule-dependent, applications should use libudev to locate hidraw
devices attached to the system. There is a tutorial on libudev with a
devices attached to the system. There is a tutorial on libudev with a
working example at:
working example at:
:
http://www.signal11.us/oss/udev/
http://www.signal11.us/oss/udev/
https://web.archive.org/web/2019*/www.signal11.us
The HIDRAW API
The HIDRAW API
---------------
---------------
...
...
Documentation/hid/intel-ish-hid.rst
View file @
f8dd50e0
...
@@ -4,19 +4,19 @@ Intel Integrated Sensor Hub (ISH)
...
@@ -4,19 +4,19 @@ Intel Integrated Sensor Hub (ISH)
A sensor hub enables the ability to offload sensor polling and algorithm
A sensor hub enables the ability to offload sensor polling and algorithm
processing to a dedicated low power co-processor. This allows the core
processing to a dedicated low power co-processor. This allows the core
processor to go into low power modes more often, resulting in
the
increased
processor to go into low power modes more often, resulting in increased
battery life.
battery life.
There are many vendors providing external sensor hubs conf
i
rming to HID
There are many vendors providing external sensor hubs conf
o
rming to HID
Sensor usage tables
, and used in several tablets, 2 in
1 convertible laptops
Sensor usage tables
. These may be found in tablets, 2-in-
1 convertible laptops
and embedded products. Linux had this support since Linux 3.9.
and embedded products. Linux ha
s ha
d this support since Linux 3.9.
Intel® introduced integrated sensor hubs as a part of the SoC starting from
Intel® introduced integrated sensor hubs as a part of the SoC starting from
Cherry Trail and now supported on multiple generations of CPU packages. There
Cherry Trail and now supported on multiple generations of CPU packages. There
are many commercial devices already shipped with Integrated Sensor Hubs (ISH).
are many commercial devices already shipped with Integrated Sensor Hubs (ISH).
These ISH also comply to HID sensor specification, but the difference is the
These ISH also comply to HID sensor specification, but the difference is the
transport protocol used for communication. The current external sensor hubs
transport protocol used for communication. The current external sensor hubs
mainly use HID over
i2C or USB. But ISH doesn't use either i2c
or USB.
mainly use HID over
I2C or USB. But ISH doesn't use either I2C
or USB.
1. Overview
1. Overview
===========
===========
...
@@ -50,13 +50,13 @@ applications implemented in the firmware.
...
@@ -50,13 +50,13 @@ applications implemented in the firmware.
The ISH allows multiple sensor management applications executing in the
The ISH allows multiple sensor management applications executing in the
firmware. Like USB endpoints the messaging can be to/from a client. As part of
firmware. Like USB endpoints the messaging can be to/from a client. As part of
enumeration process, these clients are identified. These clients can be simple
enumeration process, these clients are identified. These clients can be simple
HID sensor applications, sensor calibration application
or sen
or firmware
HID sensor applications, sensor calibration application
s or sens
or firmware
update application.
update application
s
.
The implementation model is similar, like USB bus, ISH transport is also
The implementation model is similar, like USB bus, ISH transport is also
implemented as a bus. Each client application executing in the ISH processor
implemented as a bus. Each client application executing in the ISH processor
is registered as a device on this bus. The driver, which binds each device
is registered as a device on this bus. The driver, which binds each device
(ISH HID driver) identifies the device type and registers with the
hid
core.
(ISH HID driver) identifies the device type and registers with the
HID
core.
2. ISH Implementation: Block Diagram
2. ISH Implementation: Block Diagram
====================================
====================================
...
@@ -104,7 +104,7 @@ is registered as a device on this bus. The driver, which binds each device
...
@@ -104,7 +104,7 @@ is registered as a device on this bus. The driver, which binds each device
The ISH is exposed as "Non-VGA unclassified PCI device" to the host. The PCI
The ISH is exposed as "Non-VGA unclassified PCI device" to the host. The PCI
product and vendor IDs are changed from different generations of processors. So
product and vendor IDs are changed from different generations of processors. So
the source code which enumerate drivers needs to update from generation to
the source code which enumerate
s
drivers needs to update from generation to
generation.
generation.
3.2 Inter Processor Communication (IPC) driver
3.2 Inter Processor Communication (IPC) driver
...
@@ -112,39 +112,40 @@ generation.
...
@@ -112,39 +112,40 @@ generation.
Location: drivers/hid/intel-ish-hid/ipc
Location: drivers/hid/intel-ish-hid/ipc
The IPC message use
d
memory mapped I/O. The registers are defined in
The IPC message use
s
memory mapped I/O. The registers are defined in
hw-ish-regs.h.
hw-ish-regs.h.
3.2.1 IPC/FW message types
3.2.1 IPC/FW message types
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
There are two types of messages, one for management of link and
other messages
There are two types of messages, one for management of link and
another for
are
to and from transport layers.
messages
to and from transport layers.
TX and RX of Transport messages
TX and RX of Transport messages
...............................
...............................
A set of memory mapped register offers support of multi
byte messages TX and
A set of memory mapped register offers support of multi
-
byte messages TX and
RX (
E.g.
IPC_REG_ISH2HOST_MSG, IPC_REG_HOST2ISH_MSG). The IPC layer maintains
RX (
e.g.
IPC_REG_ISH2HOST_MSG, IPC_REG_HOST2ISH_MSG). The IPC layer maintains
internal queues to sequence messages and send them in order to the
FW
.
internal queues to sequence messages and send them in order to the
firmware
.
Optionally the caller can register handler to get notification of completion.
Optionally the caller can register handler to get notification of completion.
A door
bell mechanism is used in messaging to trigger processing in host and
A doorbell mechanism is used in messaging to trigger processing in host and
client firmware side. When ISH interrupt handler is called, the ISH2HOST
client firmware side. When ISH interrupt handler is called, the ISH2HOST
doorbell register is used by host drivers to determine that the interrupt
doorbell register is used by host drivers to determine that the interrupt
is for ISH.
is for ISH.
Each side has 32 32-bit message registers and a 32-bit doorbell. Doorbell
Each side has 32 32-bit message registers and a 32-bit doorbell. Doorbell
register has the following format:
register has the following format::
Bits 0..6: fragment length (7 bits are used)
Bits 10..13: encapsulated protocol
Bits 0..6: fragment length (7 bits are used)
Bits 16..19: management command (for IPC management protocol)
Bits 10..13: encapsulated protocol
Bit 31: doorbell trigger (signal H/W interrupt to the other side)
Bits 16..19: management command (for IPC management protocol)
Other bits are reserved, should be 0.
Bit 31: doorbell trigger (signal H/W interrupt to the other side)
Other bits are reserved, should be 0.
3.2.2 Transport layer interface
3.2.2 Transport layer interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To abstract HW level IPC communication, a set of callbacks
are
registered.
To abstract HW level IPC communication, a set of callbacks
is
registered.
The transport layer uses them to send and receive messages.
The transport layer uses them to send and receive messages.
Refer to struct ishtp_hw_ops for callbacks.
Refer to struct ishtp_hw_ops for callbacks.
...
@@ -158,7 +159,7 @@ Location: drivers/hid/intel-ish-hid/ishtp/
...
@@ -158,7 +159,7 @@ Location: drivers/hid/intel-ish-hid/ishtp/
The transport layer is a bi-directional protocol, which defines:
The transport layer is a bi-directional protocol, which defines:
- Set of commands to start, stop, connect, disconnect and flow control
- Set of commands to start, stop, connect, disconnect and flow control
(
ishtp/hbm.h) for details
(
see ishtp/hbm.h for details)
- A flow control mechanism to avoid buffer overflows
- A flow control mechanism to avoid buffer overflows
This protocol resembles bus messages described in the following document:
This protocol resembles bus messages described in the following document:
...
@@ -168,14 +169,14 @@ specifications/dcmi-hi-1-0-spec.pdf "Chapter 7: Bus Message Layer"
...
@@ -168,14 +169,14 @@ specifications/dcmi-hi-1-0-spec.pdf "Chapter 7: Bus Message Layer"
3.3.2 Connection and Flow Control Mechanism
3.3.2 Connection and Flow Control Mechanism
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Each FW client and a protocol is identified by a
n
UUID. In order to communicate
Each FW client and a protocol is identified by a UUID. In order to communicate
to a FW client, a connection must be established using connect request and
to a FW client, a connection must be established using connect request and
response bus messages. If successful, a pair (host_client_id and fw_client_id)
response bus messages. If successful, a pair (host_client_id and fw_client_id)
will identify the connection.
will identify the connection.
Once connection is established, peers send each other flow control bus messages
Once connection is established, peers send each other flow control bus messages
independently. Every peer may send a message only if it has received a
independently. Every peer may send a message only if it has received a
flow-control credit before. Once it sent a message, it may not send another one
flow-control credit before. Once it
has
sent a message, it may not send another one
before receiving the next flow control credit.
before receiving the next flow control credit.
Either side can send disconnect request bus message to end communication. Also
Either side can send disconnect request bus message to end communication. Also
the link will be dropped if major FW reset occurs.
the link will be dropped if major FW reset occurs.
...
@@ -209,7 +210,7 @@ and DMA_XFER_ACK act as ownership indicators.
...
@@ -209,7 +210,7 @@ and DMA_XFER_ACK act as ownership indicators.
At initial state all outgoing memory belongs to the sender (TX to host, RX to
At initial state all outgoing memory belongs to the sender (TX to host, RX to
FW), DMA_XFER transfers ownership on the region that contains ISHTP message to
FW), DMA_XFER transfers ownership on the region that contains ISHTP message to
the receiving side, DMA_XFER_ACK returns ownership to the sender. A sender
the receiving side, DMA_XFER_ACK returns ownership to the sender. A sender
need
s
not wait for previous DMA_XFER to be ack'ed, and may send another message
need not wait for previous DMA_XFER to be ack'ed, and may send another message
as long as remaining continuous memory in its ownership is enough.
as long as remaining continuous memory in its ownership is enough.
In principle, multiple DMA_XFER and DMA_XFER_ACK messages may be sent at once
In principle, multiple DMA_XFER and DMA_XFER_ACK messages may be sent at once
(up to IPC MTU), thus allowing for interrupt throttling.
(up to IPC MTU), thus allowing for interrupt throttling.
...
@@ -219,8 +220,8 @@ fragments and via IPC otherwise.
...
@@ -219,8 +220,8 @@ fragments and via IPC otherwise.
3.3.4 Ring Buffers
3.3.4 Ring Buffers
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
When a client initiate
a connection, a ring or RX and TX buffers are
allocated.
When a client initiate
s a connection, a ring of RX and TX buffers is
allocated.
The size of ring can be specified by the client. HID client set 16 and 32 for
The size of ring can be specified by the client. HID client set
s
16 and 32 for
TX and RX buffers respectively. On send request from client, the data to be
TX and RX buffers respectively. On send request from client, the data to be
sent is copied to one of the send ring buffer and scheduled to be sent using
sent is copied to one of the send ring buffer and scheduled to be sent using
bus message protocol. These buffers are required because the FW may have not
bus message protocol. These buffers are required because the FW may have not
...
@@ -230,10 +231,10 @@ to send. Same thing holds true on receive side and flow control is required.
...
@@ -230,10 +231,10 @@ to send. Same thing holds true on receive side and flow control is required.
3.3.5 Host Enumeration
3.3.5 Host Enumeration
^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^
The host enumeration bus command allow discovery of clients present in the FW.
The host enumeration bus command allow
s
discovery of clients present in the FW.
There can be multiple sensor clients and clients for calibration function.
There can be multiple sensor clients and clients for calibration function.
To ease i
n implantation and allow independent driver handle each client
To ease i
mplementation and allow independent drivers to handle each client,
this transport layer takes advantage of Linux Bus driver model. Each
this transport layer takes advantage of Linux Bus driver model. Each
client is registered as device on the transport bus (ishtp bus).
client is registered as device on the transport bus (ishtp bus).
...
@@ -270,7 +271,7 @@ The ISHTP client driver is responsible for:
...
@@ -270,7 +271,7 @@ The ISHTP client driver is responsible for:
The functionality in these drivers is the same as an external sensor hub.
The functionality in these drivers is the same as an external sensor hub.
Refer to
Refer to
Documentation/hid/hid-sensor.rst for HID sensor
Documentation/hid/hid-sensor.rst for HID sensor
Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space
Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space
.
3.6 End to End HID transport Sequence Diagram
3.6 End to End HID transport Sequence Diagram
---------------------------------------------
---------------------------------------------
...
@@ -341,9 +342,10 @@ Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space
...
@@ -341,9 +342,10 @@ Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space
3.7 ISH Debugging
3.7 ISH Debugging
-----------------
-----------------
To debug ISH, event tracing mechanism is used. To enable debug logs
To debug ISH, event tracing mechanism is used. To enable debug logs::
echo 1 > /sys/kernel/debug/tracing/events/intel_ish/enable
cat sys/kernel/debug/tracing/trace
echo 1 > /sys/kernel/debug/tracing/events/intel_ish/enable
cat sys/kernel/debug/tracing/trace
3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
-----------------------------------------------------
-----------------------------------------------------
...
...
Documentation/hid/uhid.rst
View file @
f8dd50e0
...
@@ -3,7 +3,7 @@ UHID - User-space I/O driver support for HID subsystem
...
@@ -3,7 +3,7 @@ UHID - User-space I/O driver support for HID subsystem
======================================================
======================================================
UHID allows user-space to implement HID transport drivers. Please see
UHID allows user-space to implement HID transport drivers. Please see
hid-transport.
tx
t for an introduction into HID transport drivers. This document
hid-transport.
rs
t for an introduction into HID transport drivers. This document
relies heavily on the definitions declared there.
relies heavily on the definitions declared there.
With UHID, a user-space transport driver can create kernel hid-devices for each
With UHID, a user-space transport driver can create kernel hid-devices for each
...
@@ -15,7 +15,7 @@ There is an example user-space application in ./samples/uhid/uhid-example.c
...
@@ -15,7 +15,7 @@ There is an example user-space application in ./samples/uhid/uhid-example.c
The UHID API
The UHID API
------------
------------
UHID is accessed through a character misc-device. The minor
-
number is allocated
UHID is accessed through a character misc-device. The minor
number is allocated
dynamically so you need to rely on udev (or similar) to create the device node.
dynamically so you need to rely on udev (or similar) to create the device node.
This is /dev/uhid by default.
This is /dev/uhid by default.
...
@@ -45,23 +45,23 @@ The "type" field defines the payload. For each type, there is a
...
@@ -45,23 +45,23 @@ The "type" field defines the payload. For each type, there is a
payload-structure available in the union "u" (except for empty payloads). This
payload-structure available in the union "u" (except for empty payloads). This
payload contains management and/or device data.
payload contains management and/or device data.
The first thing you should do is send
ing an
UHID_CREATE2 event. This will
The first thing you should do is send
a
UHID_CREATE2 event. This will
register the device. UHID will respond with a
n
UHID_START event. You can now
register the device. UHID will respond with a UHID_START event. You can now
start sending data to and reading data from UHID. However, unless UHID sends the
start sending data to and reading data from UHID. However, unless UHID sends the
UHID_OPEN event, the internally attached HID Device Driver has no user attached.
UHID_OPEN event, the internally attached HID Device Driver has no user attached.
That is, you might put your device asleep unless you receive the UHID_OPEN
That is, you might put your device asleep unless you receive the UHID_OPEN
event. If you receive the UHID_OPEN event, you should start I/O. If the last
event. If you receive the UHID_OPEN event, you should start I/O. If the last
user closes the HID device, you will receive a
n
UHID_CLOSE event. This may be
user closes the HID device, you will receive a UHID_CLOSE event. This may be
followed by a
n
UHID_OPEN event again and so on. There is no need to perform
followed by a UHID_OPEN event again and so on. There is no need to perform
reference-counting in user-space. That is, you will never receive multiple
reference-counting in user-space. That is, you will never receive multiple
UHID_OPEN events without a
n
UHID_CLOSE event. The HID subsystem performs
UHID_OPEN events without a UHID_CLOSE event. The HID subsystem performs
ref-counting for you.
ref-counting for you.
You may decide to ignore UHID_OPEN/UHID_CLOSE, though. I/O is allowed even
You may decide to ignore UHID_OPEN/UHID_CLOSE, though. I/O is allowed even
though the device may have no users.
though the device may have no users.
If you want to send data on the interrupt channel to the HID subsystem, you send
If you want to send data on the interrupt channel to the HID subsystem, you send
a
n
HID_INPUT2 event with your raw data payload. If the kernel wants to send data
a HID_INPUT2 event with your raw data payload. If the kernel wants to send data
on the interrupt channel to the device, you will read a
n
UHID_OUTPUT event.
on the interrupt channel to the device, you will read a UHID_OUTPUT event.
Data requests on the control channel are currently limited to GET_REPORT and
Data requests on the control channel are currently limited to GET_REPORT and
SET_REPORT (no other data reports on the control channel are defined so far).
SET_REPORT (no other data reports on the control channel are defined so far).
Those requests are always synchronous. That means, the kernel sends
Those requests are always synchronous. That means, the kernel sends
...
@@ -71,7 +71,7 @@ the response via UHID_GET_REPORT_REPLY and UHID_SET_REPORT_REPLY to the kernel.
...
@@ -71,7 +71,7 @@ the response via UHID_GET_REPORT_REPLY and UHID_SET_REPORT_REPLY to the kernel.
The kernel blocks internal driver-execution during such round-trips (times out
The kernel blocks internal driver-execution during such round-trips (times out
after a hard-coded period).
after a hard-coded period).
If your device disconnects, you should send a
n
UHID_DESTROY event. This will
If your device disconnects, you should send a UHID_DESTROY event. This will
unregister the device. You can now send UHID_CREATE2 again to register a new
unregister the device. You can now send UHID_CREATE2 again to register a new
device.
device.
If you close() the fd, the device is automatically unregistered and destroyed
If you close() the fd, the device is automatically unregistered and destroyed
...
@@ -125,7 +125,7 @@ UHID_START:
...
@@ -125,7 +125,7 @@ UHID_START:
This is sent when the HID device is started. Consider this as an answer to
This is sent when the HID device is started. Consider this as an answer to
UHID_CREATE2. This is always the first event that is sent. Note that this
UHID_CREATE2. This is always the first event that is sent. Note that this
event might not be available immediately after write(UHID_CREATE2) returns.
event might not be available immediately after write(UHID_CREATE2) returns.
Device drivers might require
d
delayed setups.
Device drivers might require delayed setups.
This event contains a payload of type uhid_start_req. The "dev_flags" field
This event contains a payload of type uhid_start_req. The "dev_flags" field
describes special behaviors of a device. The following flags are defined:
describes special behaviors of a device. The following flags are defined:
...
@@ -149,7 +149,7 @@ UHID_STOP:
...
@@ -149,7 +149,7 @@ UHID_STOP:
reloaded/changed the device driver loaded on your HID device (or some other
reloaded/changed the device driver loaded on your HID device (or some other
maintenance actions happened).
maintenance actions happened).
You can usually ignore
d
any UHID_STOP events safely.
You can usually ignore any UHID_STOP events safely.
UHID_OPEN:
UHID_OPEN:
This is sent when the HID device is opened. That is, the data that the HID
This is sent when the HID device is opened. That is, the data that the HID
...
@@ -166,17 +166,17 @@ UHID_OUTPUT:
...
@@ -166,17 +166,17 @@ UHID_OUTPUT:
This is sent if the HID device driver wants to send raw data to the I/O
This is sent if the HID device driver wants to send raw data to the I/O
device on the interrupt channel. You should read the payload and forward it to
device on the interrupt channel. You should read the payload and forward it to
the device. The payload is of type "struct uhid_output_req".
the device. The payload is of type "struct uhid_output_req".
This may be received even though you haven't received UHID_OPEN
,
yet.
This may be received even though you haven't received UHID_OPEN yet.
UHID_GET_REPORT:
UHID_GET_REPORT:
This event is sent if the kernel driver wants to perform a GET_REPORT request
This event is sent if the kernel driver wants to perform a GET_REPORT request
on the control channel
d
as described in the HID specs. The report-type and
on the control channel as described in the HID specs. The report-type and
report-number are available in the payload.
report-number are available in the payload.
The kernel serializes GET_REPORT requests so there will never be two in
The kernel serializes GET_REPORT requests so there will never be two in
parallel. However, if you fail to respond with a UHID_GET_REPORT_REPLY, the
parallel. However, if you fail to respond with a UHID_GET_REPORT_REPLY, the
request might silently time out.
request might silently time out.
Once you read a GET_REPORT request, you shall forward it to the
hid
device and
Once you read a GET_REPORT request, you shall forward it to the
HID
device and
remember the "id" field in the payload. Once your
hid
device responds to the
remember the "id" field in the payload. Once your
HID
device responds to the
GET_REPORT (or if it fails), you must send a UHID_GET_REPORT_REPLY to the
GET_REPORT (or if it fails), you must send a UHID_GET_REPORT_REPLY to the
kernel with the exact same "id" as in the request. If the request already
kernel with the exact same "id" as in the request. If the request already
timed out, the kernel will ignore the response silently. The "id" field is
timed out, the kernel will ignore the response silently. The "id" field is
...
@@ -184,7 +184,7 @@ UHID_GET_REPORT:
...
@@ -184,7 +184,7 @@ UHID_GET_REPORT:
UHID_SET_REPORT:
UHID_SET_REPORT:
This is the SET_REPORT equivalent of UHID_GET_REPORT. On receipt, you shall
This is the SET_REPORT equivalent of UHID_GET_REPORT. On receipt, you shall
send a SET_REPORT request to your
hid
device. Once it replies, you must tell
send a SET_REPORT request to your
HID
device. Once it replies, you must tell
the kernel about it via UHID_SET_REPORT_REPLY.
the kernel about it via UHID_SET_REPORT_REPLY.
The same restrictions as for UHID_GET_REPORT apply.
The same restrictions as for UHID_GET_REPORT apply.
...
...
drivers/hid/hid-quirks.c
View file @
f8dd50e0
...
@@ -1029,7 +1029,7 @@ static DEFINE_MUTEX(dquirks_lock);
...
@@ -1029,7 +1029,7 @@ static DEFINE_MUTEX(dquirks_lock);
/* Runtime ("dynamic") quirks manipulation functions */
/* Runtime ("dynamic") quirks manipulation functions */
/**
/**
* hid_exists_dquirk
:
find any dynamic quirks for a HID device
* hid_exists_dquirk
-
find any dynamic quirks for a HID device
* @hdev: the HID device to match
* @hdev: the HID device to match
*
*
* Description:
* Description:
...
@@ -1037,7 +1037,7 @@ static DEFINE_MUTEX(dquirks_lock);
...
@@ -1037,7 +1037,7 @@ static DEFINE_MUTEX(dquirks_lock);
* the pointer to the relevant struct hid_device_id if found.
* the pointer to the relevant struct hid_device_id if found.
* Must be called with a read lock held on dquirks_lock.
* Must be called with a read lock held on dquirks_lock.
*
*
* Return
s
: NULL if no quirk found, struct hid_device_id * if found.
* Return: NULL if no quirk found, struct hid_device_id * if found.
*/
*/
static
struct
hid_device_id
*
hid_exists_dquirk
(
const
struct
hid_device
*
hdev
)
static
struct
hid_device_id
*
hid_exists_dquirk
(
const
struct
hid_device
*
hdev
)
{
{
...
@@ -1061,7 +1061,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
...
@@ -1061,7 +1061,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
/**
/**
* hid_modify_dquirk
:
add/replace a HID quirk
* hid_modify_dquirk
-
add/replace a HID quirk
* @id: the HID device to match
* @id: the HID device to match
* @quirks: the unsigned long quirks value to add/replace
* @quirks: the unsigned long quirks value to add/replace
*
*
...
@@ -1070,7 +1070,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
...
@@ -1070,7 +1070,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
* quirks value with what was provided. Otherwise, add the quirk
* quirks value with what was provided. Otherwise, add the quirk
* to the dynamic quirks list.
* to the dynamic quirks list.
*
*
* Return
s
: 0 OK, -error on failure.
* Return: 0 OK, -error on failure.
*/
*/
static
int
hid_modify_dquirk
(
const
struct
hid_device_id
*
id
,
static
int
hid_modify_dquirk
(
const
struct
hid_device_id
*
id
,
const
unsigned
long
quirks
)
const
unsigned
long
quirks
)
...
@@ -1122,7 +1122,7 @@ static int hid_modify_dquirk(const struct hid_device_id *id,
...
@@ -1122,7 +1122,7 @@ static int hid_modify_dquirk(const struct hid_device_id *id,
}
}
/**
/**
* hid_remove_all_dquirks
:
remove all runtime HID quirks from memory
* hid_remove_all_dquirks
-
remove all runtime HID quirks from memory
* @bus: bus to match against. Use HID_BUS_ANY if all need to be removed.
* @bus: bus to match against. Use HID_BUS_ANY if all need to be removed.
*
*
* Description:
* Description:
...
@@ -1146,7 +1146,10 @@ static void hid_remove_all_dquirks(__u16 bus)
...
@@ -1146,7 +1146,10 @@ static void hid_remove_all_dquirks(__u16 bus)
}
}
/**
/**
* hid_quirks_init: apply HID quirks specified at module load time
* hid_quirks_init - apply HID quirks specified at module load time
* @quirks_param: array of quirks strings (vendor:product:quirks)
* @bus: bus type
* @count: number of quirks to check
*/
*/
int
hid_quirks_init
(
char
**
quirks_param
,
__u16
bus
,
int
count
)
int
hid_quirks_init
(
char
**
quirks_param
,
__u16
bus
,
int
count
)
{
{
...
@@ -1177,7 +1180,7 @@ int hid_quirks_init(char **quirks_param, __u16 bus, int count)
...
@@ -1177,7 +1180,7 @@ int hid_quirks_init(char **quirks_param, __u16 bus, int count)
EXPORT_SYMBOL_GPL
(
hid_quirks_init
);
EXPORT_SYMBOL_GPL
(
hid_quirks_init
);
/**
/**
* hid_quirks_exit
:
release memory associated with dynamic_quirks
* hid_quirks_exit
-
release memory associated with dynamic_quirks
* @bus: a bus to match against
* @bus: a bus to match against
*
*
* Description:
* Description:
...
@@ -1194,14 +1197,14 @@ void hid_quirks_exit(__u16 bus)
...
@@ -1194,14 +1197,14 @@ void hid_quirks_exit(__u16 bus)
EXPORT_SYMBOL_GPL
(
hid_quirks_exit
);
EXPORT_SYMBOL_GPL
(
hid_quirks_exit
);
/**
/**
* hid_gets_squirk
:
return any static quirks for a HID device
* hid_gets_squirk
-
return any static quirks for a HID device
* @hdev: the HID device to match
* @hdev: the HID device to match
*
*
* Description:
* Description:
* Given a HID device, return a pointer to the quirked hid_device_id entry
* Given a HID device, return a pointer to the quirked hid_device_id entry
* associated with that device.
* associated with that device.
*
*
* Return
s
: the quirks.
* Return: the quirks.
*/
*/
static
unsigned
long
hid_gets_squirk
(
const
struct
hid_device
*
hdev
)
static
unsigned
long
hid_gets_squirk
(
const
struct
hid_device
*
hdev
)
{
{
...
@@ -1225,13 +1228,13 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev)
...
@@ -1225,13 +1228,13 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev)
}
}
/**
/**
* hid_lookup_quirk
:
return any quirks associated with a HID device
* hid_lookup_quirk
-
return any quirks associated with a HID device
* @hdev: the HID device to look for
* @hdev: the HID device to look for
*
*
* Description:
* Description:
* Given a HID device, return any quirks associated with that device.
* Given a HID device, return any quirks associated with that device.
*
*
* Return
s
: an unsigned long quirks value.
* Return: an unsigned long quirks value.
*/
*/
unsigned
long
hid_lookup_quirk
(
const
struct
hid_device
*
hdev
)
unsigned
long
hid_lookup_quirk
(
const
struct
hid_device
*
hdev
)
{
{
...
...
include/linux/hid-sensor-hub.h
View file @
f8dd50e0
...
@@ -150,7 +150,7 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
...
@@ -150,7 +150,7 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
* @info: return information about attribute after parsing report
* @info: return information about attribute after parsing report
*
*
* Parses report and returns the attribute information such as report id,
* Parses report and returns the attribute information such as report id,
* field index, units and exponet etc.
* field index, units and expone
n
t etc.
*/
*/
int
sensor_hub_input_get_attribute_info
(
struct
hid_sensor_hub_device
*
hsdev
,
int
sensor_hub_input_get_attribute_info
(
struct
hid_sensor_hub_device
*
hsdev
,
u8
type
,
u8
type
,
...
@@ -167,7 +167,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
...
@@ -167,7 +167,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
* @is_signed: If true then fields < 32 bits will be sign-extended
* @is_signed: If true then fields < 32 bits will be sign-extended
*
*
* Issues a synchronous or asynchronous read request for an input attribute.
* Issues a synchronous or asynchronous read request for an input attribute.
* Return
s data up
to 32 bits.
* Return
: data up
to 32 bits.
*/
*/
enum
sensor_hub_read_flags
{
enum
sensor_hub_read_flags
{
...
@@ -205,8 +205,9 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
...
@@ -205,8 +205,9 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
* @buffer: buffer to copy output
* @buffer: buffer to copy output
*
*
* Used to get a field in feature report. For example this can get polling
* Used to get a field in feature report. For example this can get polling
* interval, sensitivity, activate/deactivate state. On success it returns
* interval, sensitivity, activate/deactivate state.
* number of bytes copied to buffer. On failure, it returns value < 0.
* Return: On success, it returns the number of bytes copied to buffer.
* On failure, it returns value < 0.
*/
*/
int
sensor_hub_get_feature
(
struct
hid_sensor_hub_device
*
hsdev
,
u32
report_id
,
int
sensor_hub_get_feature
(
struct
hid_sensor_hub_device
*
hsdev
,
u32
report_id
,
u32
field_index
,
int
buffer_size
,
void
*
buffer
);
u32
field_index
,
int
buffer_size
,
void
*
buffer
);
...
...
include/linux/hid.h
View file @
f8dd50e0
...
@@ -918,7 +918,7 @@ __u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
...
@@ -918,7 +918,7 @@ __u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
/**
/**
* hid_device_io_start - enable HID input during probe, remove
* hid_device_io_start - enable HID input during probe, remove
*
*
* @hid
-
the device
* @hid
:
the device
*
*
* This should only be called during probe or remove and only be
* This should only be called during probe or remove and only be
* called by the thread calling probe or remove. It will allow
* called by the thread calling probe or remove. It will allow
...
@@ -936,7 +936,7 @@ static inline void hid_device_io_start(struct hid_device *hid) {
...
@@ -936,7 +936,7 @@ static inline void hid_device_io_start(struct hid_device *hid) {
/**
/**
* hid_device_io_stop - disable HID input during probe, remove
* hid_device_io_stop - disable HID input during probe, remove
*
*
* @hid
-
the device
* @hid
:
the device
*
*
* Should only be called after hid_device_io_start. It will prevent
* Should only be called after hid_device_io_start. It will prevent
* incoming packets from going to the driver for the duration of
* incoming packets from going to the driver for the duration of
...
@@ -1010,6 +1010,13 @@ static inline void hid_map_usage(struct hid_input *hidinput,
...
@@ -1010,6 +1010,13 @@ static inline void hid_map_usage(struct hid_input *hidinput,
/**
/**
* hid_map_usage_clear - map usage input bits and clear the input bit
* hid_map_usage_clear - map usage input bits and clear the input bit
*
*
* @hidinput: hidinput which we are interested in
* @usage: usage to fill in
* @bit: pointer to input->{}bit (out parameter)
* @max: maximal valid usage->code to consider later (out parameter)
* @type: input event type (EV_KEY, EV_REL, ...)
* @c: code which corresponds to this usage and type
*
* The same as hid_map_usage, except the @c bit is also cleared in supported
* The same as hid_map_usage, except the @c bit is also cleared in supported
* bits (@bit).
* bits (@bit).
*/
*/
...
@@ -1084,7 +1091,7 @@ static inline void hid_hw_request(struct hid_device *hdev,
...
@@ -1084,7 +1091,7 @@ static inline void hid_hw_request(struct hid_device *hdev,
* @rtype: HID report type
* @rtype: HID report type
* @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
* @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
*
*
*
@return: count of data transfe
red, negative if error
*
Return: count of data transfer
red, negative if error
*
*
* Same behavior as hid_hw_request, but with raw buffers instead.
* Same behavior as hid_hw_request, but with raw buffers instead.
*/
*/
...
@@ -1106,7 +1113,7 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
...
@@ -1106,7 +1113,7 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
* @buf: raw data to transfer
* @buf: raw data to transfer
* @len: length of buf
* @len: length of buf
*
*
*
@return: count of data transfe
red, negative if error
*
Return: count of data transfer
red, negative if error
*/
*/
static
inline
int
hid_hw_output_report
(
struct
hid_device
*
hdev
,
__u8
*
buf
,
static
inline
int
hid_hw_output_report
(
struct
hid_device
*
hdev
,
__u8
*
buf
,
size_t
len
)
size_t
len
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment