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
In proprietary firmware and QMK, the Break key by itself is always just
Pause. They produce the same scan code, but Ctrl must be held for the OS
to recognize it as Break.
Behavior tested with xev.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Ensure rustup is up-to-date to avoid users having a version that is too
old to support the TOML format.
If rustup was just installed, tell the user to source the new env vars
to use the correct version of the toolchain.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The IT81202E, despite using a different core, contains sufficiently
equivalent documentation to IT8587E and IT5570E for most tasks except
interrupt management. Provide it as a reference since we cannot share
the datasheets for the models we use.
Signed-off-by: Tim Crawford <tcrawford@system76.com>