Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add platform config for selecting AMD/Intel host #499

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/board/system76/addw1/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/addw2/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/board/system76/addw3/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/board/system76/addw4/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/bonw14/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/board/system76/bonw15-b/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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
Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/bonw15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/board/system76/common/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#include <board/gpio.h>
#include <board/kbled.h>
#include <board/lid.h>
#include <board/peci.h>
#include <board/pwm.h>
#include <common/debug.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
#endif // HAVE_LED_AIRPLANE_N
Expand Down Expand Up @@ -113,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:
Expand Down
13 changes: 11 additions & 2 deletions src/board/system76/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/board/system76/common/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

#include <board/fan.h>
#include <board/dgpu.h>
#include <board/peci.h>
#include <board/power.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/pwm.h>

#if CONFIG_PLATFORM_INTEL
#include <board/peci.h>
#endif

bool fan_max = false;

uint8_t fan1_pwm_actual = 0;
Expand Down Expand Up @@ -195,11 +198,16 @@ static uint16_t fan_get_tach1_rpm(void) {
}

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.
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/common/include/board/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion src/board/system76/common/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down Expand Up @@ -73,7 +76,9 @@ void init(void) {
kbscan_init();
}
keymap_init();
#if CONFIG_PLATFORM_INTEL
peci_init();
#endif
pmc_init();
pwm_init();
smbus_init();
Expand Down Expand Up @@ -140,7 +145,9 @@ void main(void) {
if ((time - last_time_250ms) >= INTERVAL_250MS) {
last_time_250ms = time;

#if CONFIG_PLATFORM_INTEL
peci_read_temp();
#endif
dgpu_read_temp();
}

Expand Down
12 changes: 12 additions & 0 deletions src/board/system76/common/power/amd.c
Original file line number Diff line number Diff line change
@@ -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) {}
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/board/system76/darp10-b/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/board/system76/darp10/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/darp5/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/darp6/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/darp7/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/darp8/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/darp9/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/galp3-c/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/galp4/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/galp5/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/galp6/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/galp7/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/board/system76/gaze15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/board/system76/gaze16-3050/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading