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>
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>
Explicitly affix the literal with `U` so SDCC will directly call
`moduint()` instead of `modsint()`.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
Internal flashing can result in corrupted or lost OS data. Make this
more explicit for internal flashing, and make it a point for external
flashing.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Give the process from 0 to built. Due to the implications of doing
something wrong (unbootable machine), flashing is kept separate.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
- General copyright notice
- License info for firmware and tools
- Note about ITE datasheets being unavailable
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Explain why there are no tagged releases, and why the commit hash on
official releases does not match commits from this repo.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Use hard line breaks to keep the line under 80 columns. Break it into 2
sentences: one explaining the issue, and the other explaining the fix.
Signed-off-by: Tim Crawford <tcrawford@system76.com>