summaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome/wilco_ec/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* platform/chrome: wilco_ec: Add keyboard backlight LED supportDaniel Campello2019-11-191-1/+2
| | | | | | | | | | | | | | The EC is in charge of controlling the keyboard backlight on the Wilco platform. We expose a standard LED class device named platform::kbd_backlight. Since the EC will never change the backlight level of its own accord, we don't need to implement a brightness_get() method. Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Daniel Campello <campello@chromium.org> Reviewed-by: Daniel Campello <campello@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add telemetry char device interfaceNick Crews2019-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* platform/chrome: wilco_ec: Add event handlingNick Crews2019-06-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Wilco Embedded Controller can create custom events that are not handled as standard ACPI objects. These events can contain information about changes in EC controlled features, such as errors and events in the dock or display. For example, an event is triggered if the dock is plugged into a display incorrectly. These events are needed for telemetry and diagnostics reasons, and for possibly alerting the user. These events are triggered by the EC with an ACPI Notify(0x90), and then the BIOS reads the event buffer from EC RAM via an ACPI method. When the OS receives these events via ACPI, it passes them along to this driver. The events are put into a queue which can be read by a userspace daemon via a char device that implements read() and poll(). The event queue acts as a circular buffer of size 64, so if there are no userspace consumers the kernel will not run out of memory. The char device will appear at /dev/wilco_event{n}, where n is some small non-negative integer, starting from 0. Standard ACPI events such as the battery getting plugged/unplugged can also come through this path, but they are dealt with via other paths, and are ignored here. To test, you can tail the binary data with $ cat /dev/wilco_event0 | hexdump -ve '1/1 "%x\n"' and then create an event by plugging/unplugging the battery. Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add Boot on AC supportNick Crews2019-05-201-1/+1
| | | | | | | | | Boot on AC is a policy which makes the device boot from S5 when AC power is connected. This is useful for users who want to run their device headless or with a dock. Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add property helper libraryNick Crews2019-05-201-1/+1
| | | | | | | | | | | | | | | | A Property is typically a data item that is stored to NVRAM by the EC. Each of these data items has an index associated with it, known as the Property ID (PID). Properties may have variable lengths, up to a max of WILCO_EC_PROPERTY_MAX_SIZE bytes. Properties can be simple integers, or they may be more complex binary data. This patch adds support for getting and setting properties. This will be useful for setting the charge algorithm and charge schedules, which all use properties. Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add support for raw commands in debugfsNick Crews2019-02-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a debugfs attribute that allows sending raw commands to the EC. This is useful for development and debug but should not be enabled in a production environment. To test: Get the EC firmware build date First send the request command > echo 00 f0 38 00 03 00 > raw Then read the result. "12/21/18" is in the middle of the response > cat raw 00 31 32 2f 32 31 2f 31 38 00 00 0f 01 00 01 00 .12/21/18....... Get the EC firmware build date First send the request command > echo 00 f0 38 00 03 00 > raw Then read the result. "12/21/18" is in the middle of the response > cat raw 00 31 32 2f 32 31 2f 31 38 00 00 0f 01 00 01 00 .12/21/18....... Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> [Fix off-by-one error in wilco_ec/debugfs.c] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: Add new driver for Wilco ECNick Crews2019-02-211-0/+4
This EC is an incompatible variant of the typical Chrome OS embedded controller. It uses the same low-level communication and a similar protocol with some significant differences. The EC firmware does not support the same mailbox commands so it is not registered as a cros_ec device type. This commit exports the wilco_ec_mailbox() function so that other modules can use it to communicate with the EC. Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> [Fix the sparse warning: symbol 'wilco_ec_transfer' was not declared] Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> [Fix Kconfig dependencies for wilco_ec] Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>