platform/chrome: Create sysfs attributes for the ChromeOS EC
authorBill Richardson <wfrichar@chromium.org>
Mon, 2 Feb 2015 11:26:27 +0000 (12:26 +0100)
committerOlof Johansson <olof@lixom.net>
Thu, 26 Feb 2015 23:45:12 +0000 (15:45 -0800)
commit71af4b52cc22a8d0f7b66a51427a804741a045b6
treeff3821ad460186ba3fb2e1904d7181fa21add2c5
parent8a4be850b6a1eb8c7b910d98d3683a803ff5ddb4
platform/chrome: Create sysfs attributes for the ChromeOS EC

This adds the first few sysfs attributes for the Chrome OS EC. These
controls are made available under /sys/devices/virtual/chromeos/cros_ec

    flashinfo   - display current flash info
    reboot      - tell the EC to reboot in various ways
    version     - information about the EC software and hardware

Future changes will build on this to add additional controls.

From a root shell, you should be able to do things like this:

    cd /sys/devices/virtual/chromeos/cros_ec
    cat flashinfo
    cat version
    echo rw > reboot
    cat version
    echo ro > reboot
    cat version
    echo rw > reboot
    cat version
    echo cold > reboot

That last command will reboot the AP too.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/platform/chrome/Makefile
drivers/platform/chrome/cros_ec_dev.c
drivers/platform/chrome/cros_ec_dev.h
drivers/platform/chrome/cros_ec_sysfs.c [new file with mode: 0644]