Whatever the issue was appears to be fixed after rebasing coreboot on
the 4.19 release. lemp11 has successfully reached S0ix with SLP_S0#
asserted when booted on battery power for 100 cycles.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Groups 1, 3, and 4 require explicitly enabling the wake-up function
before unmasking them in INTC.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
- fmt: Apply clang-format
- list-boards: list of available build targets
- help: Short description of make targets
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Install a hook to run lints at pre-commit to force issues to be fixed
during development.
This introduces a 5-10 second delay when committing due to how slow
clang-format is.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Rewrite lint scripts to report what they do and if they pass. In the
case they fail list the files that caused the failure, except for
clang-format, which will be slow to run of every file individually
(should just run `make fmt` anyway). Also add a script to run all the
lints in order with a single command.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Default to silent builds, only outputting the file being generated. This
gives output similar to Linux/coreboot output when building. `VERBOSE=1`
can be passed to show the actual commands.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
SDCC supports the `-MMD` option. Use it instead of having every file
depend on *all* the headers. Reduces incremental build time after
modifying headers as it will now only rebuild the actual dependents and
not the entire project.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Compiling the Arduino targets with GCC 12 fails with the following:
error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds]
Apply the workaround from the bug discussion to fix it.
Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Specify abbrev so the version string is the same across systems with
different values for core.abbrev.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Per the SDCC manual, the object that declares main must be passed first
to the linker. The resulting binary is identical, and this has not
caused a problem yet, so I'm unsure how "required" this is.
Ref: Section 3.2.3 Projects with Multiple Source Files
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Allow specifying asm files the same way C files are added:
board-common-y += foo.asm
The file must use an `.asm` extension. The toolchain file filters the
sources to compile them into objects correctly, as the C compiler
doesn't handle asm files itself.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Update .clang-format for LLVM 14.0, available on Ubuntu 22.04.
There is still plenty that clang-format sucks at or does wrong, so
either add some more blocks to disable it, or just put up with it.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
A board may use either the LPC bus or the eSPI bus. Only include eSPI
support for boards that use it.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
If the board is on AC power when powered off the EC will not reset, and
WLAN power will not be enabled on next boot. Move enabling WLAN from
`board_init()` to `power_on()`.
Fixes: be4659a0cb ("Set wireless power at init and power off")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Add a new wireless object for controlling WLAN power state. Change the
power sequence to enable WLAN at board init and disable it at power off.
Newer galp5 units sold to customers have an issue where they do not
fully power off. This is apparently somehow caused by `WLAN_PWR_EN`.
The unit received for development do not have this issue.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
EC_VARIANT is only used on AVR as a parameter to avrdude.
Replace its use on ITE with 2 choices:
- CONFIG_EC_ITE_IT8587E
- CONFIG_EC_ITE_IT5570E
Replace the EC defines with a matching define for the variable.
Replace use of wildcard with list of source files to include. The `-y`
suffix is added, but has no significance since conditional compilation
has not been added yet.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The arch.mk file contains variables/rules to build, so rename it. Leave
an empty arch.mk so it can still be used in a follow-up commit.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
For some reason, *all* the ADL boards are now failing to enter S0ix.
Apply the PMC hack to the remaining boards.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Replace custom SDCC tool with the more standard binutils tool.
scratch.rom and flash.rom are different (no unnecessary padding), but
resulting ec.rom is the same.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Split the EC define into base and variant. Merge the 3 ATmega chips as
atmega, and the 2 ITE chips as ite.
Tested that the generated files are identical.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
lemp11 sometimes fails to reach C10 and gets stuck in C0 during s2idle.
For some reason, sending a PMC SCI allows the CPU to go to C10.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Add IT5570E register that controls when the down counters are updated.
Set them to update when they reach 0, instead of immediately when DCRi
is written.
Fixes keyboard color changing when changing brightness levels if not
using 0xFF for an RGB value.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* common: Add macros for min, max, clamp
Simple macros, with no type checking.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger: Limit charger values to max valid value
Use the maximum valid value instead of discarding bits.
Fixes: 6295f60172 ("Fix smart charger values")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger/bq24780s: Fix charge current mask
bq24780s uses bit 12 for 4096 a current weight.
Fixes: 6295f60172 ("Fix smart charger values")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* oryp: Reduce charge current to 2A
Signed-off-by: Tim Crawford <tcrawford@system76.com>
* charger/bq24780s: Set RSENSE ratio option
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
gaze17 does not connect SLP_S0# to the EC, so continue using
CPU_C10_GATE# for S0ix detection.
Fixes: 4b888ae9a501 ("board/system76/common: use SLP_S0# pin for modern standby detection")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
S0ix does not require eSPI, and eSPI does not mandate S0ix.
Enable S0ix for:
- darp7 (TGL-U)
- darp8 (ADL-P)
- galp5 (TGL-U)
- galp6 (ADL-P)
- lemp10 (TGL-U)
- lemp11 (ADL-U)
It is also currently enabled on ADL-H due to a bug with S3:
- gaze17-3050
- gaze17-3060-b
- oryp9
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The previous commit incorrectly enabled power while off. Model PD_EN
after VA_EC_EN, which it replaced on galp6 for TCP0.
Fixes: a6a6c5fba4 ("galp6: Fix TCP0 power")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The schematics incorrectly show the pin as `USB_PWR_EN#`. There is a
comment on the port side clarifying that it is actually active high.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Fix all smart charger values by having boards provide the RSENSE values
and perform the register calculations in the code.
The galp3-c, galp5, gaze16, and gaze17 do not seem to have the same
behavior as the rest of the boards, and further investigation is needed.
In the mean time, reduce their charge current values to preserve current
behavior.
Ref: OZ26786-DS v1.0
Ref: bq24780S Rev. C datasheet
Signed-off-by: Tim Crawford <tcrawford@system76.com