Commit Graph

828 Commits

Author SHA1 Message Date
Tim Crawford 8de0e369e3 ec/system76/ec: Provide charging thresholds by default
Battery charging thresholds are a firmware implementation and not
dependent on any hardware. It is expected that all boards using System76
EC firmware will select this option, so enable it by default.

Leave it disabled on clevo/cml-u, which didn't have it selected.

Change-Id: Id99d36eaf055a76b9e1eb732174017651de299a5
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65714
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2022-07-16 22:48:06 +00:00
Bill XIE ac136250b2 commonlib: Substitude macro "__unused" in compiler.h
Since there are many identifiers whose name contain "__unused" in
headers of musl libc, introducing a macro which expands "__unused" to
the source of a util may have disastrous effect during its compiling
under a musl-based platform.

However, it is hard to detect musl at build time as musl is notorious
for having explicitly been refusing to add a macro like "__MUSL__" to
announce its own presence.

Using __always_unused and __maybe_unused for everything may be a good
idea. This is how it works in the Linux kernel, so that would at least
make us match some other standard rather than doing our own thing
(especially since the other compiler.h shorthand macros are also
inspired by Linux).

Signed-off-by: Bill XIE <persmule@hardenedlinux.org>
Change-Id: I547ae3371d7568f5aed732ceefe0130a339716a9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65717
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2022-07-14 23:08:09 +00:00
Tim Wawrzynczak 5fefcd59a8 ec/google/chromec: Update ACPI handlers for GPU
There is a new field in EC EMEM for arbitrary GPU data to be passed
from EC to ACPI FW; this patch adds support for it.

Also the current host event for _Q0C (EC_HOST_EVENT_USB_CHARGER) is
unused, and is being repurposed in the next CL, so this patch drops
the handler.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: Iff6f935a5bdc8c47277eaa6bcbedd5fc5ed311a4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65485
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Ivy Jian <ivy.jian@quanta.corp-partner.google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-07-13 16:09:06 +00:00
Jeremy Soller 9c147c81dd ec/system76/ec: Hide ACPI device S76D
Hide the device so that Windows does not warn about a missing driver.

Tested on system76/lemp10:

- EC functionality remains functional on Linux 5.18.6 and Windows 10.
- Windows 10 does not report the device in Device Manager.

Change-Id: Iffcb873b85e077535d4de5806d01ba309f46c017
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64700
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-07-09 17:59:04 +00:00
Jon Murphy c4e90454f4 treewide: Unify Google branding
Branding changes to unify and update Chrome OS to ChromeOS (removing the
space).

This CL also includes changing Chromium OS to ChromiumOS as well.

BUG=None
TEST=N/A

Change-Id: I39af9f1069b62747dbfeebdd62d85fabfa655dcd
Signed-off-by: Jon Murphy <jpmurphy@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65479
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-07-04 14:02:26 +00:00
Yu-Ping Wu 3fa36f63ae ec/google/chromeec: Update ec_commands.h
This change copies ec_commands.h directly from the ChromiumOS EC repo,
with the exception of changing the copyright header to SDPX format.
Update to commit SHA1 2cbf6fbf (ec_commands: Drop VBNV read/write
support).

BUG=b:178689388
TEST=none
BRANCH=none

Change-Id: I74fa8b1171ca109dee163a7657659cdac1687450
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65469
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-06-30 14:01:22 +00:00
Yu-Ping Wu be5e7851b8 ec/google/chromeec: Remove google_chromeec_vbnv_context()
With CB:65012, google_chromeec_vbnv_context() is no longer used. Remove
it from the codebase.

BUG=b:178689388
TEST=./util/abuild/abuild -t GOOGLE_STOUT -a -x

Change-Id: I717f600f0f73c3ca932b6a442a9d5b90c35c8f3b
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65326
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-24 21:55:06 +00:00
Kyösti Mälkki 4e4edf7d60 device/resource: Modify some resource allocation instances
These changes made my crude pattern matching work with
coccinelle simpler.

Change-Id: I83f3ef38b8663640594b4d726838f7a6f96a58a2
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64698
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2022-06-24 19:51:12 +00:00
Abel Briggs cb3c368385 ec/acpi: Return error codes on timeout
The `send` and `recv` API functions currently print error messages
if a timeout occurs while polling the EC, but they perform the I/O
transaction regardless. This can put the EC in a bad state or
otherwise invoke undefined hardware behavior.

Most callers ignore the return value currently, but for callers
which do not, we should make sure our behavior is correct.

Signed-off-by: Abel Briggs <abelbriggs1@hotmail.com>
Change-Id: Ifb87dd1ac869807fd08463bd8fef36d0389b325e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64350
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-06-24 03:04:23 +00:00
Kyösti Mälkki eae983161e ec/lenovo/pmh7: Add IORESOURCE_ASSIGNED flag
This makes coccinelle script happy, everyone else sets flags last.

