xref: /linux/Documentation/ABI/testing/debugfs-wilco-ec (revision 14e14aaf61321ba30d0bbdf4c4668f260ca1141c)
1b787bb12SNick CrewsWhat:		/sys/kernel/debug/wilco_ec/raw
2b787bb12SNick CrewsDate:		January 2019
3b787bb12SNick CrewsKernelVersion:	5.1
4b787bb12SNick CrewsDescription:
5b787bb12SNick Crews		Write and read raw mailbox commands to the EC.
6b787bb12SNick Crews
7*14e14aafSNick Crews		You can write a hexadecimal sentence to raw, and that series of
8*14e14aafSNick Crews		bytes will be sent to the EC. Then, you can read the bytes of
9*14e14aafSNick Crews		response by reading from raw.
10b787bb12SNick Crews
11*14e14aafSNick Crews		For writing, bytes 0-1 indicate the message type, one of enum
12*14e14aafSNick Crews		wilco_ec_msg_type. Byte 2+ consist of the data passed in the
13*14e14aafSNick Crews		request, starting at MBOX[0]
14*14e14aafSNick Crews
15*14e14aafSNick Crews		At least three bytes are required for writing, two for the type
16*14e14aafSNick Crews		and at least a single byte of data. Only the first
17*14e14aafSNick Crews		EC_MAILBOX_DATA_SIZE bytes of MBOX will be used.
18b787bb12SNick Crews
19b787bb12SNick Crews		Example:
20b787bb12SNick Crews		// Request EC info type 3 (EC firmware build date)
21*14e14aafSNick Crews		// Corresponds with sending type 0x00f0 with
22*14e14aafSNick Crews		// MBOX = [38, 00, 03, 00]
23*14e14aafSNick Crews		$ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw
24b787bb12SNick Crews		// View the result. The decoded ASCII result "12/21/18" is
25b787bb12SNick Crews		// included after the raw hex.
26*14e14aafSNick Crews		// Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...]
27*14e14aafSNick Crews		$ cat /sys/kernel/debug/wilco_ec/raw
28*14e14aafSNick Crews		00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00  ..12/21/18.8...
29*14e14aafSNick Crews
30*14e14aafSNick Crews		Note that the first 32 bytes of the received MBOX[] will be
31*14e14aafSNick Crews		printed, even if some of the data is junk. It is up to you to
32*14e14aafSNick Crews		know how many of the first bytes of data are the actual
33*14e14aafSNick Crews		response.
34