xref: /OK3568_Linux_fs/kernel/Documentation/hid/intel-ish-hid.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=================================
2*4882a593SmuzhiyunIntel Integrated Sensor Hub (ISH)
3*4882a593Smuzhiyun=================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunA sensor hub enables the ability to offload sensor polling and algorithm
6*4882a593Smuzhiyunprocessing to a dedicated low power co-processor. This allows the core
7*4882a593Smuzhiyunprocessor to go into low power modes more often, resulting in the increased
8*4882a593Smuzhiyunbattery life.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunThere are many vendors providing external sensor hubs confirming to HID
11*4882a593SmuzhiyunSensor usage tables, and used in several tablets, 2 in 1 convertible laptops
12*4882a593Smuzhiyunand embedded products. Linux had this support since Linux 3.9.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunIntel® introduced integrated sensor hubs as a part of the SoC starting from
15*4882a593SmuzhiyunCherry Trail and now supported on multiple generations of CPU packages. There
16*4882a593Smuzhiyunare many commercial devices already shipped with Integrated Sensor Hubs (ISH).
17*4882a593SmuzhiyunThese ISH also comply to HID sensor specification, but the  difference is the
18*4882a593Smuzhiyuntransport protocol used for communication. The current external sensor hubs
19*4882a593Smuzhiyunmainly use HID over i2C or USB. But ISH doesn't use either i2c or USB.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun1. Overview
22*4882a593Smuzhiyun===========
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunUsing a analogy with a usbhid implementation, the ISH follows a similar model
25*4882a593Smuzhiyunfor a very high speed communication::
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun	-----------------		----------------------
28*4882a593Smuzhiyun	|    USB HID	|	-->	|    ISH HID	     |
29*4882a593Smuzhiyun	-----------------		----------------------
30*4882a593Smuzhiyun	-----------------		----------------------
31*4882a593Smuzhiyun	|  USB protocol	|	-->	|    ISH Transport   |
32*4882a593Smuzhiyun	-----------------		----------------------
33*4882a593Smuzhiyun	-----------------		----------------------
34*4882a593Smuzhiyun	|  EHCI/XHCI	|	-->	|    ISH IPC	     |
35*4882a593Smuzhiyun	-----------------		----------------------
36*4882a593Smuzhiyun	      PCI				 PCI
37*4882a593Smuzhiyun	-----------------		----------------------
38*4882a593Smuzhiyun        |Host controller|	-->	|    ISH processor   |
39*4882a593Smuzhiyun	-----------------		----------------------
40*4882a593Smuzhiyun	     USB Link
41*4882a593Smuzhiyun	-----------------		----------------------
42*4882a593Smuzhiyun	| USB End points|	-->	|    ISH Clients     |
43*4882a593Smuzhiyun	-----------------		----------------------
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunLike USB protocol provides a method for device enumeration, link management
46*4882a593Smuzhiyunand user data encapsulation, the ISH also provides similar services. But it is
47*4882a593Smuzhiyunvery light weight tailored to manage and communicate with ISH client
48*4882a593Smuzhiyunapplications implemented in the firmware.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunThe ISH allows multiple sensor management applications executing in the
51*4882a593Smuzhiyunfirmware. Like USB endpoints the messaging can be to/from a client. As part of
52*4882a593Smuzhiyunenumeration process, these clients are identified. These clients can be simple
53*4882a593SmuzhiyunHID sensor applications, sensor calibration application or senor firmware
54*4882a593Smuzhiyunupdate application.
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunThe implementation model is similar, like USB bus, ISH transport is also
57*4882a593Smuzhiyunimplemented as a bus. Each client application executing in the ISH processor
58*4882a593Smuzhiyunis registered as a device on this bus. The driver, which binds each device
59*4882a593Smuzhiyun(ISH HID driver) identifies the device type and registers with the hid core.
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun2. ISH Implementation: Block Diagram
62*4882a593Smuzhiyun====================================
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun::
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun	 ---------------------------
67*4882a593Smuzhiyun	|  User Space Applications  |
68*4882a593Smuzhiyun	 ---------------------------
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun  ----------------IIO ABI----------------
71*4882a593Smuzhiyun	 --------------------------
72*4882a593Smuzhiyun	|  IIO Sensor Drivers	  |
73*4882a593Smuzhiyun	 --------------------------
74*4882a593Smuzhiyun	 --------------------------
75*4882a593Smuzhiyun	|	 IIO core	  |
76*4882a593Smuzhiyun	 --------------------------
77*4882a593Smuzhiyun	 --------------------------
78*4882a593Smuzhiyun	|   HID Sensor Hub MFD	  |
79*4882a593Smuzhiyun	 --------------------------
80*4882a593Smuzhiyun	 --------------------------
81*4882a593Smuzhiyun	|       HID Core	  |
82*4882a593Smuzhiyun	 --------------------------
83*4882a593Smuzhiyun	 --------------------------
84*4882a593Smuzhiyun	|   HID over ISH Client   |
85*4882a593Smuzhiyun	 --------------------------
86*4882a593Smuzhiyun	 --------------------------
87*4882a593Smuzhiyun	|   ISH Transport (ISHTP) |
88*4882a593Smuzhiyun	 --------------------------
89*4882a593Smuzhiyun	 --------------------------
90*4882a593Smuzhiyun	|      IPC Drivers	  |
91*4882a593Smuzhiyun	 --------------------------
92*4882a593Smuzhiyun  OS
93*4882a593Smuzhiyun  ---------------- PCI -----------------
94*4882a593Smuzhiyun  Hardware + Firmware
95*4882a593Smuzhiyun	 ----------------------------
96*4882a593Smuzhiyun	| ISH Hardware/Firmware(FW) |
97*4882a593Smuzhiyun	 ----------------------------
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun3. High level processing in above blocks
100*4882a593Smuzhiyun========================================
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun3.1 Hardware Interface
103*4882a593Smuzhiyun----------------------
104*4882a593Smuzhiyun
105*4882a593SmuzhiyunThe ISH is exposed as "Non-VGA unclassified PCI device" to the host. The PCI
106*4882a593Smuzhiyunproduct and vendor IDs are changed from different generations of processors. So
107*4882a593Smuzhiyunthe source code which enumerate drivers needs to update from generation to
108*4882a593Smuzhiyungeneration.
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun3.2 Inter Processor Communication (IPC) driver
111*4882a593Smuzhiyun----------------------------------------------
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunLocation: drivers/hid/intel-ish-hid/ipc
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunThe IPC message used memory mapped I/O. The registers are defined in
116*4882a593Smuzhiyunhw-ish-regs.h.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun3.2.1 IPC/FW message types
119*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunThere are two types of messages, one for management of link and other messages
122*4882a593Smuzhiyunare to and from transport layers.
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunTX and RX of Transport messages
125*4882a593Smuzhiyun...............................
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunA set of memory mapped register offers support of multi byte messages TX and
128*4882a593SmuzhiyunRX (E.g.IPC_REG_ISH2HOST_MSG, IPC_REG_HOST2ISH_MSG). The IPC layer maintains
129*4882a593Smuzhiyuninternal queues to sequence messages and send them in order to the FW.
130*4882a593SmuzhiyunOptionally the caller can register handler to get notification of completion.
131*4882a593SmuzhiyunA door bell mechanism is used in messaging to trigger processing in host and
132*4882a593Smuzhiyunclient firmware side. When ISH interrupt handler is called, the ISH2HOST
133*4882a593Smuzhiyundoorbell register is used by host drivers to determine that the interrupt
134*4882a593Smuzhiyunis for ISH.
135*4882a593Smuzhiyun
136*4882a593SmuzhiyunEach side has 32 32-bit message registers and a 32-bit doorbell. Doorbell
137*4882a593Smuzhiyunregister has the following format:
138*4882a593SmuzhiyunBits 0..6: fragment length (7 bits are used)
139*4882a593SmuzhiyunBits 10..13: encapsulated protocol
140*4882a593SmuzhiyunBits 16..19: management command (for IPC management protocol)
141*4882a593SmuzhiyunBit 31: doorbell trigger (signal H/W interrupt to the other side)
142*4882a593SmuzhiyunOther bits are reserved, should be 0.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun3.2.2 Transport layer interface
145*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146*4882a593Smuzhiyun
147*4882a593SmuzhiyunTo abstract HW level IPC communication, a set of callbacks are registered.
148*4882a593SmuzhiyunThe transport layer uses them to send and receive messages.
149*4882a593SmuzhiyunRefer to  struct ishtp_hw_ops for callbacks.
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun3.3 ISH Transport layer
152*4882a593Smuzhiyun-----------------------
153*4882a593Smuzhiyun
154*4882a593SmuzhiyunLocation: drivers/hid/intel-ish-hid/ishtp/
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun3.3.1 A Generic Transport Layer
157*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158*4882a593Smuzhiyun
159*4882a593SmuzhiyunThe transport layer is a bi-directional protocol, which defines:
160*4882a593Smuzhiyun- Set of commands to start, stop, connect, disconnect and flow control
161*4882a593Smuzhiyun(ishtp/hbm.h) for details
162*4882a593Smuzhiyun- A flow control mechanism to avoid buffer overflows
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThis protocol resembles bus messages described in the following document:
165*4882a593Smuzhiyunhttp://www.intel.com/content/dam/www/public/us/en/documents/technical-\
166*4882a593Smuzhiyunspecifications/dcmi-hi-1-0-spec.pdf "Chapter 7: Bus Message Layer"
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun3.3.2 Connection and Flow Control Mechanism
169*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunEach FW client and a protocol is identified by an UUID. In order to communicate
172*4882a593Smuzhiyunto a FW client, a connection must be established using connect request and
173*4882a593Smuzhiyunresponse bus messages. If successful, a pair (host_client_id and fw_client_id)
174*4882a593Smuzhiyunwill identify the connection.
175*4882a593Smuzhiyun
176*4882a593SmuzhiyunOnce connection is established, peers send each other flow control bus messages
177*4882a593Smuzhiyunindependently. Every peer may send a message only if it has received a
178*4882a593Smuzhiyunflow-control credit before. Once it sent a message, it may not send another one
179*4882a593Smuzhiyunbefore receiving the next flow control credit.
180*4882a593SmuzhiyunEither side can send disconnect request bus message to end communication. Also
181*4882a593Smuzhiyunthe link will be dropped if major FW reset occurs.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun3.3.3 Peer to Peer data transfer
184*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185*4882a593Smuzhiyun
186*4882a593SmuzhiyunPeer to Peer data transfer can happen with or without using DMA. Depending on
187*4882a593Smuzhiyunthe sensor bandwidth requirement DMA can be enabled by using module parameter
188*4882a593Smuzhiyunishtp_use_dma under intel_ishtp.
189*4882a593Smuzhiyun
190*4882a593SmuzhiyunEach side (host and FW) manages its DMA transfer memory independently. When an
191*4882a593SmuzhiyunISHTP client from either host or FW side wants to send something, it decides
192*4882a593Smuzhiyunwhether to send over IPC or over DMA; for each transfer the decision is
193*4882a593Smuzhiyunindependent. The sending side sends DMA_XFER message when the message is in
194*4882a593Smuzhiyunthe respective host buffer (TX when host client sends, RX when FW client
195*4882a593Smuzhiyunsends). The recipient of DMA message responds with DMA_XFER_ACK, indicating
196*4882a593Smuzhiyunthe sender that the memory region for that message may be reused.
197*4882a593Smuzhiyun
198*4882a593SmuzhiyunDMA initialization is started with host sending DMA_ALLOC_NOTIFY bus message
199*4882a593Smuzhiyun(that includes RX buffer) and FW responds with DMA_ALLOC_NOTIFY_ACK.
200*4882a593SmuzhiyunAdditionally to DMA address communication, this sequence checks capabilities:
201*4882a593Smuzhiyunif thw host doesn't support DMA, then it won't send DMA allocation, so FW can't
202*4882a593Smuzhiyunsend DMA; if FW doesn't support DMA then it won't respond with
203*4882a593SmuzhiyunDMA_ALLOC_NOTIFY_ACK, in which case host will not use DMA transfers.
204*4882a593SmuzhiyunHere ISH acts as busmaster DMA controller. Hence when host sends DMA_XFER,
205*4882a593Smuzhiyunit's request to do host->ISH DMA transfer; when FW sends DMA_XFER, it means
206*4882a593Smuzhiyunthat it already did DMA and the message resides at host. Thus, DMA_XFER
207*4882a593Smuzhiyunand DMA_XFER_ACK act as ownership indicators.
208*4882a593Smuzhiyun
209*4882a593SmuzhiyunAt initial state all outgoing memory belongs to the sender (TX to host, RX to
210*4882a593SmuzhiyunFW), DMA_XFER transfers ownership on the region that contains ISHTP message to
211*4882a593Smuzhiyunthe receiving side, DMA_XFER_ACK returns ownership to the sender. A sender
212*4882a593Smuzhiyunneeds not wait for previous DMA_XFER to be ack'ed, and may send another message
213*4882a593Smuzhiyunas long as remaining continuous memory in its ownership is enough.
214*4882a593SmuzhiyunIn principle, multiple DMA_XFER and DMA_XFER_ACK messages may be sent at once
215*4882a593Smuzhiyun(up to IPC MTU), thus allowing for interrupt throttling.
216*4882a593SmuzhiyunCurrently, ISH FW decides to send over DMA if ISHTP message is more than 3 IPC
217*4882a593Smuzhiyunfragments and via IPC otherwise.
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun3.3.4 Ring Buffers
220*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^
221*4882a593Smuzhiyun
222*4882a593SmuzhiyunWhen a client initiate a connection, a ring or RX and TX buffers are allocated.
223*4882a593SmuzhiyunThe size of ring can be specified by the client. HID client set 16 and 32 for
224*4882a593SmuzhiyunTX and RX buffers respectively. On send request from client, the data to be
225*4882a593Smuzhiyunsent is copied to one of the send ring buffer and scheduled to be sent using
226*4882a593Smuzhiyunbus message protocol. These buffers are required because the FW may have not
227*4882a593Smuzhiyunhave processed the last message and may not have enough flow control credits
228*4882a593Smuzhiyunto send. Same thing holds true on receive side and flow control is required.
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun3.3.5 Host Enumeration
231*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunThe host enumeration bus command allow discovery of clients present in the FW.
234*4882a593SmuzhiyunThere can be multiple sensor clients and clients for calibration function.
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunTo ease in implantation and allow independent driver handle each client
237*4882a593Smuzhiyunthis transport layer takes advantage of Linux Bus driver model. Each
238*4882a593Smuzhiyunclient is registered as device on the transport bus (ishtp bus).
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunEnumeration sequence of messages:
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun- Host sends HOST_START_REQ_CMD, indicating that host ISHTP layer is up.
243*4882a593Smuzhiyun- FW responds with HOST_START_RES_CMD
244*4882a593Smuzhiyun- Host sends HOST_ENUM_REQ_CMD (enumerate FW clients)
245*4882a593Smuzhiyun- FW responds with HOST_ENUM_RES_CMD that includes bitmap of available FW
246*4882a593Smuzhiyun  client IDs
247*4882a593Smuzhiyun- For each FW ID found in that bitmap host sends
248*4882a593Smuzhiyun  HOST_CLIENT_PROPERTIES_REQ_CMD
249*4882a593Smuzhiyun- FW responds with HOST_CLIENT_PROPERTIES_RES_CMD. Properties include UUID,
250*4882a593Smuzhiyun  max ISHTP message size, etc.
251*4882a593Smuzhiyun- Once host received properties for that last discovered client, it considers
252*4882a593Smuzhiyun  ISHTP device fully functional (and allocates DMA buffers)
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun3.4 HID over ISH Client
255*4882a593Smuzhiyun-----------------------
256*4882a593Smuzhiyun
257*4882a593SmuzhiyunLocation: drivers/hid/intel-ish-hid
258*4882a593Smuzhiyun
259*4882a593SmuzhiyunThe ISHTP client driver is responsible for:
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun- enumerate HID devices under FW ISH client
262*4882a593Smuzhiyun- Get Report descriptor
263*4882a593Smuzhiyun- Register with HID core as a LL driver
264*4882a593Smuzhiyun- Process Get/Set feature request
265*4882a593Smuzhiyun- Get input reports
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun3.5 HID Sensor Hub MFD and IIO sensor drivers
268*4882a593Smuzhiyun---------------------------------------------
269*4882a593Smuzhiyun
270*4882a593SmuzhiyunThe functionality in these drivers is the same as an external sensor hub.
271*4882a593SmuzhiyunRefer to
272*4882a593SmuzhiyunDocumentation/hid/hid-sensor.rst for HID sensor
273*4882a593SmuzhiyunDocumentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space
274*4882a593Smuzhiyun
275*4882a593Smuzhiyun3.6 End to End HID transport Sequence Diagram
276*4882a593Smuzhiyun---------------------------------------------
277*4882a593Smuzhiyun
278*4882a593Smuzhiyun::
279*4882a593Smuzhiyun
280*4882a593Smuzhiyun  HID-ISH-CLN                    ISHTP                    IPC                             HW
281*4882a593Smuzhiyun          |                        |                       |                               |
282*4882a593Smuzhiyun          |                        |                       |-----WAKE UP------------------>|
283*4882a593Smuzhiyun          |                        |                       |                               |
284*4882a593Smuzhiyun          |                        |                       |-----HOST READY--------------->|
285*4882a593Smuzhiyun          |                        |                       |                               |
286*4882a593Smuzhiyun          |                        |                       |<----MNG_RESET_NOTIFY_ACK----- |
287*4882a593Smuzhiyun          |                        |                       |                               |
288*4882a593Smuzhiyun          |                        |<----ISHTP_START------ |                               |
289*4882a593Smuzhiyun          |                        |                       |                               |
290*4882a593Smuzhiyun          |                        |<-----------------HOST_START_RES_CMD-------------------|
291*4882a593Smuzhiyun          |                        |                       |                               |
292*4882a593Smuzhiyun          |                        |------------------QUERY_SUBSCRIBER-------------------->|
293*4882a593Smuzhiyun          |                        |                       |                               |
294*4882a593Smuzhiyun          |                        |------------------HOST_ENUM_REQ_CMD------------------->|
295*4882a593Smuzhiyun          |                        |                       |                               |
296*4882a593Smuzhiyun          |                        |<-----------------HOST_ENUM_RES_CMD--------------------|
297*4882a593Smuzhiyun          |                        |                       |                               |
298*4882a593Smuzhiyun          |                        |------------------HOST_CLIENT_PROPERTIES_REQ_CMD------>|
299*4882a593Smuzhiyun          |                        |                       |                               |
300*4882a593Smuzhiyun          |                        |<-----------------HOST_CLIENT_PROPERTIES_RES_CMD-------|
301*4882a593Smuzhiyun          |       Create new device on in ishtp bus        |                               |
302*4882a593Smuzhiyun          |                        |                       |                               |
303*4882a593Smuzhiyun          |                        |------------------HOST_CLIENT_PROPERTIES_REQ_CMD------>|
304*4882a593Smuzhiyun          |                        |                       |                               |
305*4882a593Smuzhiyun          |                        |<-----------------HOST_CLIENT_PROPERTIES_RES_CMD-------|
306*4882a593Smuzhiyun          |       Create new device on in ishtp bus        |                               |
307*4882a593Smuzhiyun          |                        |                       |                               |
308*4882a593Smuzhiyun          |                        |--Repeat HOST_CLIENT_PROPERTIES_REQ_CMD-till last one--|
309*4882a593Smuzhiyun          |                        |                       |                               |
310*4882a593Smuzhiyun       probed()
311*4882a593Smuzhiyun          |----ishtp_cl_connect--->|----------------- CLIENT_CONNECT_REQ_CMD-------------->|
312*4882a593Smuzhiyun          |                        |                       |                               |
313*4882a593Smuzhiyun          |                        |<----------------CLIENT_CONNECT_RES_CMD----------------|
314*4882a593Smuzhiyun          |                        |                       |                               |
315*4882a593Smuzhiyun          |register event callback |                       |                               |
316*4882a593Smuzhiyun          |                        |                       |                               |
317*4882a593Smuzhiyun          |ishtp_cl_send(
318*4882a593Smuzhiyun          HOSTIF_DM_ENUM_DEVICES)  |----------fill ishtp_msg_hdr struct write to HW-----  >|
319*4882a593Smuzhiyun          |                        |                       |                               |
320*4882a593Smuzhiyun          |                        |                       |<-----IRQ(IPC_PROTOCOL_ISHTP---|
321*4882a593Smuzhiyun          |                        |                       |                               |
322*4882a593Smuzhiyun          |<--ENUM_DEVICE RSP------|                       |                               |
323*4882a593Smuzhiyun          |                        |                       |                               |
324*4882a593Smuzhiyun  for each enumerated device
325*4882a593Smuzhiyun          |ishtp_cl_send(
326*4882a593Smuzhiyun          HOSTIF_GET_HID_DESCRIPTOR|----------fill ishtp_msg_hdr struct write to HW-----  >|
327*4882a593Smuzhiyun          |                        |                       |                               |
328*4882a593Smuzhiyun          ...Response
329*4882a593Smuzhiyun          |                        |                       |                               |
330*4882a593Smuzhiyun  for each enumerated device
331*4882a593Smuzhiyun          |ishtp_cl_send(
332*4882a593Smuzhiyun       HOSTIF_GET_REPORT_DESCRIPTOR|--------------fill ishtp_msg_hdr struct write to HW-- >|
333*4882a593Smuzhiyun          |                        |                       |                               |
334*4882a593Smuzhiyun          |                        |                       |                               |
335*4882a593Smuzhiyun   hid_allocate_device
336*4882a593Smuzhiyun          |                        |                       |                               |
337*4882a593Smuzhiyun   hid_add_device                  |                       |                               |
338*4882a593Smuzhiyun          |                        |                       |                               |
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun
341*4882a593Smuzhiyun3.7 ISH Debugging
342*4882a593Smuzhiyun-----------------
343*4882a593Smuzhiyun
344*4882a593SmuzhiyunTo debug ISH, event tracing mechanism is used. To enable debug logs
345*4882a593Smuzhiyunecho 1 > /sys/kernel/debug/tracing/events/intel_ish/enable
346*4882a593Smuzhiyuncat sys/kernel/debug/tracing/trace
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
349*4882a593Smuzhiyun-----------------------------------------------------
350*4882a593Smuzhiyun
351*4882a593Smuzhiyun::
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun  root@otcpl-ThinkPad-Yoga-260:~# tree -l /sys/bus/iio/devices/
354*4882a593Smuzhiyun  /sys/bus/iio/devices/
355*4882a593Smuzhiyun  ├── iio:device0 -> ../../../devices/0044:8086:22D8.0001/HID-SENSOR-200073.9.auto/iio:device0
356*4882a593Smuzhiyun  │   ├── buffer
357*4882a593Smuzhiyun  │   │   ├── enable
358*4882a593Smuzhiyun  │   │   ├── length
359*4882a593Smuzhiyun  │   │   └── watermark
360*4882a593Smuzhiyun  ...
361*4882a593Smuzhiyun  │   ├── in_accel_hysteresis
362*4882a593Smuzhiyun  │   ├── in_accel_offset
363*4882a593Smuzhiyun  │   ├── in_accel_sampling_frequency
364*4882a593Smuzhiyun  │   ├── in_accel_scale
365*4882a593Smuzhiyun  │   ├── in_accel_x_raw
366*4882a593Smuzhiyun  │   ├── in_accel_y_raw
367*4882a593Smuzhiyun  │   ├── in_accel_z_raw
368*4882a593Smuzhiyun  │   ├── name
369*4882a593Smuzhiyun  │   ├── scan_elements
370*4882a593Smuzhiyun  │   │   ├── in_accel_x_en
371*4882a593Smuzhiyun  │   │   ├── in_accel_x_index
372*4882a593Smuzhiyun  │   │   ├── in_accel_x_type
373*4882a593Smuzhiyun  │   │   ├── in_accel_y_en
374*4882a593Smuzhiyun  │   │   ├── in_accel_y_index
375*4882a593Smuzhiyun  │   │   ├── in_accel_y_type
376*4882a593Smuzhiyun  │   │   ├── in_accel_z_en
377*4882a593Smuzhiyun  │   │   ├── in_accel_z_index
378*4882a593Smuzhiyun  │   │   └── in_accel_z_type
379*4882a593Smuzhiyun  ...
380*4882a593Smuzhiyun  │   │   ├── devices
381*4882a593Smuzhiyun  │   │   │   │   ├── buffer
382*4882a593Smuzhiyun  │   │   │   │   │   ├── enable
383*4882a593Smuzhiyun  │   │   │   │   │   ├── length
384*4882a593Smuzhiyun  │   │   │   │   │   └── watermark
385*4882a593Smuzhiyun  │   │   │   │   ├── dev
386*4882a593Smuzhiyun  │   │   │   │   ├── in_intensity_both_raw
387*4882a593Smuzhiyun  │   │   │   │   ├── in_intensity_hysteresis
388*4882a593Smuzhiyun  │   │   │   │   ├── in_intensity_offset
389*4882a593Smuzhiyun  │   │   │   │   ├── in_intensity_sampling_frequency
390*4882a593Smuzhiyun  │   │   │   │   ├── in_intensity_scale
391*4882a593Smuzhiyun  │   │   │   │   ├── name
392*4882a593Smuzhiyun  │   │   │   │   ├── scan_elements
393*4882a593Smuzhiyun  │   │   │   │   │   ├── in_intensity_both_en
394*4882a593Smuzhiyun  │   │   │   │   │   ├── in_intensity_both_index
395*4882a593Smuzhiyun  │   │   │   │   │   └── in_intensity_both_type
396*4882a593Smuzhiyun  │   │   │   │   ├── trigger
397*4882a593Smuzhiyun  │   │   │   │   │   └── current_trigger
398*4882a593Smuzhiyun  ...
399*4882a593Smuzhiyun  │   │   │   │   ├── buffer
400*4882a593Smuzhiyun  │   │   │   │   │   ├── enable
401*4882a593Smuzhiyun  │   │   │   │   │   ├── length
402*4882a593Smuzhiyun  │   │   │   │   │   └── watermark
403*4882a593Smuzhiyun  │   │   │   │   ├── dev
404*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_hysteresis
405*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_offset
406*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_sampling_frequency
407*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_scale
408*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_x_raw
409*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_y_raw
410*4882a593Smuzhiyun  │   │   │   │   ├── in_magn_z_raw
411*4882a593Smuzhiyun  │   │   │   │   ├── in_rot_from_north_magnetic_tilt_comp_raw
412*4882a593Smuzhiyun  │   │   │   │   ├── in_rot_hysteresis
413*4882a593Smuzhiyun  │   │   │   │   ├── in_rot_offset
414*4882a593Smuzhiyun  │   │   │   │   ├── in_rot_sampling_frequency
415*4882a593Smuzhiyun  │   │   │   │   ├── in_rot_scale
416*4882a593Smuzhiyun  │   │   │   │   ├── name
417*4882a593Smuzhiyun  ...
418*4882a593Smuzhiyun  │   │   │   │   ├── scan_elements
419*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_x_en
420*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_x_index
421*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_x_type
422*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_y_en
423*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_y_index
424*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_y_type
425*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_z_en
426*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_z_index
427*4882a593Smuzhiyun  │   │   │   │   │   ├── in_magn_z_type
428*4882a593Smuzhiyun  │   │   │   │   │   ├── in_rot_from_north_magnetic_tilt_comp_en
429*4882a593Smuzhiyun  │   │   │   │   │   ├── in_rot_from_north_magnetic_tilt_comp_index
430*4882a593Smuzhiyun  │   │   │   │   │   └── in_rot_from_north_magnetic_tilt_comp_type
431*4882a593Smuzhiyun  │   │   │   │   ├── trigger
432*4882a593Smuzhiyun  │   │   │   │   │   └── current_trigger
433*4882a593Smuzhiyun  ...
434*4882a593Smuzhiyun  │   │   │   │   ├── buffer
435*4882a593Smuzhiyun  │   │   │   │   │   ├── enable
436*4882a593Smuzhiyun  │   │   │   │   │   ├── length
437*4882a593Smuzhiyun  │   │   │   │   │   └── watermark
438*4882a593Smuzhiyun  │   │   │   │   ├── dev
439*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_hysteresis
440*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_offset
441*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_sampling_frequency
442*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_scale
443*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_x_raw
444*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_y_raw
445*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_z_raw
446*4882a593Smuzhiyun  │   │   │   │   ├── name
447*4882a593Smuzhiyun  │   │   │   │   ├── scan_elements
448*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_en
449*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_index
450*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_type
451*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_en
452*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_index
453*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_type
454*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_z_en
455*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_z_index
456*4882a593Smuzhiyun  │   │   │   │   │   └── in_anglvel_z_type
457*4882a593Smuzhiyun  │   │   │   │   ├── trigger
458*4882a593Smuzhiyun  │   │   │   │   │   └── current_trigger
459*4882a593Smuzhiyun  ...
460*4882a593Smuzhiyun  │   │   │   │   ├── buffer
461*4882a593Smuzhiyun  │   │   │   │   │   ├── enable
462*4882a593Smuzhiyun  │   │   │   │   │   ├── length
463*4882a593Smuzhiyun  │   │   │   │   │   └── watermark
464*4882a593Smuzhiyun  │   │   │   │   ├── dev
465*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_hysteresis
466*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_offset
467*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_sampling_frequency
468*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_scale
469*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_x_raw
470*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_y_raw
471*4882a593Smuzhiyun  │   │   │   │   ├── in_anglvel_z_raw
472*4882a593Smuzhiyun  │   │   │   │   ├── name
473*4882a593Smuzhiyun  │   │   │   │   ├── scan_elements
474*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_en
475*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_index
476*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_x_type
477*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_en
478*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_index
479*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_y_type
480*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_z_en
481*4882a593Smuzhiyun  │   │   │   │   │   ├── in_anglvel_z_index
482*4882a593Smuzhiyun  │   │   │   │   │   └── in_anglvel_z_type
483*4882a593Smuzhiyun  │   │   │   │   ├── trigger
484*4882a593Smuzhiyun  │   │   │   │   │   └── current_trigger
485*4882a593Smuzhiyun  ...
486