OSDN Git Service

platform/chrome: wilco_ec: Add telemetry char device interface
authorNick Crews <ncrews@chromium.org>
Tue, 21 May 2019 19:20:45 +0000 (13:20 -0600)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Wed, 5 Jun 2019 08:14:50 +0000 (10:14 +0200)
commit1210d1e6bad1e7ccccb19627b880a50d7c15dd51
tree6bfb3e3ad96eaee3dee3cbb0f0cf7ad46baa4128
parentf7b0bc5eafa44941ddf92df6f46dd82cbfacec3e
platform/chrome: wilco_ec: Add telemetry char device interface

The Wilco Embedded Controller is able to send telemetry data
which is useful for enterprise applications. A daemon running on
the OS sends a command to the EC via a write() to a char device,
and can read the response with a read(). The write() request is
verified by the driver to ensure that it is performing only one
of the whitelisted commands, and that no extraneous data is
being transmitted to the EC. The response is passed directly
back to the reader with no modification.

The character device will appear as /dev/wilco_telemN, where N
is some small non-negative integer, starting with 0. Only one
process may have the file descriptor open at a time. The calling
userspace program needs to keep the device file descriptor open
between the calls to write() and read() in order to preserve the
response. Up to 32 bytes will be available for reading.

For testing purposes, try requesting the EC's firmware build
date, by sending the WILCO_EC_TELEM_GET_VERSION command with
argument index=3. i.e. write [0x38, 0x00, 0x03]
to the device node. An ASCII string of the build date is
returned.

Signed-off-by: Nick Crews <ncrews@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/platform/chrome/wilco_ec/Kconfig
drivers/platform/chrome/wilco_ec/Makefile
drivers/platform/chrome/wilco_ec/core.c
drivers/platform/chrome/wilco_ec/debugfs.c
drivers/platform/chrome/wilco_ec/telemetry.c [new file with mode: 0644]
include/linux/platform_data/wilco-ec.h