Commit Graph

692 Commits

Author SHA1 Message Date
Ian Douglas Scott
ab0c55fae2 ectool 0.3.8 2021-11-19 13:32:00 -08:00
Ian Douglas Scott
85595a8d4c tool: Add a system76_ec command to disable input events
For testing Launch keyboards.

Could easily support in EC firmware as well if we had a use for that,
but not adding that for now.
2021-11-18 13:08:05 -08:00
Jeremy Soller
d9ce247a15 ectool: update lock file 2021-11-17 18:27:11 -07:00
Jeremy Soller
e8ce6d9096 Add libhidapi-dev to deps 2021-11-17 18:26:26 -07:00
Jeremy Soller
95632b4503 ectool: use linux-shared-hidraw feature for hidapi 2021-11-17 18:26:26 -07:00
Tim Crawford
55a617f2e0 gaze16-3060-b: Symlink new variant to gaze16-3060 2021-11-01 11:01:34 -06:00
Tim Crawford
987a5b4b70 Update submodules
Submodules have been updated to work with newer toolchains and fix build
warnings.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-10-26 11:35:48 -06:00
Tim Crawford
43e5cf4ba3 Fix or silence clippy warnings on nightly
Fix:
- dead_code
- clippy::if_then_panic
- clippy::manual_memcpy
- clippy::needless_borrow

Silence:
- clippy::missing_safety_doc
- clippy::needless_range_loop
- clippy::single_match

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-10-26 11:35:48 -06:00
Tim Crawford
975377af42 Update Rust toolchain to 2021-06-15
Update toolchain to match the version used in Redox.

Update dependencies to fix build.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-10-26 11:35:48 -06:00
Jeremy Soller
9fa83ad359 gaze16-3050, gaze16-3060: set PCH_DPWROK_EC low on EC boot to ensure PCH is off 2021-09-30 12:29:24 -06:00
Jeremy Soller
d3ee037879 Add gaze16 to CI 2021-09-20 10:58:11 -06:00
Jeremy Soller
9046f1e527 Add oryp8 2021-09-20 10:50:53 -06:00
Ian Douglas Scott
15c5f936b5 Read cycle count from battery and expose for ACPI 2021-09-15 07:49:50 -06:00
Jeremy Soller
646a6436a7 Attempt to fix power_peci_limit issues
- Return false when power_peci_limit fails
- Allow power_peci_limit to be retried indefinitely from power_set_limit
2021-09-08 13:39:54 -06:00
Tim Crawford
f55e493001 Remove overflow check for unsigned diffs
Calculating diffs with *unsigned* integers will always produce the
correct result, as long as the diff is less than the type max.

For example, suppose we read 254 and 2 for an 8 bit value:

    2 - 254 = 4

Using this property, simplify diffs on time_get() comparisons.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-16 09:52:08 -06:00
Tim Crawford
e00686a661 docs: Only 5570 and 8587 are valid EC IDs
ecflash has no verification for the EC it detects. It will attempt to
read and erase whatever it finds, where it will hang. Document what it
*should* read and an example of what it *shouldn't* read.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-03 08:12:50 -06:00
Tim Crawford
73c6bd986d main: Use unsigned modulo
Explicitly affix the literal with `U` so SDCC will directly call
`moduint()` instead of `modsint()`.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
d99ea41259 power: Use u8/u16 for loop index
Use u8/u16 instead of i16 as the value will never be negative and the
bounds are known at compile time.

Use a decrementing loop as SDCC generates more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
37fa06ebc8 parallel: Use u16 for data length
The length will never be negative. Change it from i16 to u16 so
SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
5599c02e83 keymap: Use u8 for array access
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
458cb000f3 kbscan: Use u8 for array access
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
571316a4ea kbled: Use u8 for array access
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
f27d6350f2 kbc: Use u16 for timeout
The timeout will never be negative.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
2a3830fb57 i2c: Use u16 for data length
The length will never be negative.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
784202383e fan: Use u8 for array access
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
99af8a35f5 Use explicitly sized types from stdint
Replace bare int types with stdint types. This was done with:

    grep -rwl 'int' src/ | xargs sed -i 's/\<int\>/int16_t/g'
    grep -rwl 'unsigned long' src/ | xargs sed -i 's/\<unsigned long\>/uint32_t/g'
    grep -rwl 'unsigned char' src/ | xargs sed -i 's/\<unsigned char\>/uint8_t/g'

Then reverted for *main(), putchar(), and getchar().

The Arduino declarations for parallel_main() were also corrected to
match their definitions.

SDCC does *not* generate the same code in all instances, due to `int`
being treated different than `short int`.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 07:46:44 -06:00
Tim Crawford
38b2a628f9 gaze16-3050: Correct charger input current
Per the charger for the 3050 variants:

    DC OUTPUT (输出/輸出): 19.5V⎓7.7A 150W

The 3060 charger does list 9.23A.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-31 06:15:05 -06:00
Jeremy Soller
ff53939a56 Add gaze16 2021-07-20 10:49:08 -06:00
Jeremy Soller
2720bb9037 Use PME virtual wire for suspend/resume 2021-07-20 10:49:08 -06:00
Jeremy Soller
90057df94f Change repetitive prints from DEBUG to TRACE 2021-07-20 10:49:08 -06:00
Jeremy Soller
913b0dfc44 Expose pnp_read and pnp_write 2021-07-20 10:49:08 -06:00
Jeremy Soller
e25af93f2e Update ecsim 2021-07-20 10:49:08 -06:00
Tim Crawford
9aab239f0a keyboard: Set scroll lock in default layouts
Not added to 14in_83 as it is not printed on the key.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-19 18:20:49 -06:00
Tim Crawford
701adb2f27 keymap: Define scroll lock
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-19 18:20:49 -06:00
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
cd8e76420d Add EC define that is usable in macros
The `__EC__` define is not usable in macros for conditional compilation.

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
Tim Crawford
b7368e8202 docs: Add overview of development environment
Give an overview of the different tools required for development and
what they're used for.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-06-10 09:41:16 -06:00
Tim Crawford
5a7fd2d7b3 docs: Rewrite the keyboard layout doc
Use of shorter sentences should reduce cognitive load. Example shell
commands should improve understanding of the description.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-06-08 11:23:44 -06:00