Commit Graph

762 Commits

Author SHA1 Message Date
Jeremy Soller
146f2d2b4a Implement scancode buffer 2021-07-19 14:52:07 -06:00
Tim Crawford
e86e18d4b1 delay: Use u8, decrementing loop
Use u8 instead of i16 as a delay can never be negative and should never
block for a long period of time.

Use a decrementing loop as SDCC generates more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-19 06:48:16 -06:00
Tim Crawford
f9e4e25b05 ec/it*: Merge remaining ITE EC files
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-16 13:34:56 -06:00
Tim Crawford
851221da61 ec/it*: Merge all identical ITE EC files
Most of the code is the same between IT8587E and IT5570E.

Identical files were detected with:

    diff -rs src/ec/it8587e/ src/ec/it5570e/ | egrep '^Files .+ and .+ are identical$'

Then manually moved from one variant and deleted from the other.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-16 13:34:56 -06:00
Tim Crawford
c7fafe0103 board.c: Remove unused includes/globals
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 08:02:55 -06:00
Tim Crawford
92c8f8f3d1 lemp9: Remove duplicate setting of XLP_OUT
XLP_OUT is already set in power_event().

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 08:02:55 -06:00
Tim Crawford
1fc832ca94 Enable POST codes in EC init instead of per-board
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:37:40 -06:00
Tim Crawford
d1db553e8c system76/*: Call EC function to read POST codes
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:37:40 -06:00
Tim Crawford
f8d81a1e1b ec/it5570e: Add function to read POST codes
Logic for reading port 0x80/0x81 is common to the IT5570E.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:37:40 -06:00
Tim Crawford
43651cf2c2 ec/it*: Remove vendor string from signature
Per the specs, a 16-byte signature is stored at 0x40. All proprietary EC
ROMs store a space-padded 16-byte vendor string at 0x50, but it isn't
required.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:36:27 -06:00
Tim Crawford
a8229d9e62 Move power limit functions to common board code
Logic for changing power limit is the same for all boards with GPUs. It
is still called from board_event() instead of in power_event() to
maintain the current behavior of checking every main cycle.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:35:52 -06:00
Tim Crawford
3f446e5c6e Move eSPI files to board common code
The eSPI logic is the same for all TGL boards using it. None of it is
moved to IT5570E due to the call to power_cpu_reset().

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:34:51 -06:00
Winston Hoy
8ea0403850 Smooth fan speed changes (#190)
* SMOOTH_FANS, SMOOTH_FANS_UP, SMOOTH_FANS_DOWN build flags to smooth fan speed changes.
Defaults 40, set SMOOTH_FANS=0 to disable and keep sharp fan speed changes

* fix for ACPI CPU temperature

* allow for a floor to be set for fan smoothing and specifically configure oryp6/7 to start smoothing at 25% to mitigate fan buzzing below 25%

* update default config values for fans

* update all devices to use defaults for heatup, cooldown, update galp5 fan curves

* Decrease default cooldown time from 20 to 10

Co-authored-by: Jacob Kauffmann <jacob@system76.com>
2021-06-14 14:22:29 -06:00
Jeremy Soller
df469a9eea Reduce copying of keyboard layouts 2021-06-04 16:22:10 -06:00
Jeremy Soller
4742fd9742 Fix adding src/board/system76/common headers to INCLUDE 2021-06-04 16:22:10 -06:00
Tim Crawford
b3b2a312b7 Define GPCRn values in EC header 2021-06-03 09:48:55 -06:00
Jeremy Soller
1b539e1206 Make touchpad access non-blocking 2021-05-24 19:02:47 -06:00
Tim Crawford
532219c3f8 Allow battery thresholds to be set in config.mk
The start/end thresholds are user-configurable values. This will allow
us to override these with profile values if desired.
2021-05-14 15:55:26 -06:00
Tim Crawford
76e02c9514 Set battery charging thresholds in common.mk
Battery threshold control is entirely software-defined and does not
depend on any board-specific behavior.
2021-05-14 15:55:26 -06:00
Tim Crawford
285d622fbc kbc: Reduce timeout from 10ms to 1ms
Fix ACPI timeout and delay on S3 resume when holding a key.

A timeout greater than 1ms results in the excessive delay (~10s) still
occurring on an oryp5 (IT8587).
2021-05-14 15:06:50 -06:00
Tim Crawford
4963e04a83 Reindent files using spaces 2021-05-07 12:44:48 -06:00
Tim Crawford
720af4b2b0 Use BIT macro
Mostly done with the cocci script. macro.h was then added manually.
2021-05-07 11:24:25 -06:00
Winston Hoy
606ba01b48 default to fan syncing but support disabling fan syncing with SYNC_FANS=0 build flag 2021-05-01 06:33:40 -06:00
Winston Hoy
f0c42f5839 Sync dGPU and PECI fans (at highest requested duty) 2021-05-01 06:33:40 -06:00
Jeremy Soller
16778e4a41 Report all keys as released when lid is closed 2021-04-02 13:38:28 -06:00
Jeremy Soller
a04d353096 Fix fan_max keeping fan on when in S0iX 2021-04-02 13:38:28 -06:00
Jeremy Soller
2401fcc50d oryp6, oryp7: Fix buzzing at lowest fan speed 2021-03-16 18:51:55 -06:00
Jeremy Soller
0017450cbb Add LED_SAVE command 2021-03-16 10:33:46 -06:00
Jeremy Soller
66a970fa51 oryp6, oryp7: Improved fan curve for video chat 2021-03-08 15:54:19 -07:00
Jeremy Soller
2ef4cd7bbd Add matrix command 2021-03-01 11:50:31 -07:00
Jeremy Soller
c931eb4eef Do not repeat K_FAN_TOGGLE 2021-02-26 15:51:47 -07:00
Jeremy Soller
67e143178d Always notify OS of SCI when pmc_sci is called 2021-02-26 15:51:47 -07:00
Ian Douglas Scott
b11bc64bba tool: API and CLI for LED matrix mode 2021-02-26 12:18:02 -07:00
Tim Crawford
3e154d7f00 Add missing SPDX identifiers 2021-02-22 14:02:18 -07:00
Jeremy Soller
4ba943e3df oryp7 2021-02-22 10:05:52 -07:00
Jeremy Soller
18ec0eb694 Increase keyboard scanning delay to eliminate darp7 scanning issues 2021-02-05 09:52:24 -07:00
Jeremy Soller
3a9665a753 lemp10: Set DPWROK low on EC reset to ensure PCH reset 2021-02-04 09:14:38 -07:00
Jeremy Soller
304e7534c9 Add led value and color commands 2021-01-15 08:34:31 -07:00
Jeremy Soller
5bab59a526 Do not duplicate kbled support. Add kbled_max and kbled_get_color functions 2021-01-15 08:34:31 -07:00
Jeremy Soller
9309efb3e0 Use BIT macros 2021-01-05 12:17:16 -07:00
Jeremy Soller
47c1062e08 Add SPDX headers 2021-01-05 12:17:16 -07:00
Jeremy Soller
7f4a837bcf Add system76/darp7 2021-01-05 12:17:16 -07:00
Jeremy Soller
fbaea59b46 Add system76/galp5 2021-01-05 12:17:16 -07:00
Jeremy Soller
8f340d6164 Add system76/lemp10 2021-01-05 12:17:16 -07:00
Jeremy Soller
b156d18bc2 system76/common: Add OZ26786 charger 2021-01-05 12:17:16 -07:00
Jeremy Soller
fb6355f907 system76/common: Move touchpad handling to kbc_event 2021-01-05 12:17:16 -07:00
Jeremy Soller
31a908556b system76/common/kbc: Refactor to remove delays and improve readability 2021-01-05 12:17:16 -07:00
Jeremy Soller
5559d4e2f6 system76/common: Switch to pmc_swi for wake events 2021-01-05 12:17:16 -07:00
Jeremy Soller
3f41cd6ab3 system76/common/pmc: Refactor to improve readability and support ESPI 2021-01-05 12:17:16 -07:00
Jeremy Soller
99a0d6861f system76/common/power: Fix spurious power button enable 2021-01-05 12:17:16 -07:00