Change-Id: I80f421aeacb6e72fea2265c69cafb2a0d89e5616
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64697
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2022-06-22 08:55:47 +00:00
Kyösti Mälkki 49b3f84820 ec/kontron/kempld: Fix IORESOURCE_IRQ
The IRQ was incorrecly allocated as IO resource.

It's not possible for new_resource() to return NULL.

Change-Id: I66811b36b44f06cb39df8e9cdab87be0e2ef8eb9
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64699
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2022-06-22 08:55:15 +00:00
Prashant Malani 1e0d2e051b ec/google/chromeec: Add property to denote mux mode switch
On some systems, the Chrome EC controls both the USB Type-C mux as well
as the retimer. Introduce a boolean property "mode-switch" to denote
switches which act as a mode-switch.

BUG=b:235834631
TEST=None
BRANCH=None

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Change-Id: If209a8529ff7ec424f23fd96875ac95a1fe6267d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65116
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-15 23:55:40 +00:00
Sumeet Pawnikar edbbabcbe7 ec/google/chromeec: Add support to report fan speed via ACPI
Add fan speed rpm control for DPTF based Active2 policy as per
document #626708, by utilizing existing FAN0 variable from
src/ec/google/chromeec/acpi/emem.asl#18.

There is no corresponding EC change required for this policy
support because EC fan code already exporting this rpm value
using EC_MEMMAP_FAN for FAN0.

BUG=b:224457192
BRANCH=None
TEST=Built and booted on ADL-P based Brya system and
verify the fan speed in rpm under sysfs path
cat /sys/bus/acpi/devices/INTC1048\:00/fan_speed_rpm.

Change-Id: Ibb1646b1fb1659fd853ece97d97bb9dee2a3f57e
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62789
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-10 13:12:45 +00:00
Felix Singer 37a89d519d ec/lenovo/h8/acpi: Replace Not() with ASL 2.0 syntax
Change-Id: I8a0f18d37c065827a0f5b54f24ea1fcde497c504
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60724
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:23:21 +00:00
Felix Singer 9a351fb445 ec/lenovo/h8/acpi: Replace And() with ASL 2.0 syntax
Change-Id: Id600bcb3fad35455adffe11a8105ad2590e83feb
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60723
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:21:38 +00:00
Felix Singer 32283a86cf ec/lenovo/h8/acpi: Replace Multiply(a,b,c) with ASL 2.0 syntax
Replace `Multiply (a, b, c)` with `c = a * b`.

Change-Id: Idfc08803946cc2d4537db4be8d1bc07e48aa6fed
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60646
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:20:48 +00:00
Felix Singer cdba42c69c ec/smsc/mec1308/acpi: Replace LLessEqual(a,b) with ASL 2.0 syntax
Replace `LLessEqual(a, b)` with `a <= b`.

Change-Id: Ib4e81ea95c6fda0e8f8640671db5ce56f3a1b474
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60707
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:19:14 +00:00
Felix Singer 9bfbbe8b17 ec/smsc/mec1308/acpi: Replace LGreater(a,b) with ASL 2.0 syntax
Replace `LGreater(a, b)` with `a > b`.

Change-Id: I04f3cc2dbba59d732c9c52a4b90a32481f9da337
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60684
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:18:43 +00:00
Felix Singer 6929403b88 ec/smsc/mec1308/acpi: Replace LNotEqual(a,b) with ASL 2.0 syntax
Replace `LNotEqual(a, b)` with `a != b`.

Change-Id: Ib34dc8d84815d0885f30b3ea8ceb2fb95a833d50
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60701
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:18:24 +00:00
Felix Singer 8353e9a8a7 ec/smsc/mec1308/acpi: Replace LLess(a,b) with ASL 2.0 syntax
Replace `LLess(a, b)` with `a < b`.

Change-Id: Ib96cf05f575a2868b2ad0c00fd5486d6e2c5d90a
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60672
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:17:52 +00:00
Felix Singer 0375b828f9 ec/quanta/it8518/acpi: Replace LGreater(a,b) with ASL 2.0 syntax
Replace `LGreater(a, b)` with `a > b`.

Change-Id: I86a11ab5d2667661af3491174001001e644083e3
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60685
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:17:21 +00:00
Felix Singer a484bba667 ec/smsc/mec1308/acpi: Replace LGreaterEqual(a,b) with ASL 2.0 syntax
Replace `LGreaterEqual(a, b)` with `a >= b`.

Change-Id: If83d7fe29d112ba0ed0f72798f2b5436ecf0a6a2
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60689
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:16:49 +00:00
Felix Singer 10ca0ab512 ec/quanta/it8518/acpi: Replace LLess(a,b) with ASL 2.0 syntax
Replace `LLess(a, b)` with `a < b`.

