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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>