Commit Graph

762 Commits

Author SHA1 Message Date
Tim Crawford
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
Tim Crawford
3d09a0b546 Conditionally compile dGPU support
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-03 13:47:40 -06:00
Jeremy Soller
5b0766a209 USe debounce bit and do not use interrupts for touchpad 2024-06-21 18:18:02 -06:00
Jeremy Soller
d88a175e23 Clear PS/2 touchpad status when waiting for write to finish 2024-06-21 18:18:02 -06:00
Tim Crawford
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
Tim Crawford
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
Tim Crawford
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
Tim Crawford
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
Tim Crawford
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
Jeremy Soller
09c5a3b5f0 lemp13-b: use darp10-b keymap 2024-05-17 08:34:54 -06:00
Jeremy Soller
b4768ed2dd Add lemp13-b 2024-05-17 08:34:54 -06:00
Tim Crawford
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
Jeremy Soller
522284e5d5 Add darp10-b 2024-05-07 14:35:29 -06:00
Tim Crawford
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
Tim Crawford
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
Tim Crawford
748ec13132 darp10: Add Darter Pro 10
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 14:35:29 -06:00
Tim Crawford
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
Tim Crawford
637036ec02 oryp12: Enable security
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-19 17:22:49 -06:00
Tim Crawford
6a40a54932 oryp12: Add Oryx Pro 12
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-19 14:28:24 -06:00
Jeremy Soller
91b8c48773 Add lemp13 2024-03-19 13:22:24 -06:00
Jeremy Soller
90af96faf5 eSPI: debug all vwire indexes 2024-03-19 13:22:24 -06:00
Tim Crawford
16e4f93f2c Mark pointed-to data const where possible
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-18 14:27:36 -06:00
Tim Crawford
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
Jeremy Soller
8c52c313e1 addw4: improved fan curve 2024-03-11 08:54:13 -06:00
Tim Crawford
8af7fd5bad addw4: Enable security
Development is sufficiently far along that this can default to enabled.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-01 11:15:40 -07:00
Tim Crawford
2174b4593a addw4: Enable KBLED support
Fixes: fff6208f98 ("Conditionally compile KBLED support")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-01 09:44:34 -07:00
Tim Crawford
fff6208f98 Conditionally compile KBLED support
Remove the need for a "none" option by only adding KBLED sources when
enabled.

The resulting binaries with KBLED enabled (all of them) are identical.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-28 13:20:23 -07:00
Tim Crawford
ecac574671 addw4: Add Adder WS 4
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-28 11:40:32 -07:00
Tim Crawford
82b9e19746 time: Replace hard-coded values with macro
This is more descriptive than the comment and allows for changing
values, such as using a chip with a different clock frequency.

The resulting binary is identical.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-26 09:06:05 -07:00
Tim Crawford
449bafd130 main: Remove empty switch case
SDCC 4.4.0 now fails to compile if there are empty switch cases.

    src/board/system76/common/main.c:105: error 110: conditional flow changed by optimizer: so said EVELYN the modified DOG

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-24 21:03:21 -07:00
Tim Crawford
ef4eeae2df ite: Add support for 256K flash
The upcoming addw4 will use the IT5570E-256, which requires removing the
assumption that every ITE chip is 128K. Introduce new configs so boards
may select which flash size they use.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-01-25 13:26:43 -07:00
Tim Crawford
4b86176659 main: Replace MOD with bitwise AND
This prevents `moduint` from being called for the superloop.

A bitwise AND is used instead of using the equivalent `% 4` as an
indication that modulo should not be used, as not using a power of 2
(which is optimized) will result in an expensive call to SDCC library
functions.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-01-05 15:04:28 -07:00
Tim Crawford
766fb738a0 kbscan: Remove unused array
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-01-04 15:05:40 -07:00
Tim Crawford
0ccb8079ae kbscan: Do not read matrix if lid is closed
Pull the lid check out to the loop to avoid accessing the matrix when we
know we do not need the data. It is left in kbscan (instead of simply
disabling reading) to clear the state of the matrix data.