Change-Id: Ief1fe60116645d0cdad9e7ac600bc1062b54b40d
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60673
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:16:23 +00:00
Felix Singer 7bf014f0ad ec/smsc/mec1308/acpi: Replace LEqual(a,b) with ASL 2.0 syntax
Replace `LEqual(a, b)` with `a == b`.

Change-Id: Ic58e22046aa13549747692f4b21184cf573aa4d3
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60669
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:15:56 +00:00
Felix Singer d40d0b0398 ec/quanta/it8518/acpi: Replace LGreaterEqual(a,b) with ASL 2.0 syntax
Replace `LGreaterEqual(a, b)` with `a >= b`.

Change-Id: I99cc4cf08ad74f2cb84e0ad16e615e03bbf388af
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60691
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:15:37 +00:00
Felix Singer 3f53ee3269 ec/quanta/it8518/acpi: Replace Divide(a,b,,c) with ASL 2.0 syntax
Replace `Divide (a, b, , c)` with `c = a / b`.

Change-Id: I9b8262396755197dfbe044e3dc6a6a75c903f093
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60654
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:15:14 +00:00
Felix Singer 1e96554846 ec/quanta/it8518/acpi: Replace LEqual(a,b) with ASL 2.0 syntax
Replace `LEqual(a, b)` with `a == b`.

Change-Id: I6732fd876524feab924a58434bec381dcdb87bce
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60663
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:14:38 +00:00
Felix Singer f1f861ebf5 ec/quanta/it8518/acpi: Replace Multiply(a,b,c) with ASL 2.0 syntax
Replace `Multiply (a, b, c)` with `c = a * b`.

Change-Id: Ied407753ee3bb024c8c0350c45312c337ac799e5
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60649
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:14:13 +00:00
Felix Singer d5d4b4459f ec/quanta/ene_kb3940q/acpi: Replace LLess(a,b) with ASL 2.0 syntax
Replace `LLess(a, b)` with `a < b`.

Change-Id: Ic04ce82fbfd36bbd2e0cfda1a92ca0a18e1fcd73
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60671
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:13:31 +00:00
Felix Singer 6119303a39 ec/kontron/it8516e/acpi: Replace Multiply(a,b,c) with ASL 2.0 syntax
Replace `Multiply (a, b, c)` with `c = a * b`.

Change-Id: I81e976de964f6ae3528884debaf2b24ddf8ed28a
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60648
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:13:15 +00:00
Felix Singer 8ab0975683 ec/google/chromeec/acpi: Replace LNotEqual(a,b) with ASL 2.0 syntax
Replace `LNotEqual(a, b)` with `a != b`.

Change-Id: I2e0c5961fcc90c97666f49837a71f6c0bdc429b3
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60699
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:03:15 +00:00
Felix Singer 9fa818d763 ec/lenovo/h8/acpi: Replace LLessEqual(a,b) with ASL 2.0 syntax
Replace `LLessEqual(a, b)` with `a <= b`.

Change-Id: I256e56841e1c7037fe8ba5e9a963ad2301092325
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60708
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:02:47 +00:00
Felix Singer cc03951016 ec/lenovo/h8/acpi: Replace LNotEqual(a,b) with ASL 2.0 syntax
Replace `LNotEqual(a, b)` with `a != b`.

Change-Id: Ic114e097a08488106554ce2dec61fa219d7cf1d0
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60700
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:02:32 +00:00
Felix Singer c253368e46 ec/lenovo/h8/acpi: Replace LGreater(a,b) with ASL 2.0 syntax
Replace `LGreater(a, b)` with `a > b`.

Change-Id: I1dbe6c325ed33a4dd15e4d6315b2308d8351974e
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60683
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:02:13 +00:00
Felix Singer 95bfa033c7 ec/lenovo/h8/acpi: Replace LEqual(a,b) with ASL 2.0 syntax
Replace `LEqual(a, b)` with `a == b`.

Change-Id: I49a7ed2d57124746815478f3ead8a8f7c54d048a
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60661
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2022-06-09 09:01:56 +00:00
Felix Singer 0e6f7a23e4 ec/google/chromeec/acpi: Replace LGreater(a,b) with ASL 2.0 syntax
Replace `LGreater(a, b)` with `a > b`.

Change-Id: Ie6238ead464d79b3576846f3b5b92b658972eec8
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60682
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:29:36 +00:00
Abel Briggs c3bfbafda5 ec/acpi: Rework to reduce code duplication
- Move EC send/receive polling code to their own functions
- Add named constants for poll timeouts and delay interval
- Use human-readable timeout values
- Add `send`/`recv` functions which support custom timeouts
- Remove extra 10us delays between polling and performing a given
  transaction
- Use constants from `ec.h` for standard EC command opcodes

