^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) What: /sys/kernel/debug/wilco_ec/h1_gpio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Date: April 2019
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) KernelVersion: 5.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) As part of Chrome OS's FAFT (Fully Automated Firmware Testing)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) tests, we need to ensure that the H1 chip is properly setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) some GPIO lines. The h1_gpio attribute exposes the state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) of the lines:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) - ENTRY_TO_FACT_MODE in BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) - SPI_CHROME_SEL in BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) Output will formatted with "0x%02x\n".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) What: /sys/kernel/debug/wilco_ec/raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Date: January 2019
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) KernelVersion: 5.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) Write and read raw mailbox commands to the EC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) You can write a hexadecimal sentence to raw, and that series of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) bytes will be sent to the EC. Then, you can read the bytes of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) response by reading from raw.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) For writing, bytes 0-1 indicate the message type, one of enum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) wilco_ec_msg_type. Byte 2+ consist of the data passed in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) request, starting at MBOX[0]. At least three bytes are required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) for writing, two for the type and at least a single byte of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) // Request EC info type 3 (EC firmware build date)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) // Corresponds with sending type 0x00f0 with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) // MBOX = [38, 00, 03, 00]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) // View the result. The decoded ASCII result "12/21/18" is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) // included after the raw hex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) $ cat /sys/kernel/debug/wilco_ec/raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00 ..12/21/18.8...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) Note that the first 16 bytes of the received MBOX[] will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) printed, even if some of the data is junk, and skipping bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 17 to 32. It is up to you to know how many of the first bytes of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) data are the actual response.