Compare commits
30 Commits
5b0766a209
...
e41716575c
Author | SHA1 | Date | |
---|---|---|---|
|
e41716575c | ||
|
3d8204c3f4 | ||
|
2c6977bc6b | ||
|
ae63a9e3fb | ||
|
88ad52491a | ||
|
85cd3aa9ce | ||
|
710b4795fb | ||
|
2925376b6b | ||
|
51d35cb272 | ||
|
716efd4eb5 | ||
|
984428b6a8 | ||
|
0f7642defb | ||
|
9e7f1952fa | ||
|
face381354 | ||
|
a7bd81432e | ||
|
ffd0b7cbde | ||
|
e75a2f1e10 | ||
|
f8697a7ec4 | ||
|
ceba69d7fa | ||
|
e01536005a | ||
|
8f88c0c7aa | ||
|
80cfa91b9f | ||
|
2a44e03a40 | ||
|
70c8678a5f | ||
|
54d795480c | ||
|
426dc99f10 | ||
|
1e02be1cbe | ||
|
d3894392d5 | ||
|
6c3b34ee6e | ||
|
3d09a0b546 |
141
.clang-format
141
.clang-format
@@ -1,141 +0,0 @@
|
||||
# https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormatStyleOptions.html
|
||||
# LLVM 14 used to support Ubuntu 22.04 LTS.
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignConsecutiveMacros: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- 'foreach'
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '(_test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseBlocks: true
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: NoIndent
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakAssignment: 1000
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Latest
|
||||
StatementMacros:
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- 'STRINGIZE'
|
||||
...
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
boards: ${{ steps.board-matrix.outputs.boards }}
|
||||
steps:
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
run: ./scripts/lint/01-spdx-tags.sh
|
||||
|
||||
- name: Check formatting
|
||||
run: ./scripts/lint/02-clang-format.sh
|
||||
run: ./scripts/lint/02-uncrustify.sh
|
||||
|
||||
- name: Check shell scripts
|
||||
run: ./scripts/lint/03-shellcheck.sh
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
- features:
|
||||
- features: --no-default-features --features="redox_hwio"
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
run: cargo build ${{ matrix.features }} --release --manifest-path tool/Cargo.toml
|
||||
|
||||
ec:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
needs: lint
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -61,3 +61,7 @@ jobs:
|
||||
|
||||
- name: Build firmware
|
||||
run: make BOARD=${{ matrix.boards }} VERBOSE=1
|
||||
|
||||
- name: Show memory layout
|
||||
run: cat build/ec.mem
|
||||
continue-on-error: true
|
||||
|
156
.uncrustify.cfg
Normal file
156
.uncrustify.cfg
Normal file
@@ -0,0 +1,156 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
# SPDX-FileCopyrightText: NONE
|
||||
|
||||
# Uncrustify-0.78.1_f
|
||||
# https://github.com/uncrustify/uncrustify/blob/uncrustify-0.78.1/documentation/htdocs/config.txt
|
||||
|
||||
newlines = lf
|
||||
input_tab_size = 4
|
||||
output_tab_size = 4
|
||||
disable_processing_cmt = "uncrustify:off"
|
||||
enable_processing_cmt = "uncrustify:on"
|
||||
utf8_bom = remove
|
||||
sp_arith_additive = force
|
||||
sp_assign = force
|
||||
sp_enum_brace = force
|
||||
sp_enum_after_assign = force
|
||||
sp_pp_concat = ignore
|
||||
sp_bool = force
|
||||
sp_compare = force
|
||||
sp_inside_paren = remove
|
||||
sp_paren_paren = remove
|
||||
sp_cparen_oparen = remove
|
||||
sp_paren_brace = force
|
||||
sp_before_ptr_star = force
|
||||
sp_between_ptr_star = remove
|
||||
sp_between_ptr_ref = remove
|
||||
sp_after_ptr_star = remove
|
||||
sp_after_type = ignore # XXX: Fixes using macros in assignments
|
||||
sp_before_sparen = force
|
||||
sp_inside_sparen = remove
|
||||
sp_inside_for = remove
|
||||
sp_sparen_paren = remove
|
||||
sp_sparen_brace = force
|
||||
sp_do_brace_open = force
|
||||
sp_brace_close_while = force
|
||||
sp_before_semi_for = remove
|
||||
sp_before_semi_for_empty = remove
|
||||
sp_between_semi_for_empty = remove
|
||||
sp_after_semi_for_empty = remove
|
||||
sp_before_square = remove
|
||||
sp_before_squares = remove
|
||||
sp_inside_square = remove
|
||||
sp_after_comma = add
|
||||
sp_after_cast = remove
|
||||
sp_inside_paren_cast = remove
|
||||
sp_sizeof_paren = remove
|
||||
sp_inside_braces = add
|
||||
sp_inside_braces_empty = remove
|
||||
sp_func_proto_paren = remove
|
||||
sp_func_def_paren = remove
|
||||
sp_inside_fparens = remove
|
||||
sp_inside_fparen = remove
|
||||
sp_inside_tparen = remove
|
||||
sp_after_tparen_close = remove
|
||||
sp_fparen_brace = force
|
||||
sp_func_call_paren = remove
|
||||
sp_return_paren = force
|
||||
sp_attribute_paren = remove
|
||||
sp_defined_paren = remove
|
||||
sp_else_brace = force
|
||||
sp_brace_else = force
|
||||
sp_brace_typedef = force
|
||||
sp_before_nl_cont = force
|
||||
sp_cond_colon = force
|
||||
sp_cond_question = force
|
||||
sp_endif_cmt = force
|
||||
sp_before_tr_cmt = add
|
||||
sp_num_before_tr_cmt = 1
|
||||
indent_columns = 4
|
||||
indent_with_tabs = 0
|
||||
indent_macro_brace = false
|
||||
indent_ignore_label = true
|
||||
indent_paren_close = 2
|
||||
indent_align_assign = false
|
||||
indent_align_paren = false
|
||||
indent_compound_literal_return = false
|
||||
nl_collapse_empty_body = true
|
||||
nl_collapse_empty_body_functions = true
|
||||
nl_start_of_file = remove
|
||||
nl_end_of_file = force
|
||||
nl_end_of_file_min = 1
|
||||
nl_assign_brace = remove
|
||||
nl_fcall_brace = remove
|
||||
nl_enum_brace = remove
|
||||
nl_struct_brace = remove
|
||||
nl_union_brace = remove
|
||||
nl_if_brace = remove
|
||||
nl_brace_else = remove
|
||||
nl_else_brace = remove
|
||||
nl_else_if = remove
|
||||
nl_for_brace = remove
|
||||
nl_while_brace = remove
|
||||
nl_do_brace = remove
|
||||
nl_brace_while = remove
|
||||
nl_switch_brace = remove
|
||||
nl_after_case = true
|
||||
nl_enum_own_lines = force
|
||||
nl_func_type_name = remove
|
||||
nl_func_proto_type_name = remove
|
||||
nl_func_paren = remove
|
||||
nl_func_def_paren = remove
|
||||
nl_func_call_paren = remove
|
||||
nl_fdef_brace = remove
|
||||
nl_return_expr = remove
|
||||
nl_after_semicolon = true
|
||||
nl_brace_struct_var = remove
|
||||
nl_ds_struct_enum_close_brace = true
|
||||
nl_split_if_one_liner = true
|
||||
nl_split_for_one_liner = true
|
||||
nl_split_while_one_liner = true
|
||||
nl_max = 2
|
||||
eat_blanks_after_open_brace = true
|
||||
eat_blanks_before_close_brace = true
|
||||
code_width = 100
|
||||
ls_for_split_full = true
|
||||
ls_func_split_full = true
|
||||
align_on_tabstop = true
|
||||
align_var_def_star_style = 1
|
||||
align_var_def_amp_style = 1
|
||||
align_typedef_star_style = 1
|
||||
align_typedef_amp_style = 1
|
||||
align_func_proto_star_style = 1
|
||||
align_func_proto_amp_style = 1
|
||||
align_pp_define_together = true
|
||||
cmt_width = 100
|
||||
cmt_convert_tab_to_spaces = true
|
||||
cmt_trailing_single_line_c_to_cpp = true
|
||||
mod_paren_on_return = remove
|
||||
mod_remove_extra_semicolon = true
|
||||
mod_remove_duplicate_include = true
|
||||
mod_sort_incl_import_prioritize_filename = true
|
||||
mod_move_case_break = true
|
||||
mod_move_case_return = true
|
||||
mod_remove_empty_return = true
|
||||
mod_enum_last_comma = add
|
||||
pp_multiline_define_body_indent = 4
|
||||
pp_indent_case = false
|
||||
pp_indent_func_def = false
|
||||
pp_indent_extern = false
|
||||
|
||||
#set QUALIFIER __at # XXX: Allow it to be treated as a function call
|
||||
set QUALIFIER __code
|
||||
set QUALIFIER __critical
|
||||
set QUALIFIER __data
|
||||
set QUALIFIER __idata
|
||||
set QUALIFIER __pdata
|
||||
set QUALIFIER __reentrant
|
||||
set QUALIFIER __xdata
|
||||
|
||||
set TYPE __bit
|
||||
set TYPE __sbit
|
||||
set TYPE __sfr
|
||||
set TYPE __sfr16
|
||||
set TYPE __sfr32
|
||||
|
||||
set FUNC_CALL __asm__
|
2
Makefile
2
Makefile
@@ -74,7 +74,7 @@ clean:
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
./scripts/clang-format.sh apply
|
||||
uncrustify -c .uncrustify.cfg -q --no-backup $(shell git ls-files '*.c' '*.h')
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
|
@@ -1,15 +1,27 @@
|
||||
# Flashing firmware
|
||||
|
||||
## UEFI application
|
||||
|
||||
The `flash.sh` script from the top-level firmware-open project will use
|
||||
firmware-update, the UEFI application which is used for normal system updates.
|
||||
|
||||
This will flash both the SBIOS and the EC after building the firmware. To
|
||||
flash just the EC, delete the built `firmware.rom` before running `flash.sh`.
|
||||
|
||||
## Internal programmer
|
||||
|
||||
Use this method for flashing a system already running System76 EC.
|
||||
|
||||
This method will only work if the running firmware is not locked. Firmware is
|
||||
write locked if it was built with `CONFIG_SECURITY=y`. firmware-update must be
|
||||
used to flash from UEFI in this state (see `flash.sh` in firmware-open).
|
||||
write locked if it was built with `CONFIG_SECURITY=y`. The firmware can be
|
||||
unlocked using ectool for a single boot:
|
||||
|
||||
This will trigger a watchdog reset causing the system to **immediately power
|
||||
off**. OS data may be lost or corrupted as a result. Save and close all
|
||||
```
|
||||
./scripts/ectool.sh security unlock
|
||||
```
|
||||
|
||||
This method will trigger a watchdog reset causing the system to **immediately
|
||||
power off**. OS data may be lost or corrupted as a result. Save and close all
|
||||
applications before flashing.
|
||||
|
||||
```
|
||||
|
@@ -104,10 +104,6 @@ make
|
||||
|
||||
See [flashing firmware](./flashing.md) for details.
|
||||
|
||||
```sh
|
||||
make flash_internal
|
||||
```
|
||||
|
||||
Do not use the keyboard or touchpad while it is flashing.
|
||||
|
||||
The system will power off as part of the flash process. Turn it back on after
|
||||
|
@@ -1,3 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2024-05-11"
|
||||
components = ["rust-src"]
|
||||
components = ["clippy", "rustfmt"]
|
||||
profile = "minimal"
|
||||
|
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
readarray -t FILES < <(git ls-files '*.c' '*.h')
|
||||
|
||||
FMT_OPTS=(
|
||||
"-style=file"
|
||||
"--fallback-style=none"
|
||||
"--Werror"
|
||||
)
|
||||
|
||||
if [[ "$1" = "apply" ]]; then
|
||||
clang-format "${FMT_OPTS[@]}" -i "${FILES[@]}"
|
||||
else
|
||||
clang-format "${FMT_OPTS[@]}" --dry-run "${FILES[@]}"
|
||||
fi
|
@@ -19,7 +19,6 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
|
||||
--yes \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang-format \
|
||||
curl \
|
||||
gcc \
|
||||
gcc-avr \
|
||||
@@ -30,6 +29,7 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
|
||||
pkgconf \
|
||||
sdcc \
|
||||
shellcheck \
|
||||
uncrustify \
|
||||
xxd
|
||||
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
|
||||
sudo dnf install \
|
||||
@@ -37,13 +37,13 @@ elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
|
||||
avr-gcc \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang-tools-extra \
|
||||
curl \
|
||||
gcc \
|
||||
make \
|
||||
sdcc \
|
||||
ShellCheck \
|
||||
systemd-devel \
|
||||
uncrustify \
|
||||
vim-common
|
||||
elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
sudo pacman -S \
|
||||
@@ -51,7 +51,6 @@ elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
avr-gcc \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang \
|
||||
curl \
|
||||
gcc \
|
||||
make \
|
||||
@@ -59,6 +58,7 @@ elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
sdcc \
|
||||
shellcheck \
|
||||
systemd-libs \
|
||||
uncrustify \
|
||||
vim
|
||||
else
|
||||
msg "Please add support for your distribution to:"
|
||||
|
@@ -2,5 +2,5 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
set -e
|
||||
cargo build --release --manifest-path tool/Cargo.toml
|
||||
cargo build --release --quiet --manifest-path tool/Cargo.toml
|
||||
sudo tool/target/release/system76_ectool "$@"
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Check if any C files or headers need to be formatted.
|
||||
|
||||
LINT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
. "$LINT_DIR/util.sh"
|
||||
|
||||
echo -n "Checking C style..."
|
||||
|
||||
if ! command -v clang-format > /dev/null; then
|
||||
skipped "clang-format not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
readarray -t FILES < <(git ls-files '*.c' '*.h')
|
||||
|
||||
FMT_OPTS=(
|
||||
"-style=file"
|
||||
"--fallback-style=none"
|
||||
"--dry-run"
|
||||
"--Werror"
|
||||
)
|
||||
|
||||
# NOTE: It is too slow to run clang-format on every file individually to report
|
||||
# which ones fail. Leave it up to the user to apply formatting via `make fmt`.
|
||||
|
||||
_output=$(clang-format "${FMT_OPTS[@]}" "${FILES[@]}" 2>&1)
|
||||
if [[ $_output != "" ]]; then
|
||||
failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
passed
|
36
scripts/lint/02-uncrustify.sh
Executable file
36
scripts/lint/02-uncrustify.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Check if any C files or headers need to be formatted.
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
LINT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
. "$LINT_DIR/util.sh"
|
||||
|
||||
echo -n "Checking C style..."
|
||||
|
||||
if ! command -v uncrustify > /dev/null; then
|
||||
skipped "uncrustify not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
needs_formatting=()
|
||||
|
||||
for file in $(git ls-files '*.c' '*.h'); do
|
||||
if ! uncrustify -c .uncrustify.cfg -q --check "$file" >/dev/null 2>&1; then
|
||||
needs_formatting+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${#needs_formatting[@]}" != "0" ]]; then
|
||||
failed
|
||||
|
||||
for file in "${needs_formatting[@]}"; do
|
||||
echo "- $file"
|
||||
done
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
passed
|
@@ -5,7 +5,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint16_t systick_t;
|
||||
|
||||
void time_init(void);
|
||||
uint32_t time_get(void);
|
||||
systick_t time_get(void);
|
||||
|
||||
#endif // _ARCH_TIME_H
|
||||
|
@@ -8,9 +8,9 @@
|
||||
#define OSC_DIVISOR 12
|
||||
#define TICK_INTERVAL_MS 1
|
||||
// Value to reload into the timer when the overflow interrupt is triggered.
|
||||
#define TIMER_RELOAD (0xFFFF - ((TICK_INTERVAL_MS) * ((CONFIG_CLOCK_FREQ_KHZ) / OSC_DIVISOR)))
|
||||
#define TIMER_RELOAD (0xFFFF - (TICK_INTERVAL_MS * (CONFIG_CLOCK_FREQ_KHZ / OSC_DIVISOR)))
|
||||
|
||||
static volatile uint32_t time_overflows = 0;
|
||||
static volatile systick_t time_overflows = 0;
|
||||
|
||||
void timer_0(void) __interrupt(1) {
|
||||
// Hardware automatically clears the the interrupt
|
||||
@@ -52,6 +52,6 @@ void time_init(void) __critical {
|
||||
TR0 = 1;
|
||||
}
|
||||
|
||||
uint32_t time_get(void) __critical {
|
||||
systick_t time_get(void) __critical {
|
||||
return time_overflows;
|
||||
}
|
||||
|
@@ -11,9 +11,11 @@
|
||||
#include <arch/i2c_slave.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// uncrustify:off
|
||||
static void (*volatile i2c_slave_new_cb)() = NULL;
|
||||
static void (*volatile i2c_slave_recv_cb)(uint8_t) = NULL;
|
||||
static uint8_t (*volatile i2c_slave_send_cb)() = NULL;
|
||||
// uncrustify:on
|
||||
|
||||
void i2c_slave_init(
|
||||
uint8_t address,
|
||||
|
@@ -16,14 +16,12 @@ struct Gpio {
|
||||
uint8_t value;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define GPIO(BLOCK, NUMBER) { \
|
||||
.pin = &PIN ## BLOCK, \
|
||||
.ddr = &DDR ## BLOCK, \
|
||||
.port = &PORT ## BLOCK, \
|
||||
.value = BIT(NUMBER), \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
bool gpio_get(const struct Gpio *const gpio);
|
||||
void gpio_set(struct Gpio *const gpio, bool value);
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include <arch/uart.h>
|
||||
#include <board/cpu.h>
|
||||
|
||||
// clang-format off
|
||||
#define UART(N) \
|
||||
{ \
|
||||
&UCSR ## N ## A, \
|
||||
@@ -23,24 +22,23 @@
|
||||
}
|
||||
|
||||
#if defined(__AVR_ATmega328P__)
|
||||
static struct Uart UARTS[] = {
|
||||
UART(0)
|
||||
};
|
||||
static struct Uart UARTS[] = {
|
||||
UART(0)
|
||||
};
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
static struct Uart UARTS[] = {
|
||||
UART(1)
|
||||
};
|
||||
static struct Uart UARTS[] = {
|
||||
UART(1)
|
||||
};
|
||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
static struct Uart UARTS[] = {
|
||||
UART(0),
|
||||
UART(1),
|
||||
UART(2),
|
||||
UART(3)
|
||||
};
|
||||
static struct Uart UARTS[] = {
|
||||
UART(0),
|
||||
UART(1),
|
||||
UART(2),
|
||||
UART(3)
|
||||
};
|
||||
#else
|
||||
#error "Could not find UART definitions"
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
int16_t uart_count(void) {
|
||||
return sizeof(UARTS) / sizeof(struct Uart);
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <arch/gpio.h>
|
||||
#include <arch/uart.h>
|
||||
|
||||
// clang-format off
|
||||
// Mapping of 24-pin ribbon cable to parallel pins. See schematic
|
||||
#define PINS \
|
||||
/* Data (KSO0 - KSO7) - bi-directional */ \
|
||||
@@ -114,8 +113,6 @@ static struct Parallel PORT = {
|
||||
.state = PARALLEL_STATE_UNKNOWN,
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Set port to all high-impedance inputs
|
||||
void parallel_hiz(struct Parallel *const port) {
|
||||
#define PIN(N, P) \
|
||||
@@ -137,8 +134,10 @@ void parallel_data_dir(struct Parallel *const port, bool dir) {
|
||||
void parallel_data_set_high(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, true);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, true); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
@@ -205,8 +204,10 @@ void parallel_state(struct Parallel *const port, enum ParallelState state) {
|
||||
uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
uint8_t byte = 0;
|
||||
#define DATA_BIT(B) \
|
||||
if (gpio_get(port->d##B)) \
|
||||
byte |= (1 << B);
|
||||
if (gpio_get(port->d##B)) { \
|
||||
byte |= (1 << B); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
return byte;
|
||||
@@ -216,8 +217,10 @@ void parallel_write_data(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, false);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, false); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
|
@@ -11,8 +11,6 @@
|
||||
#include <arch/gpio.h>
|
||||
#include <arch/uart.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Mapping of 24-pin ribbon cable to parallel pins. See schematic
|
||||
#define PINS \
|
||||
/* Data (KSO0 - KSO7) - bi-directional */ \
|
||||
@@ -67,8 +65,6 @@ static struct Gpio GPIOS[13] = {
|
||||
GPIO(C, 0),
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Parallel struct definition
|
||||
// See http://efplus.com/techref/io/parallel/1284/eppmode.htm
|
||||
struct Parallel {
|
||||
@@ -89,6 +85,7 @@ void parallel_hiz(struct Parallel *const port) {
|
||||
#define PIN(N, P) \
|
||||
gpio_set_dir(port->N, false); \
|
||||
gpio_set(port->N, false);
|
||||
|
||||
PINS
|
||||
#undef PIN
|
||||
}
|
||||
@@ -105,8 +102,10 @@ void parallel_data_dir(struct Parallel *const port, bool dir) {
|
||||
void parallel_data_set_high(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, true);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, true); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
@@ -154,8 +153,10 @@ void parallel_reset(struct Parallel *const port, bool host) {
|
||||
uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
uint8_t byte = 0;
|
||||
#define DATA_BIT(B) \
|
||||
if (gpio_get(port->d##B)) \
|
||||
byte |= (1 << B);
|
||||
if (gpio_get(port->d##B)) { \
|
||||
byte |= (1 << B); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
return byte;
|
||||
@@ -164,8 +165,10 @@ uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
void parallel_write_data(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, false);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, false); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT8587E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
|
||||
@@ -14,9 +17,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_0
|
||||
|
||||
@@ -36,23 +36,27 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -42,7 +42,7 @@ struct Gpio __code USB_PWR_EN_N = GPIO(F, 7);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 0); // renamed to SLP_SUS_EC#
|
||||
struct Gpio __code WLAN_EN = GPIO(J, 2);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(B, 0);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
@@ -192,8 +192,6 @@ void gpio_init(void) {
|
||||
GPCRH5 = GPIO_OUT | GPIO_UP;
|
||||
// SUSB#_PCH
|
||||
GPCRH6 = GPIO_IN;
|
||||
// TODO
|
||||
GPCRH7 = GPIO_IN;
|
||||
// BAT_DET
|
||||
GPCRI0 = GPIO_ALT;
|
||||
// BAT_VOLT
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -53,6 +52,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
|
||||
@@ -14,9 +17,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -36,23 +36,27 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -40,7 +40,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 7);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -50,6 +49,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,7 +7,8 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI=y
|
||||
|
||||
# Enable firmware security
|
||||
@@ -20,9 +21,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -45,27 +43,31 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=280 \
|
||||
-DPOWER_LIMIT_DC=55
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_HEATUP=5
|
||||
CFLAGS+=-DBOARD_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS+=-DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -32,7 +32,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(D, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,8 @@ EC = ite
|
||||
CONFIG_EC_ITE_IT5570E = y
|
||||
CONFIG_EC_FLASH_SIZE_256K = y
|
||||
|
||||
# Enable eSPI
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
CONFIG_PECI_OVER_ESPI = y
|
||||
|
||||
@@ -38,32 +39,35 @@ CFLAGS += \
|
||||
-DPOWER_LIMIT_AC=230 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS += -DBOARD_HEATUP=5
|
||||
CFLAGS += -DBOARD_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN_POINTS="\
|
||||
# Enable DGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 28), \
|
||||
FAN_POINT(65, 28), \
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 60), \
|
||||
FAN_POINT(80, 75), \
|
||||
FAN_POINT(85, 90), \
|
||||
FAN_POINT(90, 100) \
|
||||
FAN_POINT(90, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS += -DHAVE_DGPU=1
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
CFLAGS += -DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS += -DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 28), \
|
||||
FAN_POINT(65, 28), \
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 60), \
|
||||
FAN_POINT(80, 75), \
|
||||
FAN_POINT(85, 90), \
|
||||
FAN_POINT(90, 100) \
|
||||
FAN_POINT(90, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -32,7 +32,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
//struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(H, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102_nkey
|
||||
|
||||
@@ -14,9 +17,6 @@ KEYBOARD=15in_102_nkey
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=bonw14
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -36,23 +36,27 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code AC_V1_EC = GPIO(J, 7);
|
||||
@@ -39,7 +39,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4); // renamed to EN_3V
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code AC_V1_EC;
|
||||
@@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
81
src/board/system76/bonw15-b/board.mk
Normal file
81
src/board/system76/bonw15-b/board.mk
Normal file
@@ -0,0 +1,81 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
board-y += ../bonw15/board.c
|
||||
board-y += ../bonw15/gpio.c
|
||||
|
||||
# FIXME: Handle this better
|
||||
CFLAGS += -I$(BOARD_DIR)/../bonw15/include
|
||||
|
||||
EC = ite
|
||||
CONFIG_EC_ITE_IT5570E = y
|
||||
CONFIG_EC_FLASH_SIZE_256K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
CONFIG_SECURITY = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD = 15in_102
|
||||
|
||||
# Set keyboard LED mechanism
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED = bonw14
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS += -DI2C_SMBUS=I2C_4
|
||||
|
||||
# Set touchpad PS2 bus
|
||||
CFLAGS += -DPS2_TOUCHPAD=PS2_3
|
||||
|
||||
# Set smart charger parameters
|
||||
# XXX: PRS1 and PRS2 are in parallel for adapter Rsense?
|
||||
CHARGER = oz26786
|
||||
CFLAGS += \
|
||||
-DCHARGER_ADAPTER_RSENSE=5 \
|
||||
-DCHARGER_BATTERY_RSENSE=5 \
|
||||
-DCHARGER_CHARGE_CURRENT=3072 \
|
||||
-DCHARGER_CHARGE_VOLTAGE=17400 \
|
||||
-DCHARGER_INPUT_CURRENT=16920
|
||||
|
||||
# Set USB-PD parameters
|
||||
CONFIG_HAVE_USBPD = y
|
||||
CONFIG_USBPD_TPS65987 = y
|
||||
CFLAGS += -DI2C_USBPD=I2C_1
|
||||
|
||||
# Set CPU power limits in watts
|
||||
CFLAGS += \
|
||||
-DPOWER_LIMIT_AC=330 \
|
||||
-DPOWER_LIMIT_DC=55
|
||||
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
CONFIG_SECURITY=y
|
||||
@@ -20,9 +21,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=bonw14
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -50,27 +48,31 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=330 \
|
||||
-DPOWER_LIMIT_DC=55
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_HEATUP=5
|
||||
CFLAGS+=-DBOARD_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS+=-DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -34,7 +34,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(B, 5);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -43,6 +42,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -3,13 +3,17 @@
|
||||
#include <board/acpi.h>
|
||||
#include <board/battery.h>
|
||||
#include <board/dgpu.h>
|
||||
#include <board/fan.h>
|
||||
#include <board/gpio.h>
|
||||
#include <board/kbled.h>
|
||||
#include <board/lid.h>
|
||||
#include <board/peci.h>
|
||||
#include <common/macro.h>
|
||||
#include <board/pwm.h>
|
||||
#include <common/debug.h>
|
||||
#include <ec/pwm.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
#include <board/peci.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LED_AIRPLANE_N
|
||||
#define HAVE_LED_AIRPLANE_N 1
|
||||
@@ -43,22 +47,22 @@ void fcommand(void) {
|
||||
break;
|
||||
// Set color
|
||||
case 3:
|
||||
// clang-format off
|
||||
kbled_set_color(
|
||||
((uint32_t)fbuf[0]) |
|
||||
((uint32_t)fbuf[1] << 16) |
|
||||
((uint32_t)fbuf[2] << 8)
|
||||
);
|
||||
// clang-format on
|
||||
break;
|
||||
// Get color
|
||||
case 4:
|
||||
// uncrustify:off
|
||||
{
|
||||
uint32_t color = kbled_get_color();
|
||||
fbuf[0] = color & 0xFF;
|
||||
fbuf[1] = (color >> 16) & 0xFF;
|
||||
fbuf[2] = (color >> 8) & 0xFF;
|
||||
}
|
||||
// uncrustify:on
|
||||
break;
|
||||
// DUPLICATE: Set brightness
|
||||
case 6:
|
||||
@@ -83,7 +87,7 @@ void acpi_reset(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
uint8_t acpi_read(uint8_t addr) {
|
||||
uint8_t data = 0;
|
||||
|
||||
@@ -112,7 +116,9 @@ uint8_t acpi_read(uint8_t addr) {
|
||||
}
|
||||
break;
|
||||
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
ACPI_8(0x07, peci_temp);
|
||||
#endif
|
||||
|
||||
// Handle AC adapter and battery present
|
||||
case 0x10:
|
||||
@@ -161,15 +167,15 @@ uint8_t acpi_read(uint8_t addr) {
|
||||
|
||||
ACPI_8(0xCC, sci_extra);
|
||||
|
||||
ACPI_8(0xCE, DCR2);
|
||||
ACPI_8(0xD0, F1TLRR);
|
||||
ACPI_8(0xD1, F1TMRR);
|
||||
#if HAVE_DGPU
|
||||
ACPI_8(0xCE, fan1_pwm_actual);
|
||||
ACPI_16(0xD0, fan1_rpm);
|
||||
#if CONFIG_HAVE_DGPU
|
||||
ACPI_8(0xCD, dgpu_temp);
|
||||
ACPI_8(0xCF, DCR4);
|
||||
ACPI_8(0xD2, F2TLRR);
|
||||
ACPI_8(0xD3, F2TMRR);
|
||||
#endif // HAVE_DGPU
|
||||
#endif // CONFIG_HAVE_DGPU
|
||||
#ifdef FAN2_PWM
|
||||
ACPI_8(0xCF, fan2_pwm_actual);
|
||||
ACPI_16(0xD2, fan2_rpm);
|
||||
#endif // FAN2_PWM
|
||||
|
||||
#if HAVE_LED_AIRPLANE_N
|
||||
// Airplane mode LED
|
||||
@@ -181,20 +187,20 @@ uint8_t acpi_read(uint8_t addr) {
|
||||
#endif // HAVE_LED_AIRPLANE_N
|
||||
|
||||
// Set size of flash (from old firmware)
|
||||
ACPI_8 (0xE5, 0x80);
|
||||
ACPI_8(0xE5, 0x80);
|
||||
|
||||
ACPI_8 (0xF8, fcmd);
|
||||
ACPI_8 (0xF9, fdat);
|
||||
ACPI_8 (0xFA, fbuf[0]);
|
||||
ACPI_8 (0xFB, fbuf[1]);
|
||||
ACPI_8 (0xFC, fbuf[2]);
|
||||
ACPI_8 (0xFD, fbuf[3]);
|
||||
ACPI_8(0xF8, fcmd);
|
||||
ACPI_8(0xF9, fdat);
|
||||
ACPI_8(0xFA, fbuf[0]);
|
||||
ACPI_8(0xFB, fbuf[1]);
|
||||
ACPI_8(0xFC, fbuf[2]);
|
||||
ACPI_8(0xFD, fbuf[3]);
|
||||
}
|
||||
|
||||
TRACE("acpi_read %02X = %02X\n", addr, data);
|
||||
return data;
|
||||
}
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void acpi_write(uint8_t addr, uint8_t data) {
|
||||
TRACE("acpi_write %02X = %02X\n", addr, data);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <common/macro.h>
|
||||
#include <common/debug.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
|
||||
// Registers
|
||||
#define REG_CHARGE_CURRENT 0x14
|
||||
@@ -86,7 +86,7 @@
|
||||
#error Invalid adapter:battery RSENSE ratio
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
// XXX: Assumption: ac_last is initialized high.
|
||||
static bool charger_enabled = false;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <common/debug.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
|
||||
// Registers
|
||||
#define REG_CHARGE_CURRENT 0x14
|
||||
@@ -71,7 +71,8 @@
|
||||
#else
|
||||
#error Invalid CHARGER_PSYS_GAIN value
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// uncrustify:on
|
||||
|
||||
// Sense resistor values in milliohms.
|
||||
enum sense_resistor {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
board-common-y += acpi.c
|
||||
board-common-y += battery.c
|
||||
board-common-y += config.c
|
||||
board-common-y += dgpu.c
|
||||
board-common-$(CONFIG_HAVE_DGPU) += dgpu.c
|
||||
board-common-y += ecpm.c
|
||||
board-common-$(CONFIG_BUS_ESPI) += espi.c
|
||||
board-common-y += fan.c
|
||||
@@ -14,10 +14,8 @@ board-common-y += keymap.c
|
||||
board-common-y += lid.c
|
||||
board-common-y += main.c
|
||||
board-common-y += parallel.c
|
||||
board-common-y += peci.c
|
||||
board-common-y += pmc.c
|
||||
board-common-y += pnp.c
|
||||
board-common-y += power.c
|
||||
board-common-y += ps2.c
|
||||
board-common-y += pwm.c
|
||||
board-common-y += scratch.c
|
||||
@@ -42,6 +40,17 @@ CFLAGS+=-DLEVEL=4
|
||||
# Uncomment to enable I2C debug on 0x76
|
||||
#CFLAGS+=-DI2C_DEBUGGER=0x76
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_INTEL),y)
|
||||
board-common-y += peci.c
|
||||
board-common-y += power/intel.c
|
||||
CFLAGS += -DCONFIG_PLATFORM_INTEL=1
|
||||
else ifeq ($(CONFIG_PLATFORM_AMD),y)
|
||||
board-common-y += power/amd.c
|
||||
CFLAGS += -DCONFIG_PLATFORM_AMD=1
|
||||
else
|
||||
$(error PLATFORM not specified)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SECURITY),y)
|
||||
CFLAGS+=-DCONFIG_SECURITY=1
|
||||
endif
|
||||
@@ -58,6 +67,10 @@ CFLAGS += -DCONFIG_PECI_OVER_ESPI=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_HAVE_DGPU),y)
|
||||
CFLAGS += -DCONFIG_HAVE_DGPU=1
|
||||
endif
|
||||
|
||||
# Include system76 common source
|
||||
SYSTEM76_COMMON_DIR=src/board/system76/common
|
||||
INCLUDE += $(SYSTEM76_COMMON_DIR)/common.mk
|
||||
|
@@ -1,107 +1,43 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/dgpu.h>
|
||||
#include <board/fan.h>
|
||||
|
||||
#if HAVE_DGPU
|
||||
|
||||
#include <board/gpio.h>
|
||||
#include <board/peci.h>
|
||||
#include <board/power.h>
|
||||
#include <common/debug.h>
|
||||
#include <common/macro.h>
|
||||
#include <ec/i2c.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#ifndef BOARD_DGPU_HEATUP
|
||||
#define BOARD_DGPU_HEATUP 4
|
||||
#endif
|
||||
|
||||
static uint8_t FAN_HEATUP[BOARD_DGPU_HEATUP] = { 0 };
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#ifndef BOARD_DGPU_COOLDOWN
|
||||
#define BOARD_DGPU_COOLDOWN 10
|
||||
#endif
|
||||
|
||||
static uint8_t FAN_COOLDOWN[BOARD_DGPU_COOLDOWN] = { 0 };
|
||||
|
||||
int16_t dgpu_temp = 0;
|
||||
|
||||
#define DGPU_TEMP(X) ((int16_t)(X))
|
||||
|
||||
#define FAN_POINT(T, D) \
|
||||
{ .temp = DGPU_TEMP(T), .duty = PWM_DUTY(D) }
|
||||
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
static struct FanPoint __code FAN_POINTS[] = {
|
||||
#ifdef BOARD_DGPU_FAN_POINTS
|
||||
BOARD_DGPU_FAN_POINTS
|
||||
#else
|
||||
FAN_POINT(70, 40),
|
||||
FAN_POINT(75, 50),
|
||||
FAN_POINT(80, 60),
|
||||
FAN_POINT(85, 65),
|
||||
FAN_POINT(90, 65)
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct Fan __code FAN = {
|
||||
.points = FAN_POINTS,
|
||||
.points_size = ARRAY_SIZE(FAN_POINTS),
|
||||
.heatup = FAN_HEATUP,
|
||||
.heatup_size = ARRAY_SIZE(FAN_HEATUP),
|
||||
.cooldown = FAN_COOLDOWN,
|
||||
.cooldown_size = ARRAY_SIZE(FAN_COOLDOWN),
|
||||
.interpolate = SMOOTH_FANS != 0,
|
||||
};
|
||||
|
||||
void dgpu_init(void) {
|
||||
// Set up for i2c usage
|
||||
i2c_reset(&I2C_DGPU, true);
|
||||
}
|
||||
|
||||
uint8_t dgpu_get_fan_duty(void) {
|
||||
uint8_t duty;
|
||||
if (power_state == POWER_STATE_S0 && gpio_get(&DGPU_PWR_EN) && !gpio_get(&GC6_FB_EN)) {
|
||||
// Use I2CS if in S0 state
|
||||
bool dgpu_get_temp(int16_t *const data) {
|
||||
if (gpio_get(&DGPU_PWR_EN) && !gpio_get(&GC6_FB_EN)) {
|
||||
int8_t rlts;
|
||||
int16_t res = i2c_get(&I2C_DGPU, 0x4F, 0x00, &rlts, 1);
|
||||
if (res == 1) {
|
||||
dgpu_temp = (int16_t)rlts;
|
||||
duty = fan_duty(&FAN, dgpu_temp);
|
||||
*data = (int16_t)rlts;
|
||||
return true;
|
||||
} else {
|
||||
DEBUG("DGPU temp error: %d\n", res);
|
||||
// Default to 50% if there is an error
|
||||
dgpu_temp = 0;
|
||||
duty = PWM_DUTY(50);
|
||||
*data = 0;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Turn fan off if not in S0 state or GPU power not on
|
||||
dgpu_temp = 0;
|
||||
duty = PWM_DUTY(0);
|
||||
}
|
||||
|
||||
if (peci_on && fan_max) {
|
||||
// Override duty if fans are manually set to maximum
|
||||
duty = PWM_DUTY(100);
|
||||
} else {
|
||||
// Apply heatup and cooldown filters to duty
|
||||
duty = fan_heatup(&FAN, duty);
|
||||
duty = fan_cooldown(&FAN, duty);
|
||||
*data = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dgpu_read_temp(void) {
|
||||
if (power_state == POWER_STATE_S0) {
|
||||
if (dgpu_get_temp(&dgpu_temp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("DGPU temp=%d\n", dgpu_temp);
|
||||
return duty;
|
||||
dgpu_temp = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void dgpu_init(void) {}
|
||||
|
||||
uint8_t dgpu_get_fan_duty(void) {
|
||||
return PWM_DUTY(0);
|
||||
}
|
||||
|
||||
#endif // HAVE_DGPU
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#define DEBUG_SET(REG, MASK, BITS) \
|
||||
{ \
|
||||
DEBUG("%s: %X", #REG, REG); \
|
||||
REG = ((REG) & ~(MASK)) | (BITS); \
|
||||
REG = (REG & ~(MASK)) | (BITS); \
|
||||
DEBUG(" set to %X\n", REG); \
|
||||
}
|
||||
|
||||
|
@@ -1,31 +1,121 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/fan.h>
|
||||
#include <board/dgpu.h>
|
||||
#include <board/power.h>
|
||||
#include <common/debug.h>
|
||||
#include <common/macro.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
#if SMOOTH_FANS != 0
|
||||
#define MAX_JUMP_UP ((MAX_FAN_SPEED - MIN_FAN_SPEED) / (uint8_t)SMOOTH_FANS_UP)
|
||||
#define MAX_JUMP_DOWN ((MAX_FAN_SPEED - MIN_FAN_SPEED) / (uint8_t)SMOOTH_FANS_DOWN)
|
||||
#else
|
||||
#define MAX_JUMP_UP (MAX_FAN_SPEED - MIN_FAN_SPEED)
|
||||
#define MAX_JUMP_DOWN (MAX_FAN_SPEED - MIN_FAN_SPEED)
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
#include <board/peci.h>
|
||||
#endif
|
||||
|
||||
#define MIN_SPEED_TO_SMOOTH PWM_DUTY(SMOOTH_FANS_MIN)
|
||||
|
||||
bool fan_max = false;
|
||||
uint8_t last_duty_dgpu = 0;
|
||||
uint8_t last_duty_peci = 0;
|
||||
|
||||
uint8_t fan1_pwm_actual = 0;
|
||||
uint8_t fan1_pwm_target = 0;
|
||||
uint16_t fan1_rpm = 0;
|
||||
|
||||
uint8_t fan2_pwm_actual = 0;
|
||||
uint8_t fan2_pwm_target = 0;
|
||||
uint16_t fan2_rpm = 0;
|
||||
|
||||
#define TACH_FREQ (CONFIG_CLOCK_FREQ_KHZ * 1000UL)
|
||||
|
||||
// Fan Speed (RPM) = 60 / (1/fs sec * {FnTMRR, FnRLRR} * P)
|
||||
// - n: 1 or 2
|
||||
// - P: the numbers of square pulses per revolution
|
||||
// - fs: sample rate (FreqEC / 128)
|
||||
// - {FnTMRR, FnTLRR} = 0000h: Fan Speed is zero
|
||||
#define TACH_TO_RPM(x) (60UL * TACH_FREQ / 128UL / 2UL / (x))
|
||||
|
||||
#define FAN_POINT(T, D) { .temp = (int16_t)(T), .duty = PWM_DUTY(D) }
|
||||
|
||||
#ifndef FAN1_PWM_MIN
|
||||
#define FAN1_PWM_MIN 0
|
||||
#endif
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#ifndef BOARD_FAN1_HEATUP
|
||||
#define BOARD_FAN1_HEATUP 4
|
||||
#endif
|
||||
|
||||
static uint8_t FAN1_HEATUP[BOARD_FAN1_HEATUP] = { 0 };
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#ifndef BOARD_FAN1_COOLDOWN
|
||||
#define BOARD_FAN1_COOLDOWN 10
|
||||
#endif
|
||||
|
||||
static uint8_t FAN1_COOLDOWN[BOARD_FAN1_COOLDOWN] = { 0 };
|
||||
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
static const struct FanPoint __code FAN1_POINTS[] = {
|
||||
#ifndef BOARD_FAN1_POINTS
|
||||
#error Board must declare fan points
|
||||
#else
|
||||
BOARD_FAN1_POINTS
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct Fan __code FAN1 = {
|
||||
.points = FAN1_POINTS,
|
||||
.points_size = ARRAY_SIZE(FAN1_POINTS),
|
||||
.heatup = FAN1_HEATUP,
|
||||
.heatup_size = ARRAY_SIZE(FAN1_HEATUP),
|
||||
.cooldown = FAN1_COOLDOWN,
|
||||
.cooldown_size = ARRAY_SIZE(FAN1_COOLDOWN),
|
||||
.pwm_min = PWM_DUTY(FAN1_PWM_MIN),
|
||||
};
|
||||
|
||||
#ifdef FAN2_PWM
|
||||
|
||||
#ifndef FAN2_PWM_MIN
|
||||
#define FAN2_PWM_MIN 0
|
||||
#endif
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#ifndef BOARD_FAN2_HEATUP
|
||||
#define BOARD_FAN2_HEATUP 4
|
||||
#endif
|
||||
|
||||
static uint8_t FAN2_HEATUP[BOARD_FAN2_HEATUP] = { 0 };
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#ifndef BOARD_FAN2_COOLDOWN
|
||||
#define BOARD_FAN2_COOLDOWN 10
|
||||
#endif
|
||||
|
||||
static uint8_t FAN2_COOLDOWN[BOARD_FAN2_COOLDOWN] = { 0 };
|
||||
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
static const struct FanPoint __code FAN2_POINTS[] = {
|
||||
#ifndef BOARD_FAN2_POINTS
|
||||
#error Board must declare fan points
|
||||
#else
|
||||
BOARD_FAN2_POINTS
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct Fan __code FAN2 = {
|
||||
.points = FAN2_POINTS,
|
||||
.points_size = ARRAY_SIZE(FAN2_POINTS),
|
||||
.heatup = FAN2_HEATUP,
|
||||
.heatup_size = ARRAY_SIZE(FAN2_HEATUP),
|
||||
.cooldown = FAN2_COOLDOWN,
|
||||
.cooldown_size = ARRAY_SIZE(FAN2_COOLDOWN),
|
||||
.pwm_min = PWM_DUTY(FAN2_PWM_MIN),
|
||||
};
|
||||
|
||||
#endif // FAN2_PWM
|
||||
|
||||
void fan_reset(void) {
|
||||
// Do not manually set fans to maximum speed
|
||||
fan_max = false;
|
||||
}
|
||||
|
||||
// Get duty cycle based on temperature, adapted from
|
||||
// https://github.com/pop-os/system76-power/blob/master/src/fan.rs
|
||||
uint8_t fan_duty(const struct Fan *const fan, int16_t temp) __reentrant {
|
||||
static uint8_t fan_duty(const struct Fan *const fan, int16_t temp) {
|
||||
for (uint8_t i = 0; i < fan->points_size; i++) {
|
||||
const struct FanPoint *cur = &fan->points[i];
|
||||
|
||||
@@ -35,61 +125,19 @@ uint8_t fan_duty(const struct Fan *const fan, int16_t temp) __reentrant {
|
||||
} else if (temp < cur->temp) {
|
||||
// If lower than first temp, return 0%
|
||||
if (i == 0) {
|
||||
return MIN_FAN_SPEED;
|
||||
return 0;
|
||||
} else {
|
||||
const struct FanPoint *prev = &fan->points[i - 1];
|
||||
|
||||
if (fan->interpolate) {
|
||||
// If in between current temp and previous temp, interpolate
|
||||
if (temp > prev->temp) {
|
||||
int16_t dtemp = (cur->temp - prev->temp);
|
||||
int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty);
|
||||
// clang-format off
|
||||
return (uint8_t)(
|
||||
((int16_t)prev->duty) +
|
||||
((temp - prev->temp) * dduty) / dtemp
|
||||
);
|
||||
// clang-format on
|
||||
}
|
||||
} else {
|
||||
return prev->duty;
|
||||
}
|
||||
return prev->duty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If no point is found, return 100%
|
||||
return MAX_FAN_SPEED;
|
||||
return CTR0;
|
||||
}
|
||||
|
||||
void fan_duty_set(uint8_t peci_fan_duty, uint8_t dgpu_fan_duty) __reentrant {
|
||||
#if SYNC_FANS != 0
|
||||
peci_fan_duty = peci_fan_duty > dgpu_fan_duty ? peci_fan_duty : dgpu_fan_duty;
|
||||
dgpu_fan_duty = peci_fan_duty > dgpu_fan_duty ? peci_fan_duty : dgpu_fan_duty;
|
||||
#endif
|
||||
|
||||
// set PECI fan duty
|
||||
if (peci_fan_duty != DCR2) {
|
||||
TRACE("PECI fan_duty_raw=%d\n", peci_fan_duty);
|
||||
last_duty_peci = peci_fan_duty = fan_smooth(last_duty_peci, peci_fan_duty);
|
||||
DCR2 = fan_max ? MAX_FAN_SPEED : peci_fan_duty;
|
||||
#if HAVE_CPU_FAN2
|
||||
// FIXME: Handle better
|
||||
DCR3 = fan_max ? MAX_FAN_SPEED : peci_fan_duty;
|
||||
#endif
|
||||
TRACE("PECI fan_duty_smoothed=%d\n", peci_fan_duty);
|
||||
}
|
||||
|
||||
// set dGPU fan duty
|
||||
if (dgpu_fan_duty != DCR4) {
|
||||
TRACE("DGPU fan_duty_raw=%d\n", dgpu_fan_duty);
|
||||
last_duty_dgpu = dgpu_fan_duty = fan_smooth(last_duty_dgpu, dgpu_fan_duty);
|
||||
DCR4 = fan_max ? MAX_FAN_SPEED : dgpu_fan_duty;
|
||||
TRACE("DGPU fan_duty_smoothed=%d\n", dgpu_fan_duty);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t fan_heatup(const struct Fan *const fan, uint8_t duty) __reentrant {
|
||||
static uint8_t fan_heatup(const struct Fan *const fan, uint8_t duty) {
|
||||
uint8_t lowest = duty;
|
||||
|
||||
uint8_t i;
|
||||
@@ -105,7 +153,7 @@ uint8_t fan_heatup(const struct Fan *const fan, uint8_t duty) __reentrant {
|
||||
return lowest;
|
||||
}
|
||||
|
||||
uint8_t fan_cooldown(const struct Fan *const fan, uint8_t duty) __reentrant {
|
||||
static uint8_t fan_cooldown(const struct Fan *const fan, uint8_t duty) {
|
||||
uint8_t highest = duty;
|
||||
|
||||
uint8_t i;
|
||||
@@ -121,38 +169,109 @@ uint8_t fan_cooldown(const struct Fan *const fan, uint8_t duty) __reentrant {
|
||||
return highest;
|
||||
}
|
||||
|
||||
uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) __reentrant {
|
||||
uint8_t next_duty = duty;
|
||||
static uint8_t fan_get_duty(const struct Fan *const fan, int16_t temp) {
|
||||
uint8_t duty;
|
||||
|
||||
// ramping down
|
||||
if (duty < last_duty) {
|
||||
// out of bounds (lower) safeguard
|
||||
// clang-format off
|
||||
uint8_t smoothed = last_duty < MIN_FAN_SPEED + MAX_JUMP_DOWN
|
||||
? MIN_FAN_SPEED
|
||||
: last_duty - MAX_JUMP_DOWN;
|
||||
// clang-format on
|
||||
duty = fan_duty(fan, temp);
|
||||
duty = fan_heatup(fan, duty);
|
||||
duty = fan_cooldown(fan, duty);
|
||||
|
||||
// use smoothed value if above min and if smoothed is closer than raw
|
||||
if (last_duty > MIN_SPEED_TO_SMOOTH && smoothed > duty) {
|
||||
next_duty = smoothed;
|
||||
}
|
||||
}
|
||||
|
||||
// ramping up
|
||||
if (duty > last_duty) {
|
||||
// out of bounds (higher) safeguard
|
||||
// clang-format off
|
||||
uint8_t smoothed = last_duty > MAX_FAN_SPEED - MAX_JUMP_UP
|
||||
? MAX_FAN_SPEED
|
||||
: last_duty + MAX_JUMP_UP;
|
||||
// clang-format on
|
||||
|
||||
// use smoothed value if above min and if smoothed is closer than raw
|
||||
if (duty > MIN_SPEED_TO_SMOOTH && smoothed < duty) {
|
||||
next_duty = smoothed;
|
||||
}
|
||||
}
|
||||
|
||||
return next_duty;
|
||||
return duty;
|
||||
}
|
||||
|
||||
static uint16_t fan_get_tach0_rpm(void) {
|
||||
uint16_t rpm = (F1TMRR << 8) | F1TLRR;
|
||||
|
||||
if (rpm)
|
||||
rpm = TACH_TO_RPM(rpm);
|
||||
|
||||
return rpm;
|
||||
}
|
||||
|
||||
static uint16_t fan_get_tach1_rpm(void) {
|
||||
uint16_t rpm = (F2TMRR << 8) | F2TLRR;
|
||||
|
||||
if (rpm)
|
||||
rpm = TACH_TO_RPM(rpm);
|
||||
|
||||
return rpm;
|
||||
}
|
||||
|
||||
void fan_event(void) {
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
#if CONFIG_HAVE_DGPU
|
||||
int16_t sys_temp = MAX(peci_temp, dgpu_temp);
|
||||
#else
|
||||
int16_t sys_temp = peci_temp;
|
||||
#endif
|
||||
#elif CONFIG_PLATFORM_AMD
|
||||
// TODO: AMD SB-TSI temp
|
||||
int16_t sys_temp = 50;
|
||||
#endif
|
||||
|
||||
// Fan update interval is 100ms (main.c). The event changes PWM duty
|
||||
// by 1 every interval to give a smoothing effect.
|
||||
|
||||
// Enabling fan max toggle and exiting S0 will cause duty to immediately
|
||||
// change instead of stepping to provide the desired effects.
|
||||
|
||||
// Set FAN1 duty
|
||||
fan1_pwm_target = fan_get_duty(&FAN1, sys_temp);
|
||||
if (fan_max) {
|
||||
fan1_pwm_target = CTR0;
|
||||
fan1_pwm_actual = CTR0;
|
||||
} else if (power_state != POWER_STATE_S0) {
|
||||
fan1_pwm_target = 0;
|
||||
fan1_pwm_actual = 0;
|
||||
} else {
|
||||
if (fan1_pwm_actual < fan1_pwm_target) {
|
||||
if (fan1_pwm_actual < CTR0) {
|
||||
fan1_pwm_actual++;
|
||||
if (fan1_pwm_actual < FAN1.pwm_min) {
|
||||
fan1_pwm_actual = FAN1.pwm_min;
|
||||
}
|
||||
}
|
||||
} else if (fan1_pwm_actual > fan1_pwm_target) {
|
||||
if (fan1_pwm_actual > 0) {
|
||||
fan1_pwm_actual--;
|
||||
if (fan1_pwm_actual < FAN1.pwm_min) {
|
||||
fan1_pwm_actual = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TRACE("FAN1 duty=%d\n", fan1_pwm_actual);
|
||||
FAN1_PWM = fan1_pwm_actual;
|
||||
fan1_rpm = fan_get_tach0_rpm();
|
||||
|
||||
#ifdef FAN2_PWM
|
||||
// set FAN2 duty
|
||||
fan2_pwm_target = fan_get_duty(&FAN2, sys_temp);
|
||||
if (fan_max) {
|
||||
fan2_pwm_target = CTR0;
|
||||
fan2_pwm_actual = CTR0;
|
||||
} else if (power_state != POWER_STATE_S0) {
|
||||
fan2_pwm_target = 0;
|
||||
fan2_pwm_actual = 0;
|
||||
} else {
|
||||
if (fan2_pwm_actual < fan2_pwm_target) {
|
||||
if (fan2_pwm_actual < CTR0) {
|
||||
fan2_pwm_actual++;
|
||||
if (fan2_pwm_actual < FAN2.pwm_min) {
|
||||
fan2_pwm_actual = FAN2.pwm_min;
|
||||
}
|
||||
}
|
||||
} else if (fan2_pwm_actual > fan2_pwm_target) {
|
||||
if (fan2_pwm_actual > 0) {
|
||||
fan2_pwm_actual--;
|
||||
if (fan2_pwm_actual < FAN2.pwm_min) {
|
||||
fan2_pwm_actual = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TRACE("FAN2 duty=%d\n", fan2_pwm_actual);
|
||||
FAN2_PWM = fan2_pwm_actual;
|
||||
fan2_rpm = fan_get_tach1_rpm();
|
||||
#endif
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
// clang-format off
|
||||
#define SPI_DEVICE (0x70)
|
||||
#define SPI_FOLLOW_MODE (0x0F)
|
||||
#define SPI_CHIP_SELECT (0xFD)
|
||||
@@ -30,7 +29,6 @@ volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
#define SPI_ERASE_SECTOR_COMMAND (0xD7)
|
||||
|
||||
#define SPI_STATUS_WIP (0x01)
|
||||
// clang-format on
|
||||
|
||||
void flash_enter_follow_mode(void);
|
||||
void flash_exit_follow_mode(void);
|
||||
@@ -48,9 +46,8 @@ void flash_write_enable(void);
|
||||
* NOTE: __critical to ensure interrupts are disabled. This does mean that interrupt
|
||||
* such as the timer will be block until flash acccess is complete
|
||||
*/
|
||||
// clang-format off
|
||||
void flash_entry(uint32_t addr, uint8_t *data, uint32_t length, uint8_t command) __reentrant __critical {
|
||||
// clang-format on
|
||||
void flash_entry(uint32_t addr, uint8_t *data, uint32_t length,
|
||||
uint8_t command) __reentrant __critical {
|
||||
// Only allow access from 64KB to 128KB.
|
||||
if ((addr < 0x10000) || (length > 0x10000) || ((addr + length) > 0x20000))
|
||||
return;
|
||||
@@ -73,7 +70,8 @@ void flash_entry(uint32_t addr, uint8_t *data, uint32_t length, uint8_t command)
|
||||
flash_enter_follow_mode();
|
||||
|
||||
while (length) {
|
||||
// Note, this is the slow way to do it, but it's simple and all bytes are written properly.
|
||||
// Note, this is the slow way to do it, but it's simple and all
|
||||
// bytes are written properly.
|
||||
flash_write_enable();
|
||||
|
||||
// Select the device
|
||||
|
@@ -3,17 +3,28 @@
|
||||
#ifndef _BOARD_DGPU_H
|
||||
#define _BOARD_DGPU_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef HAVE_DGPU
|
||||
#define HAVE_DGPU 0
|
||||
#endif
|
||||
#if CONFIG_HAVE_DGPU
|
||||
|
||||
#if HAVE_DGPU
|
||||
extern int16_t dgpu_temp;
|
||||
#endif // HAVE_DGPU
|
||||
|
||||
void dgpu_init(void);
|
||||
uint8_t dgpu_get_fan_duty(void);
|
||||
bool dgpu_get_temp(int16_t *const data);
|
||||
void dgpu_read_temp(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline void dgpu_init(void) {}
|
||||
|
||||
static inline bool dgpu_get_temp(int16_t *const data) {
|
||||
*data = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void dgpu_read_temp(void) {}
|
||||
|
||||
#endif // CONFIG_HAVE_DGPU
|
||||
|
||||
#endif // _BOARD_DGPU_H
|
||||
|
@@ -7,29 +7,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define PWM_DUTY(X) ((uint8_t)(((((uint16_t)(X)) * 255) + 99) / 100))
|
||||
#define MAX_FAN_SPEED PWM_DUTY(100)
|
||||
#define MIN_FAN_SPEED PWM_DUTY(0)
|
||||
|
||||
#ifndef SMOOTH_FANS
|
||||
#define SMOOTH_FANS 1 // default to fan smoothing
|
||||
#endif
|
||||
|
||||
#ifndef SYNC_FANS
|
||||
#define SYNC_FANS 1 // default to syncing fan speeds
|
||||
#endif
|
||||
|
||||
#if SMOOTH_FANS != 0
|
||||
#ifndef SMOOTH_FANS_UP
|
||||
#define SMOOTH_FANS_UP 45 // default to ~11 seconds for full ramp-up
|
||||
#endif
|
||||
#ifndef SMOOTH_FANS_DOWN
|
||||
#define SMOOTH_FANS_DOWN 100 // default to ~25 seconds for full ramp-down
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SMOOTH_FANS_MIN
|
||||
#define SMOOTH_FANS_MIN 0 // default to smoothing all fan speed changes
|
||||
#endif
|
||||
|
||||
struct FanPoint {
|
||||
int16_t temp;
|
||||
@@ -43,17 +20,19 @@ struct Fan {
|
||||
uint8_t heatup_size;
|
||||
uint8_t *cooldown;
|
||||
uint8_t cooldown_size;
|
||||
bool interpolate;
|
||||
uint8_t pwm_min;
|
||||
};
|
||||
|
||||
extern bool fan_max;
|
||||
|
||||
void fan_reset(void);
|
||||
extern uint8_t fan1_pwm_actual;
|
||||
extern uint8_t fan1_pwm_target;
|
||||
extern uint16_t fan1_rpm;
|
||||
extern uint8_t fan2_pwm_actual;
|
||||
extern uint8_t fan2_pwm_target;
|
||||
extern uint16_t fan2_rpm;
|
||||
|
||||
uint8_t fan_duty(const struct Fan *const fan, int16_t temp) __reentrant;
|
||||
void fan_duty_set(uint8_t peci_fan_duty, uint8_t dgpu_fan_duty) __reentrant;
|
||||
uint8_t fan_heatup(const struct Fan *const fan, uint8_t duty) __reentrant;
|
||||
uint8_t fan_cooldown(const struct Fan *const fan, uint8_t duty) __reentrant;
|
||||
uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) __reentrant;
|
||||
void fan_reset(void);
|
||||
void fan_event(void);
|
||||
|
||||
#endif // _BOARD_FAN_H
|
||||
|
@@ -12,11 +12,9 @@
|
||||
/** \cond INTERNAL
|
||||
* Internal defines
|
||||
*/
|
||||
// clang-format off
|
||||
#define FLASH_COMMAND_READ (0x0)
|
||||
#define FLASH_COMMAND_WRITE (0x1)
|
||||
#define FLASH_COMMAND_ERASE_1K (0x2)
|
||||
// clang-format on
|
||||
/** \endcond */
|
||||
|
||||
/**
|
||||
|
@@ -3,16 +3,24 @@
|
||||
#ifndef _BOARD_PECI_H
|
||||
#define _BOARD_PECI_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ec/peci.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern bool peci_on;
|
||||
extern int16_t peci_temp;
|
||||
|
||||
enum PeciCmd {
|
||||
PECI_CMD_PING = 0x00,
|
||||
PECI_CMD_GET_TEMP = 0x01,
|
||||
PECI_CMD_RD_PKG_CONFIG = 0xA1,
|
||||
PECI_CMD_WR_PKG_CONFIG = 0xA5,
|
||||
PECI_CMD_RD_IAMSR = 0xB1,
|
||||
PECI_CMD_GET_DIB = 0xF7,
|
||||
};
|
||||
|
||||
void peci_init(void);
|
||||
bool peci_available(void);
|
||||
int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data);
|
||||
uint8_t peci_get_fan_duty(void);
|
||||
void peci_read_temp(void);
|
||||
|
||||
#endif // _BOARD_PECI_H
|
||||
|
@@ -17,7 +17,6 @@ void power_init(void);
|
||||
void power_on(void);
|
||||
void power_off(void);
|
||||
void power_cpu_reset(void);
|
||||
|
||||
void power_event(void);
|
||||
|
||||
#endif // _BOARD_POWER_H
|
||||
|
@@ -3,8 +3,6 @@
|
||||
#ifndef _BOARD_PWM_H
|
||||
#define _BOARD_PWM_H
|
||||
|
||||
#include <ec/pwm.h>
|
||||
|
||||
void pwm_init(void);
|
||||
|
||||
#endif // _BOARD_PWM_H
|
||||
|
@@ -41,7 +41,6 @@ static bool kbc_translate = true;
|
||||
// LED state
|
||||
uint8_t kbc_leds = 0;
|
||||
|
||||
// clang-format off
|
||||
// Values from linux/drivers/input/keyboard/atkbd.c
|
||||
static const uint16_t kbc_typematic_period[32] = {
|
||||
33, // 30.0 cps = ~33.33ms
|
||||
@@ -77,7 +76,6 @@ static const uint16_t kbc_typematic_period[32] = {
|
||||
470, // 2.1 cps = ~478.19ms
|
||||
500, // 2.0 cps = 500ms
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static uint8_t kbc_buffer[16] = { 0 };
|
||||
static uint8_t kbc_buffer_head = 0;
|
||||
@@ -122,7 +120,7 @@ bool kbc_scancode(uint16_t key, bool pressed) {
|
||||
case KF_E0:
|
||||
scancodes[scancodes_len++] = 0xE0;
|
||||
key &= 0xFF;
|
||||
// Fall through
|
||||
// Fall through
|
||||
case 0x00:
|
||||
if (!pressed) {
|
||||
if (kbc_translate) {
|
||||
@@ -260,7 +258,7 @@ static void kbc_on_input_data(struct Kbc *const kbc, uint8_t data) {
|
||||
case KBC_STATE_TOUCHPAD:
|
||||
// Interrupt touchpad command
|
||||
state = KBC_STATE_NORMAL;
|
||||
// Fall through
|
||||
// Fall through
|
||||
case KBC_STATE_NORMAL:
|
||||
TRACE(" keyboard command\n");
|
||||
// Keyboard commands clear output buffer
|
||||
@@ -424,7 +422,7 @@ static void kbc_on_output_empty(struct Kbc *const kbc) {
|
||||
break;
|
||||
case KBC_STATE_TOUCHPAD:
|
||||
state_data = *(PS2_TOUCHPAD.data);
|
||||
// Fall through
|
||||
// Fall through
|
||||
case KBC_STATE_MOUSE:
|
||||
TRACE("kbc mouse: %02X\n", state_data);
|
||||
if (kbc_mouse(kbc, state_data, KBC_TIMEOUT)) {
|
||||
|
@@ -31,26 +31,26 @@ void kbled_reset(void) {
|
||||
|
||||
// Keep the following functions for compatibility - they are set via USB HID
|
||||
uint8_t kbled_get(void) {
|
||||
/* Always off */
|
||||
// Always off
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t kbled_max(void) {
|
||||
/* Always off */
|
||||
// Always off
|
||||
return 0;
|
||||
}
|
||||
|
||||
void kbled_set(uint8_t level) {
|
||||
/* Fix unused variable */
|
||||
// Fix unused variable
|
||||
level = level;
|
||||
}
|
||||
|
||||
uint32_t kbled_get_color(void) {
|
||||
/* Always black */
|
||||
// Always black
|
||||
return 0;
|
||||
}
|
||||
|
||||
void kbled_set_color(uint32_t color) {
|
||||
/* Fix unused variable */
|
||||
// Fix unused variable
|
||||
color = color;
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
enum KbledKind kbled_kind = KBLED_NONE;
|
||||
|
||||
// clang-format off
|
||||
static uint8_t LEVEL_I = 1;
|
||||
#ifdef KBLED_DAC
|
||||
// XXX: DAC uses separate levels due to brightness being different.
|
||||
@@ -38,7 +37,6 @@ static const uint32_t __code COLORS[] = {
|
||||
0x00FFFF,
|
||||
0xFFFF00
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void kbled_hotkey_color(void) {
|
||||
if (COLOR_I < (ARRAY_SIZE(COLORS) - 1)) {
|
||||
|
@@ -35,11 +35,11 @@ void kbled_set(uint8_t level) {
|
||||
}
|
||||
|
||||
uint32_t kbled_get_color(void) {
|
||||
/* Always white */
|
||||
// Always white
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
void kbled_set_color(uint32_t color) {
|
||||
/* Fix unused variable */
|
||||
// Fix unused variable
|
||||
color = color;
|
||||
}
|
||||
|
@@ -45,10 +45,21 @@ static inline bool matrix_position_is_fn(uint8_t row, uint8_t col) {
|
||||
// Assert the specified column for reading the row.
|
||||
static void kbscan_set_column(uint8_t col) {
|
||||
// Assert the specific bit corresponding to the column.
|
||||
uint32_t colbit = ~BIT(col);
|
||||
KSOL = colbit & 0xFF;
|
||||
KSOH1 = (colbit >> 8) & 0xFF;
|
||||
KSOH2 = (colbit >> 16) & 0x03;
|
||||
// XXX: IT8587E will hang if the column is determined with:
|
||||
// uint32_t colbit = ~BIT(col);
|
||||
if (col < 8) {
|
||||
KSOL = ~BIT(col);
|
||||
KSOH1 = 0xFF;
|
||||
KSOH2 = 0xFF;
|
||||
} else if (col < 16) {
|
||||
KSOL = 0xFF;
|
||||
KSOH1 = ~BIT(col - 8);
|
||||
KSOH2 = 0xFF;
|
||||
} else {
|
||||
KSOL = 0xFF;
|
||||
KSOH1 = 0xFF;
|
||||
KSOH2 = ~BIT(col - 16);
|
||||
}
|
||||
|
||||
// Wait for matrix to stabilize
|
||||
delay_ticks(20);
|
||||
@@ -58,7 +69,7 @@ static void kbscan_set_column(uint8_t col) {
|
||||
static void kbscan_disable_reading(void) {
|
||||
KSOL = 0xFF;
|
||||
KSOH1 = 0xFF;
|
||||
KSOH2 = 0x3;
|
||||
KSOH2 = 0xFF;
|
||||
|
||||
// No need to wait for matrix to stabilize as a read won't happen.
|
||||
}
|
||||
@@ -284,15 +295,15 @@ void kbscan_event(void) {
|
||||
uint8_t matrix_curr[KM_OUT];
|
||||
|
||||
static bool debounce = false;
|
||||
static uint32_t debounce_time = 0;
|
||||
static systick_t debounce_time = 0;
|
||||
|
||||
static bool repeat = false;
|
||||
static uint16_t repeat_key = 0;
|
||||
static uint32_t repeat_key_time = 0;
|
||||
static systick_t repeat_key_time = 0;
|
||||
|
||||
// If debounce complete
|
||||
if (debounce) {
|
||||
uint32_t time = time_get();
|
||||
systick_t time = time_get();
|
||||
if ((time - debounce_time) >= DEBOUNCE_DELAY) {
|
||||
// Debounce time elapsed: Read new state
|
||||
debounce = false;
|
||||
@@ -330,10 +341,8 @@ void kbscan_event(void) {
|
||||
|
||||
// A key was pressed or released
|
||||
for (uint8_t j = 0; j < KM_IN; j++) {
|
||||
// clang-format off
|
||||
bool new_b = new & BIT(j);
|
||||
bool last_b = last & BIT(j);
|
||||
// clang-format on
|
||||
if (new_b != last_b) {
|
||||
bool reset = false;
|
||||
|
||||
@@ -384,10 +393,10 @@ void kbscan_event(void) {
|
||||
}
|
||||
|
||||
kbscan_matrix[i] = new;
|
||||
} else if (new &&repeat_key != 0 && key_should_repeat(repeat_key)) {
|
||||
} else if (new && repeat_key != 0 && key_should_repeat(repeat_key)) {
|
||||
// A key is being pressed
|
||||
uint32_t time = time_get();
|
||||
static uint32_t repeat_start = 0;
|
||||
systick_t time = time_get();
|
||||
static systick_t repeat_start = 0;
|
||||
|
||||
if (!repeat) {
|
||||
if (time < repeat_key_time) {
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <board/kbscan.h>
|
||||
#include <board/keymap.h>
|
||||
#include <board/lid.h>
|
||||
#include <board/peci.h>
|
||||
#include <board/pmc.h>
|
||||
#include <board/power.h>
|
||||
#include <board/ps2.h>
|
||||
@@ -31,6 +30,10 @@
|
||||
#include <common/version.h>
|
||||
#include <ec/ec.h>
|
||||
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
#include <board/peci.h>
|
||||
#endif
|
||||
|
||||
#ifdef PARALLEL_DEBUG
|
||||
#include <board/parallel.h>
|
||||
#endif // PARALLEL_DEBUG
|
||||
@@ -44,10 +47,10 @@ void serial(void) __interrupt(4) {}
|
||||
void timer_2(void) __interrupt(5) {}
|
||||
|
||||
uint8_t main_cycle = 0;
|
||||
const uint16_t battery_interval = 1000;
|
||||
// update fan speed more frequently for smoother fans
|
||||
// NOTE: event loop is longer than 100ms and maybe even longer than 250
|
||||
const uint16_t fan_interval = SMOOTH_FANS != 0 ? 250 : 1000;
|
||||
|
||||
#define INTERVAL_100MS 100U
|
||||
#define INTERVAL_250MS 250U
|
||||
#define INTERVAL_1SEC 1000U
|
||||
|
||||
void init(void) {
|
||||
// Must happen first
|
||||
@@ -57,7 +60,7 @@ void init(void) {
|
||||
gpio_init();
|
||||
|
||||
// Can happen in any order
|
||||
#if HAVE_DGPU
|
||||
#if CONFIG_HAVE_DGPU
|
||||
dgpu_init();
|
||||
#endif
|
||||
ecpm_init();
|
||||
@@ -73,7 +76,9 @@ void init(void) {
|
||||
kbscan_init();
|
||||
}
|
||||
keymap_init();
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
peci_init();
|
||||
#endif
|
||||
pmc_init();
|
||||
pwm_init();
|
||||
smbus_init();
|
||||
@@ -98,8 +103,9 @@ void main(void) {
|
||||
|
||||
INFO("System76 EC board '%s', version '%s'\n", board(), version());
|
||||
|
||||
uint32_t last_time_battery = 0;
|
||||
uint32_t last_time_fan = 0;
|
||||
systick_t last_time_100ms = 0;
|
||||
systick_t last_time_250ms = 0;
|
||||
systick_t last_time_1sec = 0;
|
||||
|
||||
for (main_cycle = 0;; main_cycle++) {
|
||||
// NOTE: Do note use modulo to avoid expensive call to SDCC library
|
||||
@@ -128,20 +134,26 @@ void main(void) {
|
||||
}
|
||||
|
||||
if (main_cycle == 0) {
|
||||
uint32_t time = time_get();
|
||||
// Only run the following once per interval
|
||||
if ((time - last_time_fan) >= fan_interval) {
|
||||
last_time_fan = time;
|
||||
systick_t time = time_get();
|
||||
|
||||
// Update fan speeds
|
||||
fan_duty_set(peci_get_fan_duty(), dgpu_get_fan_duty());
|
||||
if ((time - last_time_100ms) >= INTERVAL_100MS) {
|
||||
last_time_100ms = time;
|
||||
|
||||
fan_event();
|
||||
}
|
||||
|
||||
// Only run the following once per interval
|
||||
if ((time - last_time_battery) >= battery_interval) {
|
||||
last_time_battery = time;
|
||||
if ((time - last_time_250ms) >= INTERVAL_250MS) {
|
||||
last_time_250ms = time;
|
||||
|
||||
#if CONFIG_PLATFORM_INTEL
|
||||
peci_read_temp();
|
||||
#endif
|
||||
dgpu_read_temp();
|
||||
}
|
||||
|
||||
if ((time - last_time_1sec) >= INTERVAL_1SEC) {
|
||||
last_time_1sec = time;
|
||||
|
||||
// Updates battery status
|
||||
battery_event();
|
||||
}
|
||||
}
|
||||
|
@@ -19,14 +19,12 @@
|
||||
* nWAIT = KSOH[1]
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
#define CTL_WRITE BIT(0)
|
||||
#define CTL_DATA BIT(1)
|
||||
#define CTL_RESET BIT(2)
|
||||
#define CTL_ADDR BIT(3)
|
||||
|
||||
#define STS_WAIT BIT(1)
|
||||
// clang-format on
|
||||
|
||||
// Maximum peripheral response time in ms
|
||||
#define PARALLEL_TIMEOUT 10
|
||||
@@ -34,7 +32,7 @@
|
||||
bool parallel_debug = false;
|
||||
|
||||
static bool parallel_wait_peripheral(uint8_t mask, uint8_t value) {
|
||||
uint32_t start = time_get();
|
||||
systick_t start = time_get();
|
||||
|
||||
while ((time_get() - start) < PARALLEL_TIMEOUT) {
|
||||
if ((KSOHGDMRR & mask) == value) {
|
||||
|
@@ -1,5 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
// PECI information can be found here:
|
||||
// https://www.intel.com/content/dam/www/public/us/en/documents/design-guides/core-i7-lga-2011-guide.pdf
|
||||
|
||||
#include <arch/time.h>
|
||||
#include <board/espi.h>
|
||||
#include <board/fan.h>
|
||||
@@ -11,58 +14,15 @@
|
||||
#include <ec/gpio.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Fan speed is the lowest requested over HEATUP seconds
|
||||
#ifndef BOARD_HEATUP
|
||||
#define BOARD_HEATUP 4
|
||||
#endif
|
||||
|
||||
static uint8_t FAN_HEATUP[BOARD_HEATUP] = { 0 };
|
||||
|
||||
// Fan speed is the highest HEATUP speed over COOLDOWN seconds
|
||||
#ifndef BOARD_COOLDOWN
|
||||
#define BOARD_COOLDOWN 10
|
||||
#endif
|
||||
|
||||
static uint8_t FAN_COOLDOWN[BOARD_COOLDOWN] = { 0 };
|
||||
|
||||
// Tjunction = 100C for i7-8565U (and probably the same for all WHL-U)
|
||||
#define T_JUNCTION 100
|
||||
|
||||
bool peci_on = false;
|
||||
int16_t peci_temp = 0;
|
||||
|
||||
#define PECI_TEMP(X) ((int16_t)(X))
|
||||
// Tjunction = 100C for i7-8565U (and probably the same for all WHL-U)
|
||||
#define T_JUNCTION ((int16_t)100)
|
||||
|
||||
// Maximum OOB channel response time in ms
|
||||
#define PECI_ESPI_TIMEOUT 10
|
||||
|
||||
// clang-format off
|
||||
#define FAN_POINT(T, D) { .temp = PECI_TEMP(T), .duty = PWM_DUTY(D) }
|
||||
// clang-format on
|
||||
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
static struct FanPoint __code FAN_POINTS[] = {
|
||||
#ifdef BOARD_FAN_POINTS
|
||||
BOARD_FAN_POINTS
|
||||
#else
|
||||
FAN_POINT(70, 40),
|
||||
FAN_POINT(75, 50),
|
||||
FAN_POINT(80, 60),
|
||||
FAN_POINT(85, 65),
|
||||
FAN_POINT(90, 65)
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct Fan __code FAN = {
|
||||
.points = FAN_POINTS,
|
||||
.points_size = ARRAY_SIZE(FAN_POINTS),
|
||||
.heatup = FAN_HEATUP,
|
||||
.heatup_size = ARRAY_SIZE(FAN_HEATUP),
|
||||
.cooldown = FAN_COOLDOWN,
|
||||
.cooldown_size = ARRAY_SIZE(FAN_COOLDOWN),
|
||||
.interpolate = SMOOTH_FANS != 0,
|
||||
};
|
||||
|
||||
// Returns true if peci is available
|
||||
bool peci_available(void) {
|
||||
// Ensure power state is up to date
|
||||
@@ -84,7 +44,7 @@ bool peci_available(void) {
|
||||
|
||||
// If VW_HOST_C10 virtual wire is VWS_HIGH, PECI will wake the CPU
|
||||
//TODO: wake CPU every 8 seconds following Intel recommendation?
|
||||
return (vw_get(&VW_HOST_C10) != VWS_HIGH);
|
||||
return vw_get(&VW_HOST_C10) != VWS_HIGH;
|
||||
#else
|
||||
// PECI is available if PLTRST# is high
|
||||
return gpio_get(&BUF_PLT_RST_N);
|
||||
@@ -124,8 +84,8 @@ bool peci_get_temp(int16_t *const data) {
|
||||
UDB[5] = 1;
|
||||
// PECI read length
|
||||
UDB[6] = 2;
|
||||
// PECI command (0x01 = GetTemp)
|
||||
UDB[7] = 0x01;
|
||||
// PECI command
|
||||
UDB[7] = PECI_CMD_GET_TEMP;
|
||||
|
||||
// Set upstream enable
|
||||
ESUCTRL0 |= ESUCTRL0_ENABLE;
|
||||
@@ -133,7 +93,7 @@ bool peci_get_temp(int16_t *const data) {
|
||||
ESUCTRL0 |= ESUCTRL0_GO;
|
||||
|
||||
// Wait until upstream done
|
||||
uint32_t start = time_get();
|
||||
systick_t start = time_get();
|
||||
while (!(ESUCTRL0 & ESUCTRL0_DONE)) {
|
||||
if ((time_get() - start) >= PECI_ESPI_TIMEOUT) {
|
||||
DEBUG("peci_get_temp: upstream timeout\n");
|
||||
@@ -161,9 +121,12 @@ bool peci_get_temp(int16_t *const data) {
|
||||
// Received enough data for temperature
|
||||
uint8_t low = PUTOOBDB[5];
|
||||
uint8_t high = PUTOOBDB[6];
|
||||
*data = (((int16_t)high << 8) | (int16_t)low);
|
||||
int16_t offset = (((int16_t)high << 8) | (int16_t)low);
|
||||
*data = T_JUNCTION + (offset >> 6);
|
||||
|
||||
// Clear PUT_OOB status
|
||||
ESOCTRL0 = ESOCTRL0_STATUS;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
// Did not receive enough data
|
||||
@@ -204,8 +167,8 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
UDB[5] = 10;
|
||||
// PECI read length
|
||||
UDB[6] = 1;
|
||||
// PECI command (0xA5 = WrPkgConfig)
|
||||
UDB[7] = 0xA5;
|
||||
// PECI command
|
||||
UDB[7] = PECI_CMD_WR_PKG_CONFIG;
|
||||
|
||||
// Write host ID
|
||||
UDB[8] = 0;
|
||||
@@ -226,7 +189,7 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
ESUCTRL0 |= ESUCTRL0_GO;
|
||||
|
||||
// Wait until upstream done
|
||||
uint32_t start = time_get();
|
||||
systick_t start = time_get();
|
||||
while (!(ESUCTRL0 & ESUCTRL0_DONE)) {
|
||||
DEBUG("peci_wr_pkg_config: wait upstream\n");
|
||||
if ((time_get() - start) >= PECI_ESPI_TIMEOUT) {
|
||||
@@ -291,7 +254,7 @@ void peci_init(void) {
|
||||
// Returns true on success, false on error
|
||||
bool peci_get_temp(int16_t *const data) {
|
||||
// Wait for any in-progress transaction to complete
|
||||
uint32_t start = time_get();
|
||||
systick_t start = time_get();
|
||||
while (HOSTAR & BIT(0)) {
|
||||
if ((time_get() - start) >= PECI_ESPI_TIMEOUT) {
|
||||
DEBUG("%s: host timeout\n", __func__);
|
||||
@@ -311,7 +274,7 @@ bool peci_get_temp(int16_t *const data) {
|
||||
// Set read length
|
||||
HORDLR = 2;
|
||||
// Set command
|
||||
HOCMDR = 1;
|
||||
HOCMDR = PECI_CMD_GET_TEMP;
|
||||
// Start transaction
|
||||
HOCTLR |= 1;
|
||||
|
||||
@@ -330,23 +293,24 @@ bool peci_get_temp(int16_t *const data) {
|
||||
// Clear status
|
||||
HOSTAR = HOSTAR;
|
||||
return false;
|
||||
} else {
|
||||
// Read two byte temperature data if finished successfully
|
||||
uint8_t low = HORDDR;
|
||||
uint8_t high = HORDDR;
|
||||
*data = (((int16_t)high << 8) | (int16_t)low);
|
||||
|
||||
// Clear status
|
||||
HOSTAR = HOSTAR;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Read two byte temperature data if finished successfully
|
||||
uint8_t low = HORDDR;
|
||||
uint8_t high = HORDDR;
|
||||
int16_t offset = (((int16_t)high << 8) | (int16_t)low);
|
||||
*data = T_JUNCTION + (offset >> 6);
|
||||
|
||||
// Clear status
|
||||
HOSTAR = HOSTAR;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns positive completion code on success, negative completion code or
|
||||
// negative (0x1000 | status register) on PECI hardware error
|
||||
int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
// Wait for any in-progress transaction to complete
|
||||
uint32_t start = time_get();
|
||||
systick_t start = time_get();
|
||||
while (HOSTAR & BIT(0)) {
|
||||
if ((time_get() - start) >= PECI_ESPI_TIMEOUT) {
|
||||
DEBUG("%s: host timeout\n", __func__);
|
||||
@@ -366,7 +330,7 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
// Set read length
|
||||
HORDLR = 1;
|
||||
// Set command
|
||||
HOCMDR = 0xA5;
|
||||
HOCMDR = PECI_CMD_WR_PKG_CONFIG;
|
||||
|
||||
// Write host ID
|
||||
HOWRDR = 0;
|
||||
@@ -417,37 +381,13 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
|
||||
#endif // CONFIG_PECI_OVER_ESPI
|
||||
|
||||
// PECI information can be found here: https://www.intel.com/content/dam/www/public/us/en/documents/design-guides/core-i7-lga-2011-guide.pdf
|
||||
uint8_t peci_get_fan_duty(void) {
|
||||
uint8_t duty;
|
||||
|
||||
void peci_read_temp(void) {
|
||||
peci_on = peci_available();
|
||||
if (peci_on) {
|
||||
int16_t peci_offset = 0;
|
||||
if (peci_get_temp(&peci_offset)) {
|
||||
// Use result if finished successfully
|
||||
peci_temp = PECI_TEMP(T_JUNCTION) + (peci_offset >> 6);
|
||||
duty = fan_duty(&FAN, peci_temp);
|
||||
} else {
|
||||
// Default to 50% if there is an error
|
||||
peci_temp = 0;
|
||||
duty = PWM_DUTY(50);
|
||||
if (peci_get_temp(&peci_temp)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Turn fan off if not in S0 state
|
||||
peci_temp = 0;
|
||||
duty = PWM_DUTY(0);
|
||||
}
|
||||
|
||||
if (peci_on && fan_max) {
|
||||
// Override duty if fans are manually set to maximum
|
||||
duty = PWM_DUTY(100);
|
||||
} else {
|
||||
// Apply heatup and cooldown filters to duty
|
||||
duty = fan_heatup(&FAN, duty);
|
||||
duty = fan_cooldown(&FAN, duty);
|
||||
}
|
||||
|
||||
TRACE("PECI temp=%d\n", peci_temp);
|
||||
return duty;
|
||||
peci_temp = 0;
|
||||
}
|
||||
|
12
src/board/system76/common/power/amd.c
Normal file
12
src/board/system76/common/power/amd.c
Normal file
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/power.h>
|
||||
|
||||
enum PowerState power_state = POWER_STATE_OFF;
|
||||
|
||||
void update_power_state(void) {}
|
||||
void power_init(void) {}
|
||||
void power_on(void) {}
|
||||
void power_off(void) {}
|
||||
void power_cpu_reset(void) {}
|
||||
void power_event(void) {}
|
@@ -1,5 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/power.h>
|
||||
|
||||
#include <arch/delay.h>
|
||||
#include <arch/time.h>
|
||||
#include <board/acpi.h>
|
||||
@@ -12,7 +14,6 @@
|
||||
#include <board/kbled.h>
|
||||
#include <board/lid.h>
|
||||
#include <board/peci.h>
|
||||
#include <board/power.h>
|
||||
#include <board/pmc.h>
|
||||
#include <board/pnp.h>
|
||||
#include <board/wireless.h>
|
||||
@@ -491,7 +492,6 @@ void power_event(void) {
|
||||
}
|
||||
pg_last = pg_new;
|
||||
|
||||
// clang-format off
|
||||
static bool rst_last = false;
|
||||
bool rst_new = gpio_get(&BUF_PLT_RST_N);
|
||||
#if LEVEL >= LEVEL_DEBUG
|
||||
@@ -508,7 +508,6 @@ void power_event(void) {
|
||||
#endif // CONFIG_BUS_ESPI
|
||||
}
|
||||
rst_last = rst_new;
|
||||
// clang-format on
|
||||
|
||||
#if HAVE_SLP_SUS_N
|
||||
#if LEVEL >= LEVEL_DEBUG
|
||||
@@ -574,8 +573,8 @@ void power_event(void) {
|
||||
wake_last = wake_new;
|
||||
#endif // HAVE_LAN_WAKEUP_N
|
||||
|
||||
static uint32_t last_time = 0;
|
||||
uint32_t time = time_get();
|
||||
static systick_t last_time = 0;
|
||||
systick_t time = time_get();
|
||||
if (power_state == POWER_STATE_S0) {
|
||||
#if CONFIG_BUS_ESPI
|
||||
// HOST_C10 virtual wire is high when CPU is in C10 sleep state
|
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/pwm.h>
|
||||
#include <ec/pwm.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
void pwm_init(void) {
|
||||
@@ -23,10 +24,10 @@ void pwm_init(void) {
|
||||
// Set cycle time to 255 + 1
|
||||
CTR0 = 255;
|
||||
|
||||
// Turn off CPU fan (temperature control in peci_get_fan_duty)
|
||||
DCR2 = 0;
|
||||
#if HAVE_CPU_FAN2
|
||||
DCR3 = 0;
|
||||
// Turn off fans
|
||||
FAN1_PWM = 0;
|
||||
#ifdef FAN2_PWM
|
||||
FAN2_PWM = 0;
|
||||
#endif
|
||||
|
||||
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
|
||||
|
@@ -1,14 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <board/dgpu.h>
|
||||
#include <board/fan.h>
|
||||
#include <board/smfi.h>
|
||||
#include <common/macro.h>
|
||||
#include <ec/pwm.h>
|
||||
#include <ec/scratch.h>
|
||||
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Include scratch ROM
|
||||
uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = {
|
||||
#include <scratch.h>
|
||||
@@ -17,12 +18,9 @@ uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = {
|
||||
// Enter or exit scratch ROM
|
||||
void scratch_trampoline(void) {
|
||||
// Set fans to 100%
|
||||
DCR2 = 0xFF;
|
||||
#if HAVE_CPU_FAN2
|
||||
DCR3 = 0xFF;
|
||||
#endif
|
||||
#if HAVE_DGPU
|
||||
DCR4 = 0xFF;
|
||||
FAN1_PWM = CTR0;
|
||||
#ifdef FAN2_PWM
|
||||
FAN2_PWM = CTR0;
|
||||
#endif
|
||||
|
||||
//TODO: Clear keyboard presses
|
||||
|
@@ -11,7 +11,7 @@ enum SecurityState security_get(void) {
|
||||
|
||||
bool security_set(enum SecurityState state) {
|
||||
switch (state) {
|
||||
// Allow perpare states to be set
|
||||
// Allow prepare states to be set
|
||||
case SECURITY_STATE_PREPARE_LOCK:
|
||||
case SECURITY_STATE_PREPARE_UNLOCK:
|
||||
security_state = state;
|
||||
|
@@ -13,27 +13,29 @@
|
||||
// the command is complete and the result is available. The client should only
|
||||
// read the SMFI_CMD_RES value when SMFI_CMD_CMD is set to CMD_NONE.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <board/smfi.h>
|
||||
|
||||
#if !defined(__SCRATCH__)
|
||||
#include <board/scratch.h>
|
||||
#include <board/fan.h>
|
||||
#include <board/kbled.h>
|
||||
#include <board/kbscan.h>
|
||||
#include <board/scratch.h>
|
||||
|
||||
#if CONFIG_SECURITY
|
||||
#include <board/security.h>
|
||||
#endif // CONFIG_SECURITY
|
||||
|
||||
#endif // !defined(__SCRATCH__)
|
||||
#include <board/smfi.h>
|
||||
|
||||
#include <common/command.h>
|
||||
#include <common/macro.h>
|
||||
#include <common/version.h>
|
||||
#include <ec/etwd.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// Shared memory host semaphore
|
||||
volatile uint8_t __xdata __at(0x1022) SMHSR;
|
||||
// Host RAM window control
|
||||
@@ -123,15 +125,14 @@ static enum Result cmd_print(void) {
|
||||
|
||||
static enum Result cmd_fan_get(void) {
|
||||
switch (smfi_cmd[SMFI_CMD_DATA]) {
|
||||
case 0:
|
||||
// Get duty of fan 0
|
||||
smfi_cmd[SMFI_CMD_DATA + 1] = DCR2;
|
||||
return RES_OK;
|
||||
case 1:
|
||||
// Get duty of fan 1
|
||||
//TODO: only allow on platforms like addw2
|
||||
smfi_cmd[SMFI_CMD_DATA + 1] = DCR4;
|
||||
smfi_cmd[SMFI_CMD_DATA + 1] = fan1_pwm_actual;
|
||||
return RES_OK;
|
||||
#ifdef FAN2_PWM
|
||||
case 2:
|
||||
smfi_cmd[SMFI_CMD_DATA + 1] = fan2_pwm_actual;
|
||||
return RES_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Failed if fan not found
|
||||
@@ -140,15 +141,16 @@ static enum Result cmd_fan_get(void) {
|
||||
|
||||
static enum Result cmd_fan_set(void) {
|
||||
switch (smfi_cmd[SMFI_CMD_DATA]) {
|
||||
case 0:
|
||||
// Set duty cycle of fan 0
|
||||
DCR2 = smfi_cmd[SMFI_CMD_DATA + 1];
|
||||
return RES_OK;
|
||||
case 1:
|
||||
// Set duty cycle of fan 1
|
||||
//TODO: only allow on platforms like addw2
|
||||
DCR4 = smfi_cmd[SMFI_CMD_DATA + 1];
|
||||
// Set duty cycle of FAN1
|
||||
fan1_pwm_target = smfi_cmd[SMFI_CMD_DATA + 1];
|
||||
return RES_OK;
|
||||
#ifdef FAN2_PWM
|
||||
case 2:
|
||||
// Set duty cycle of FAN2
|
||||
fan2_pwm_target = smfi_cmd[SMFI_CMD_DATA + 1];
|
||||
return RES_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Failed if fan not found
|
||||
|
@@ -69,7 +69,7 @@ static int16_t usbpd_current_limit(void) {
|
||||
}
|
||||
|
||||
static void usbpd_dump(void) {
|
||||
/* Dump all registers for debugging */
|
||||
// Dump all registers for debugging
|
||||
for (uint8_t reg = 0x00; reg < 0x40; reg += 1) {
|
||||
uint8_t value[65] = { 0 };
|
||||
int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, reg, value, sizeof(value));
|
||||
|
@@ -7,7 +7,8 @@ EC = ite
|
||||
CONFIG_EC_ITE_IT5570E = y
|
||||
CONFIG_EC_FLASH_SIZE_256K = y
|
||||
|
||||
# Enable eSPI
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
@@ -41,7 +42,32 @@ CFLAGS += \
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
CFLAGS += -DHAVE_CPU_FAN2=1
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DFAN1_PWM_MIN=27
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(48, 27), \
|
||||
FAN_POINT(52, 27), \
|
||||
FAN_POINT(56, 33), \
|
||||
FAN_POINT(60, 37), \
|
||||
FAN_POINT(75, 53), \
|
||||
FAN_POINT(83, 65), \
|
||||
FAN_POINT(87, 75), \
|
||||
FAN_POINT(89, 77), \
|
||||
"
|
||||
|
||||
CFLAGS += -DFAN2_PWM=DCR3
|
||||
CFLAGS += -DFAN2_PWM_MIN=27
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(48, 27), \
|
||||
FAN_POINT(52, 27), \
|
||||
FAN_POINT(56, 33), \
|
||||
FAN_POINT(60, 37), \
|
||||
FAN_POINT(75, 53), \
|
||||
FAN_POINT(83, 65), \
|
||||
FAN_POINT(87, 75), \
|
||||
FAN_POINT(89, 77), \
|
||||
"
|
||||
|
||||
# Add common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(F, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -31,7 +31,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(E, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,8 @@ EC = ite
|
||||
CONFIG_EC_ITE_IT5570E = y
|
||||
CONFIG_EC_FLASH_SIZE_256K = y
|
||||
|
||||
# Enable eSPI
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
@@ -39,7 +40,32 @@ CFLAGS += \
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
CFLAGS += -DHAVE_CPU_FAN2=1
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DFAN1_PWM_MIN=27
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(48, 27), \
|
||||
FAN_POINT(52, 27), \
|
||||
FAN_POINT(56, 33), \
|
||||
FAN_POINT(60, 37), \
|
||||
FAN_POINT(75, 53), \
|
||||
FAN_POINT(83, 65), \
|
||||
FAN_POINT(87, 75), \
|
||||
FAN_POINT(89, 77), \
|
||||
"
|
||||
|
||||
CFLAGS += -DFAN2_PWM=DCR3
|
||||
CFLAGS += -DFAN2_PWM_MIN=27
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(48, 27), \
|
||||
FAN_POINT(52, 27), \
|
||||
FAN_POINT(56, 33), \
|
||||
FAN_POINT(60, 37), \
|
||||
FAN_POINT(75, 53), \
|
||||
FAN_POINT(83, 65), \
|
||||
FAN_POINT(87, 75), \
|
||||
FAN_POINT(89, 77), \
|
||||
"
|
||||
|
||||
# Add common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(F, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -31,7 +31,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(E, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT8587E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
|
||||
@@ -34,5 +37,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -43,7 +43,7 @@ struct Gpio __code VA_EC_EN = GPIO(E, 3);
|
||||
struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(H, 5);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
@@ -192,8 +192,6 @@ void gpio_init(void) {
|
||||
GPCRH5 = GPIO_OUT;
|
||||
// SUSB#_PCH
|
||||
GPCRH6 = GPIO_IN;
|
||||
// Unknown
|
||||
GPCRH7 = GPIO_IN;
|
||||
// BAT_DET
|
||||
GPCRI0 = GPIO_ALT;
|
||||
// BAT_VOLT
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -48,6 +47,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -10,6 +10,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT8587E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
|
||||
@@ -37,5 +40,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
@@ -36,5 +37,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -40,7 +40,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -50,6 +49,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
@@ -37,5 +38,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(F, 3);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(G, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -46,6 +45,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
CONFIG_SECURITY=y
|
||||
@@ -39,5 +40,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(F, 3);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(G, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -47,6 +46,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT8587E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=14in_86
|
||||
|
||||
@@ -35,5 +38,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=40 \
|
||||
-DPOWER_LIMIT_DC=28
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -42,7 +42,7 @@ struct Gpio __code VA_EC_EN = GPIO(E, 3);
|
||||
struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(H, 5);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
@@ -191,8 +191,6 @@ void gpio_init(void) {
|
||||
GPCRH5 = GPIO_OUT;
|
||||
// SUSB#_PCH
|
||||
GPCRH6 = GPIO_IN;
|
||||
// Unknown
|
||||
GPCRH7 = GPIO_IN;
|
||||
// BAT_DET
|
||||
GPCRI0 = GPIO_ALT;
|
||||
// BAT_VOLT
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -47,6 +46,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -10,6 +10,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT8587E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=14in_86
|
||||
|
||||
@@ -38,5 +41,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=40 \
|
||||
-DPOWER_LIMIT_DC=28
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=14in_83
|
||||
@@ -18,9 +19,6 @@ CONFIG_HAVE_KBLED = y
|
||||
KBLED=white_dac
|
||||
CFLAGS+=-DKBLED_DAC=2
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -42,23 +40,27 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 25), \
|
||||
FAN_POINT(80, 25), \
|
||||
FAN_POINT(80, 40), \
|
||||
FAN_POINT(88, 40), \
|
||||
FAN_POINT(88, 100) \
|
||||
FAN_POINT(88, 100), \
|
||||
"
|
||||
|
||||
# DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(70, 25), \
|
||||
FAN_POINT(75, 40), \
|
||||
FAN_POINT(80, 75), \
|
||||
FAN_POINT(85, 90), \
|
||||
FAN_POINT(90, 100) \
|
||||
FAN_POINT(90, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -41,7 +41,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -50,6 +49,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
CONFIG_SECURITY=y
|
||||
@@ -42,5 +43,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -39,7 +39,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -49,6 +48,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -10,8 +10,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Enable firmware security
|
||||
CONFIG_SECURITY=y
|
||||
@@ -45,5 +46,15 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=65 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(70, 40), \
|
||||
FAN_POINT(75, 50), \
|
||||
FAN_POINT(80, 60), \
|
||||
FAN_POINT(85, 65), \
|
||||
FAN_POINT(90, 65), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
include src/board/system76/common/common.mk
|
||||
|
@@ -7,6 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
|
||||
@@ -14,9 +17,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -36,23 +36,27 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -38,7 +38,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@@ -46,6 +45,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
@@ -17,9 +18,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -41,27 +39,31 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_HEATUP=5
|
||||
CFLAGS+=-DBOARD_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS+=-DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@@ -36,7 +36,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@@ -10,8 +10,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
@@ -20,9 +21,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -44,27 +42,31 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_HEATUP=5
|
||||
CFLAGS+=-DBOARD_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS+=-DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS+=-DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS+=-DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
@@ -7,8 +7,9 @@ EC=ite
|
||||
CONFIG_EC_ITE_IT5570E=y
|
||||
CONFIG_EC_FLASH_SIZE_128K = y
|
||||
|
||||
# Enable eSPI
|
||||
CONFIG_BUS_ESPI=y
|
||||
# Intel-based host
|
||||
CONFIG_PLATFORM_INTEL = y
|
||||
CONFIG_BUS_ESPI = y
|
||||
|
||||
# Include keyboard
|
||||
KEYBOARD=15in_102
|
||||
@@ -17,9 +18,6 @@ KEYBOARD=15in_102
|
||||
CONFIG_HAVE_KBLED = y
|
||||
KBLED=rgb_pwm
|
||||
|
||||
# Set discrete GPU I2C bus
|
||||
CFLAGS+=-DI2C_DGPU=I2C_1
|
||||
|
||||
# Set battery I2C bus
|
||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
|
||||
@@ -41,27 +39,31 @@ CFLAGS+=\
|
||||
-DPOWER_LIMIT_AC=180 \
|
||||
-DPOWER_LIMIT_DC=45
|
||||
|
||||
# Custom fan curve
|
||||
CFLAGS+=-DBOARD_HEATUP=5
|
||||
CFLAGS+=-DBOARD_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_FAN_POINTS="\
|
||||
# Enable dGPU support
|
||||
CONFIG_HAVE_DGPU = y
|
||||
CFLAGS += -DI2C_DGPU=I2C_1
|
||||
|
||||
# Fan configs
|
||||
CFLAGS += -DFAN1_PWM=DCR2
|
||||
CFLAGS += -DBOARD_FAN1_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN1_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Enable DGPU support
|
||||
CFLAGS+=-DHAVE_DGPU=1
|
||||
CFLAGS+=-DBOARD_DGPU_HEATUP=5
|
||||
CFLAGS+=-DBOARD_DGPU_COOLDOWN=20
|
||||
CFLAGS+=-DBOARD_DGPU_FAN_POINTS="\
|
||||
CFLAGS += -DFAN2_PWM=DCR4
|
||||
CFLAGS += -DBOARD_FAN2_HEATUP=5
|
||||
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
|
||||
CFLAGS += -DBOARD_FAN2_POINTS="\
|
||||
FAN_POINT(60, 40), \
|
||||
FAN_POINT(65, 60), \
|
||||
FAN_POINT(70, 75), \
|
||||
FAN_POINT(75, 90), \
|
||||
FAN_POINT(80, 100) \
|
||||
FAN_POINT(80, 100), \
|
||||
"
|
||||
|
||||
# Add system76 common code
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user