Commit Graph

985 Commits

Author SHA1 Message Date
88ad52491a Use CTR0 for max fan
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-08-29 08:44:23 -06:00
85cd3aa9ce Move fan-specific PWM logic to fan module
Better define the scope of the tachometer variables by moving them to
the fan module. `fan_update_duty` is renamed to `fan_event` to reflect
that it handles more than just updating the PWM duties.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-08-29 08:44:23 -06:00
710b4795fb Sync fans based on temp instead of duty
Fans may be different sizes, placed in asymmetrical positions, or have
different amounts of venting through the chassis. These characteristics
affect the ability for each fan, separately, to dissipate heat and
generate noise.

Replace syncing fans to the highest duty calculated for each fan, based
on separate thermal sensors, to using the highest reported temperature
across all sensors to calculate each fan's duty for that highest
temperature.

In other words: The old behavior synced fans based on the *output* value
(duty), while this new behavior syncs fans based on the *input* value
(temperature).

This allows tuning fans separately to better manage total system
thermals and mitigate noise.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-08-15 09:34:36 -06:00
2925376b6b bonw15-b: Add new Bonobo
The new Bonobo has the same pin layout as the original bonw15, but
uses the larger IT5570E-256 instead of keeping the IT5570E-128.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-08-07 11:36:53 -06:00
51d35cb272 Remove GPH7 on IT8587E
On IT8587E, pin 3 is VBAT and not a GPIO pin.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-29 18:41:30 -06:00
716efd4eb5 kbscan: Work around IT8587E hang
IT8587E is hanging when reading the keyboard matrix.

- Increasing the delay does not fix it
- Placing delays between KSO* writes does not fix it
- Code generated by SDCC looks valid to me

Rewriting it like this does fix it, although I don't know why.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-29 17:17:46 +02:00
984428b6a8 darp10: Add custom fan points
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-26 14:04:11 -06:00
0f7642defb Use a 16-bit system tick
The maximum interval when configured for a 1ms tick:

- 16-bit: ~65 seconds
- 32-bit: ~49.7 days

The value is used for scheduling and timeouts, and not to track the
uptime of the system, so the 32-bit value is excessive.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-25 11:38:35 -06:00
9e7f1952fa Add enum for PECI command codes
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-24 08:06:59 -06:00
face381354 Require boards to declare fan points
Thermal properties of each model differ and they should not rely on an
arbitrary, unoptimized set of fan points.

It is one thing to copy the points from the previous generation for a
model, as a lot of the time the chassis design is nearly identical, but
it should be always be explicit.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
a7bd81432e fan: Allow FAN2 without dGPU
Fully support fan points for the second fan on darp10.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
ffd0b7cbde fan: Do not make functions reentrant
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
e75a2f1e10 Improve handling of second fan
Replace hard-coded PWM channels with defines so the second fan on darp10
can be handled like the second fan on units with a dGPU.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
f8697a7ec4 Make fan names more generic
darp10 demonstrates that a board without a dGPU may still have a second
fan, so rename the CPU (PECI) fan to FAN1 and dGPU fan to FAN2.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
ceba69d7fa Refactor reading thermals, updating fan duty
Move the fan-related logic from the PECI and dGPU modules to the fan
module. The PECI and dGPU modules are now only responsible for reading
the thermal data, and the fan module handles calculating and updating
the fans duties based on that data.
2024-07-17 16:28:39 -06:00
e01536005a peci: Perform offset calculation in temp function
Have peci_get_temp() return the actual temp instead of the offset,
requiring the caller to make another calculation for the temp.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
8f88c0c7aa dgpu: Split out getting temp to a function
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
80cfa91b9f acpi: Report RPM values instead of raw tachometer values
Ref: IT5570E V0.3.2 datasheet; 7.12.3.2 Manual Fan Control Mode
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 16:28:39 -06:00
2a44e03a40 Update Rust toolchain config
Remove rust-src as it is not required. Use a minimal profile with
clippy and rustfmt installed, instead of the default profile, as
rust-docs is not needed.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-17 13:00:13 -06:00
70c8678a5f tool: Add error for write locked
Add a new error for the case of trying to flash when security is enabled
and it is still locked and update the related docs.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-15 11:49:32 -06:00
54d795480c ci: Show memory layout
I regularly use the `.mem` file to determine the impact changes have on
the RAM and flash usage. Print it as part of CI so I can easily see it
for all boards.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-12 08:17:26 -06:00
426dc99f10 tool: Update clap to 4.5
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-10 13:20:53 -06:00
1e02be1cbe Format with uncrustify
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-03 15:58:28 -06:00
d3894392d5 Replace clang-format with uncrustify
LLVM/clang is not used for any compilation due to it not supporting the
8-bit architectures we use (MCS-51, AVR). This means we are effectively
installing 250+ MiB of dependencies for a C formatting tool.

