Logic for changing power limit is the same for all boards with GPUs. It is still called from board_event() instead of in power_event() to maintain the current behavior of checking every main cycle. Signed-off-by: Tim Crawford <tcrawford@system76.com>
56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <board/battery.h>
|
|
#include <board/board.h>
|
|
#include <board/dgpu.h>
|
|
#include <board/espi.h>
|
|
#include <board/gctrl.h>
|
|
#include <board/gpio.h>
|
|
#include <board/power.h>
|
|
#include <common/debug.h>
|
|
|
|
extern uint8_t main_cycle;
|
|
|
|
void board_init(void) {
|
|
espi_init();
|
|
|
|
// Make sure charger is in off state, also enables PSYS
|
|
battery_charger_disable();
|
|
|
|
// Allow CPU to boot
|
|
gpio_set(&SB_KBCRST_N, true);
|
|
// Allow backlight to be turned on
|
|
gpio_set(&BKL_EN, true);
|
|
// Enable camera
|
|
gpio_set(&CCD_EN, true);
|
|
// Enable wireless
|
|
gpio_set(&BT_EN, true);
|
|
gpio_set(&WLAN_EN, true);
|
|
gpio_set(&WLAN_PWR_EN, true);
|
|
// Enable right USB port
|
|
gpio_set(&USB_PWR_EN_N, false);
|
|
// Assert SMI# and SWI#
|
|
gpio_set(&SMI_N, true);
|
|
gpio_set(&SWI_N, true);
|
|
|
|
// Enable POST codes
|
|
SPCTRL1 |= 0xC8;
|
|
}
|
|
|
|
void board_event(void) {
|
|
#if HAVE_DGPU
|
|
power_set_limit();
|
|
#endif // HAVE_DGPU
|
|
|
|
espi_event();
|
|
|
|
// Read POST codes
|
|
while (P80H81HS & 1) {
|
|
uint8_t p80h = P80HD;
|
|
uint8_t p81h = P81HD;
|
|
P80H81HS |= 1;
|
|
|
|
DEBUG("POST %02X%02X\n", p81h, p80h);
|
|
}
|
|
}
|