Commit Graph

898 Commits

Author SHA1 Message Date
d687df482a Conditionally compile eSPI support
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>
2023-01-06 12:47:54 -07:00
5e884cf413 scratch: Use relative path for source
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-01-06 12:47:54 -07:00
a8e37276e9 tool: Disable default features of redox-hwio
Fixes using as a dependency in no-std environments.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-12-20 13:41:02 -07:00
1019878e3c tool: Update dependencies
clap is only updated to 3.2 instead of 4.0 because I didn't want to deal
with all the changes.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-11-30 08:39:16 -07:00
cd28de382d Add a K_NONE define
Seems like this define might as well be included. It means `layouts.py`
doesn't need to handle it specially.
2022-11-29 09:20:41 -07:00
004c7acf6c Remove scripts/layouts.sh
Superseded by `keyboard-configurator/layouts.py`.
2022-11-29 09:20:41 -07:00
2a8befc195 Enable WLAN at power_on() instead of board_init()
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>
2022-11-18 19:11:01 -07:00
be4659a0cb Set wireless power at init and power off
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>
2022-11-18 07:32:18 -07:00
839abf7878 galp5: Remove BT_EN
BT is enabled PCH side by `PCH_BT_EN`. `BT_EN` is not connected.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-11-18 07:32:18 -07:00
861f1f2cc8 make: Add config for each ITE EC
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.
2022-11-17 14:19:39 -07:00
ac9631f948 make: Specify source files to include
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>
2022-11-17 14:19:39 -07:00
ce66685c70 make: Move arch.mk to toolchain.mk
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>
2022-11-17 14:19:39 -07:00
c5b737f505 ESPI systems should always power off if in S5 state 2022-11-17 13:54:43 -07:00
edbb5b594a HACK: pmc: Apply hack for S0ix to all ADL boards
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>
2022-11-08 09:44:14 -07:00
be5d34dc0d Add other launch keyboards 2022-11-01 16:22:11 -06:00
d36fb62cd7 Replace makebin with objcopy
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>
2022-10-28 15:01:45 -06:00
69f97fe149 Merge common EC directories
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>
2022-10-27 09:42:45 -06:00
01885609e8 HACK: pmc: Add hack to force S0ix entry on lemp11
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>
2022-10-17 18:36:35 -06:00
f8d1123934 pwm: Reload counters when they reach 0
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>
2022-10-14 08:38:34 -06:00
76019bdb61 Fix charger values, again (#303)
* 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>
2022-10-06 13:02:15 -06:00
a32a3e3e95 Docs: update models that use 0.5mm pitch FPC cable (#302) 2022-09-15 11:42:12 -06:00
7f28764436 battery: Fix condition to start/stop charging
Change the condition, which is currently a level *at* which charging
will start/stop.

Per sysfs [1], these values are a level:

- *below* which charging will begin
- *above* which charging will stop

[1]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-09-02 11:22:56 -06:00
5cf57d69b9 gaze17: Define SLP_S0# to CPU_C10_GATE#
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>
2022-08-30 08:47:30 -06:00
cc3effb6a4 board/system76/common: use SLP_S0# pin for modern standby detection
Previously, CPU_C10_GATE# was used for detecting entry into s0ix /
Modern Standby.

Intel documentation says that SLP_S0# should be used for s0ix detection
instead, and CPU_C10_GATE# is intended for VCCSTG power gating, so
switch the pin to improve s0ix detection reliability.

Fixes https://github.com/system76/firmware-open/issues/199

References:

- Intel docs #575570 rev 0.5, #607872 rev 2.2
- Chromium EC: https://chromium.googlesource.com/chromiumos/platform/ec/+/master/power/intel_x86.c#41

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2022-08-30 08:47:30 -06:00
49abf83c08 Add config for using S0ix
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>
2022-08-30 08:47:30 -06:00
b78631e316 oryp10: Symlink to oryp9
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-08-26 11:38:49 -06:00
a8213311b1 galp6: Do not provide power while off
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>
2022-08-03 11:11:28 -06:00
a6a6c5fba4 galp6: Fix TCP0 power
galp6 uses `PD_EN` instead of `VA_EC_EN` for enabling power to TCP0.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-08-02 16:02:06 -06:00
cd86c1e7d7 galp6: Fix USB power
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>
2022-08-02 16:02:06 -06:00
371f6d3047 galp6: Add Galago Pro 6
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-08-01 19:26:36 -06:00
6295f60172 Fix smart charger values
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
2022-08-01 19:26:36 -06:00
20d40f3477 gaze17-3050: Adjust fan points
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-07-26 09:27:44 -06:00
22fa2769ad gaze17-3050: Update configs
- Add to CI
- Correct smart charger values
- Enable WLAN power
- Enable USB power
- Disable mute

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-07-26 09:27:44 -06:00
7ab91e9f1d oryp9: Sync fans
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-07-20 14:20:31 -06:00
5ef477ab5b ci: Add darp8 and lemp11
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-07-12 15:31:35 -06:00
e8d91e5c2d oryp9: Add Oryx Pro 9
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-07-12 15:31:35 -06:00
60dfb62f90 lemp11: Add Lemur Pro 11
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-06-28 13:22:30 -06:00
7b9b91187a darp8: Add Darter Pro 8
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-06-22 09:17:21 -06:00
158ec124fe Add Pause key
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>
2022-05-23 13:08:31 -06:00
375d11f4ed Add gaze17 2022-05-16 11:16:33 -07:00
a70ea4558c Fix battery TRACE macro 2022-04-27 07:13:48 -06:00
5780bb5e83 Update Rust toolchain to 2022-03-18
Match the toolchain used by Redox.

Update dependencies and submodules to fix building.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-04-04 18:59:20 -06:00
700f9e3756 ci: Add clang-format check
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-03-22 12:52:47 -06:00
b70a09e205 Disable clang-format for sensitive blocks
Things like macro blocks should not be auto-formatted.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-03-22 12:52:47 -06:00
04df6ae311 Add .clang-format
Most options are configured to keep most of the current style.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-03-22 12:52:47 -06:00
f21cc6d602 battery: Group battery info in a struct
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-03-18 12:47:59 -06:00
ee8ba5b72e fan: Replace 'static const' with defines
SDCC is not able to optimize statics [1]. Replace their use with defines
so significantly better code is generated.

[1]: https://sourceforge.net/p/sdcc/feature-requests/414/

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2022-03-18 12:47:20 -06:00
84f9aad7d8 Add force console mode to arduino firmware 2022-02-14 18:55:14 -07:00
cb341cfb2b Add power_init function 2022-02-14 18:55:14 -07:00
474b1c2191 Remove unused power states, rename power on/off functions 2022-02-14 18:55:14 -07:00