Tested on a Lenovo Edge E530, which takes similar code paths to
the Lenovo Twist S230u.

Change-Id: Ifda5c030ff81f1046be58aa1fcafdcf71a27cd41
Signed-off-by: Abel Briggs <abelbriggs1@hotmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64012
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
2022-06-03 15:28:00 +00:00
Felix Singer 89818d1da7 ec/google/chromeec/acpi: Replace Multiply(a,b,c) with ASL 2.0 syntax
Replace `Multiply (a, b, c)` with `c = a * b`.

Change-Id: Iea86e77df6c76756ed336f57a906ac0757aef1cf
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60647
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:26:15 +00:00
Felix Singer 81623fbd96 ec/google/chromeec/acpi: Replace Divide(a,b,,c) with ASL 2.0 syntax
Replace `Divide (a, b, , c)` with `c = a / b`.

Change-Id: I26117087c09109cfc480cbe01d3761a02a12c61b
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60655
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:26:04 +00:00
Felix Singer 3c799fa311 ec/google/chromeec/acpi: Replace LEqual(a,b) with ASL 2.0 syntax
Replace `LEqual(a, b)` with `a == b`.

Change-Id: I4d79080ecfe457766983b20a0217ccadcd188fcf
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60662
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:25:56 +00:00
Felix Singer 29821febc3 ec/google/chromeec/acpi: Replace LLess(a,b) with ASL 2.0 syntax
Replace `LLess(a, b)` with `a < b`.

Change-Id: I65225a890f9085574a2295e6ccd2cdc3e84f71e0
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60670
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:25:47 +00:00
Felix Singer 9b13bfc6c9 ec/google/chromeec/acpi: Replace LGreaterEqual(a,b) with ASL 2.0 syntax
Replace `LGreaterEqual(a, b)` with `a >= b`.

Change-Id: I72875f68e143f9384c91588cd453d2987fda526d
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60690
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-06-03 15:25:34 +00:00
Sean Rhodes 0b3789f376 ec/starlabs/merlin/kbl: Add required headers for dead_code_t
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: Ia6c3ba80d5e6ac3d4fd8a935732ef7e32cf33998
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64718
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-28 14:16:19 +00:00
Sean Rhodes 07d3668d97 ec/starlabs/merlin/glk: Add Trackpad enable/disable Q events
Add Q60 and Q61 events to disable or enable the trackpad. The
support for this Q event was added in Star Labs EC version 1.11

Add Q events Q60 and Q61 which are bound to the F10 key. The event
is select based on the value of 0x14, 0x11 will send Q60 and 0x22
will send Q61. Q60 will pull GPIO_177 to low, consequently disabling
the trackpad and Q61 will reset it to the default configuration.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I091b0eb268d4d6d2109559765be71e2746b85f54
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64465
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2022-05-28 04:31:20 +00:00
Sean Rhodes e40ca124c6 ec/starlabs/merlin/glk: Correct offset of USCI
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I54b01b1974822c155cb49634fff8616326d55705
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64380
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2022-05-25 12:50:27 +00:00
Arthur Heymans 6acc05ed31 rules.h: Use more consistent naming
Use 'ENV' consistently and drop the redundant 'STAGE' in the naming.

Change-Id: I51f2a7e70eefad12aa214e92f23e5fd2edf46698
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64296
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
2022-05-16 21:52:22 +00:00
Sean Rhodes 6c921c8f06 ec/starlabs/merlin: Remove offset for Max Charge when not supported
Set the MAX_CHARGE offset to dead_code_t for boards that don't support
the function. The avoids erroneous values being written to the EC.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I306c8a60818b780ef3bfb842e7fcc4d8500d6b03
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64092
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2022-05-12 18:33:51 +00:00
Prashant Malani da6e9a0472 ec/google/chromeec: Add retimer handle to Type C conn
Some platforms have retimers which can be configured via the EC. Add a
handle to these retimer devices to the Type C connector device, using
devicetree references.

BUG=b:208883648
TEST=Verify disassembled SSDT on brya.
BRANCH=None

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Change-Id: Ic0480b08c6d6a7562cca57192e49b8ea2a33b51e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63793
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-05-04 13:15:30 +00:00
Prashant Malani 688105bc60 ec/google/chromeec: Add EC Mux device
Introduce an EC Mux ACPI device, which will control retimer and discrete
(off-AP) mux configuration.

BUG=b:208883648
TEST=None
BRANCH=None

Change-Id: Ia2022810292783583ee5f09ce29a63b96686dbb8
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63792
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2022-05-04 13:14:57 +00:00
Peter Lemenkov b470361e02 lenovo: correct typo in macro H8_HAS_BAT_THRESHOLDS_IMPL
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Change-Id: Ia0550a115d75183cd72e478ae739731001febe22
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63991
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2022-05-03 20:06:26 +00:00