The lid check for wake is removed as it will never be true.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-01-04 15:05:40 -07:00
Tim Crawford
0e1a748b16 kbscan: Disable reading columns at init
The functionality is split into a separate function to optimize the use
case for each.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-01-04 11:55:56 -07:00
Tim Crawford
cbad8e09be smfi: Remove always true conditional
SDCC 4.3.3 (terribly) reports this as an error:

    src/board/system76/common/smfi.c:244: error 110: conditional flow changed by optimizer: so said EVELYN the modified DOG

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-19 08:02:41 -06:00
Tim Crawford
713e1d9681 Add void to function declarations with no args
SDCC 4.3.3 complains about the declaration not matching the prototype:

    error 283: function declarator with no prototype

Add `void` to the AVR functions as well, even though no warning is
issued by GCC.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-19 08:02:41 -06:00
Tim Crawford
01be30f107 Only support building a single board at a time
As a follow up to c461e20df3 ("make: Remove version from build output
path"), only support building a single version of a single board by
default. The build directory can still be specified by passing `BUILD`.

Fixes running the `clean` target when `BUILD` is a custom value or
`BOARD` isn't set.

Fixes: b03c960b4f ("make: Reduce build output")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-12 12:49:43 -06:00
Tim Crawford
946415f3a7 peci: Add timeouts to infinitely blocking waits
Add timeouts to the legacy PECI implementation to prevent the EC locking
up when PECI stops working, such as during S0ix opportunistic suspend.

This is not the optimal solution, as PECI should not be available at all
to cause the lock up in the first place, but it at least prevents the
issue.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-12 09:09:20 -06:00
Tim Crawford
a3fb9e1c77 avr: Fix compiling with GCC 13
Apply the CFLAGS workaround for GCC 13.

The issue is fixed in GCC 14, so only 12 and 13 are affected.

Ref: 84fe76cad4 ("avr: Fix compiling with GCC 12")
Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-06 13:58:27 -06:00
Matt Parnell
bb1ce2273b fix sdcc 4.3.0 #14184 build error - error 283: function declarator with no prototype 2023-09-20 09:36:34 -06:00
Tim Crawford
181d4c5d59 kbscan: Increase debounce time from 5ms to 10ms
Some users are reporting that a debounce time of 5ms is not enough to
prevent keys from registering twice. Split the difference between the
old and the new debounce times and set it to 10ms.

Ref: https://github.com/system76/firmware-open/issues/471
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-09-07 17:14:44 -06:00
Jeremy Soller
1097fd999a Do not force charging if end threshold is not set 2023-08-17 17:55:04 -06:00
Tim Crawford
34dd9ccbac battery: Disable charger if full or not on AC
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-08-17 17:55:04 -06:00
Jeremy Soller
894b82d4fb Set default battery start threshold to 90% 2023-08-17 17:55:04 -06:00
Tim Crawford
dc482dd11a Add basic support for IT5571E
The IT5571E is nearly identical to the IT5570E.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-08-15 08:24:02 -06:00
Tim Crawford
01907011bb Add a FnLock key
Implement a FnLock toggle that behaves as follows:

- Disabled: F1-F12 are normal
- Enabled: F1-F12 are the alternate function

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-08-01 14:39:59 -06:00
Tim Crawford
b63e2092ce peci: Check PECI available based on eSPI usage
If eSPI is used, use Virtual Wires to determine if PECI is available.

Fixes incorrectly reporting PECI as available on systems using S0ix, as
the CPU would be in C10 but `PLTRST#` would not be asserted.

Requires enabling `HOST_C10` reporting in FSP-S.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-08-01 14:24:21 -06:00
Tim Crawford
ebc5168cb0 Remove the use of symlinks
Replace symlinks with directories with `board.mk`, using relative paths
to include the files rather than duplicate them.

This allows making board-specific changes without affecting other
boards, such as when firmware security had to be enabled on galp6 when
it was enabled on galp7 (2d5cbadf71).

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-07-31 09:06:23 -06:00
Tim Crawford
9302a30a2d pmc: Add interrupt control and enable registers
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-07-31 09:04:52 -06:00