Replace it with uncrustify, which uses only ~600 KiB of space and has
more granular control of formatting (800+ options).

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-03 15:58:28 -06:00
6c3b34ee6e ci: Update runner to Ubuntu 24.04
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-03 15:58:28 -06:00
3d09a0b546 Conditionally compile dGPU support
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-03 13:47:40 -06:00
5b0766a209 USe debounce bit and do not use interrupts for touchpad 2024-06-21 18:18:02 -06:00
d88a175e23 Clear PS/2 touchpad status when waiting for write to finish 2024-06-21 18:18:02 -06:00
2c5c708569 oryp12: Fix USB-PD config
Fixes: 1e4667f1d3 ("Conditionally compile USB-PD support")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-17 17:12:38 -06:00
a67b0c98b8 lemp13-b: Remove GPB7
Fixes: f79f4d1157 ("Remove GPB7 on IT5570E")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-17 16:38:22 -06:00
f79f4d1157 Remove GPB7 on IT5570E
On IT5570E, pin A1 is VSTBY0 and not a GPIO pin.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-17 15:37:01 -06:00
1e4667f1d3 Conditionally compile USB-PD support
Boards may not have USB-PD. Remove the need for a "none" option by only
adding USB-PD sources when enabled.

The resulting binary for boards with USB-PD enabled (addw3, bonw15,
serw13) are identical. The binary for boards without USB-PD now have the
empty calls optimized out.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-17 14:52:34 -06:00
fc3bad29a2 pnp: Match EC2I programming guide
Use the sequence specified by the flowcharts in the ITE manuals.

Ref: IT5570E V0.3.2 datasheet; 7.15.5 EC2I Programming Guide
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-17 10:02:22 -06:00
8382c81b9d tool: Update Rust toolchain to nightly-2024-05-11
Update toolchain to match the version used in Redox.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-17 09:57:27 -06:00
09c5a3b5f0 lemp13-b: use darp10-b keymap 2024-05-17 08:34:54 -06:00
b4768ed2dd Add lemp13-b 2024-05-17 08:34:54 -06:00
88c77aa1d3 darp10-b: Add custom keymap
The darp10-b replaces the display toggle with mic mute like other newer
units.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 14:35:29 -06:00
522284e5d5 Add darp10-b 2024-05-07 14:35:29 -06:00
e7ad77898b darp10: Add custom keymap
The customer units for darp10 will have custom keyboard with the alt
legend on Num / removed.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 14:35:29 -06:00
b744529960 [HACK] darp10: Set FAN2 duty to FAN1
This model has a second CPU fan connected to PWM3.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 14:35:29 -06:00
748ec13132 darp10: Add Darter Pro 10
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 14:35:29 -06:00
38d4666a90 oryp12: Use OZ26786 charger
Ref: Schematics sheet 58 ("AC In Charger")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-21 13:32:38 -06:00
637036ec02 oryp12: Enable security
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-19 17:22:49 -06:00
6a40a54932 oryp12: Add Oryx Pro 12
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-19 14:28:24 -06:00
91b8c48773 Add lemp13 2024-03-19 13:22:24 -06:00
90af96faf5 eSPI: debug all vwire indexes 2024-03-19 13:22:24 -06:00
17aae5af71 Update ecspy 2024-03-19 13:22:24 -06:00
6aced2fd57 ci: Update actions/checkout to v4
Fixes the following warnings in Actions:

    Node.js 16 actions are deprecated. Please update the following
    actions to use Node.js 20: actions/checkout@v3.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-18 14:27:58 -06:00
16e4f93f2c Mark pointed-to data const where possible
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-18 14:27:36 -06:00
9fb08ffa46 Mark pointers as const
Resulting binaries are identical.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-18 14:27:36 -06:00