Files
system76-embedded-controller/src/board/system76/gaze15/board.c
Tim Crawford a8229d9e62 Move power limit functions to common board code
Logic for changing power limit is the same for all boards with GPUs. It
is still called from board_event() instead of in power_event() to
maintain the current behavior of checking every main cycle.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-07-09 07:35:52 -06:00

45 lines
956 B
C

// SPDX-License-Identifier: GPL-3.0-only
#include <arch/time.h>
#include <board/battery.h>
#include <board/board.h>
#include <board/dgpu.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <board/kbc.h>
#include <board/power.h>
#include <common/debug.h>
extern uint8_t main_cycle;
void board_init(void) {
// 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);
// Assert SMI#, SCI#, and SWI#
gpio_set(&SCI_N, true);
gpio_set(&SMI_N, true);
gpio_set(&SWI_N, true);
// Enable POST codes
SPCTRL1 |= 0xC8;
}
void board_event(void) {
power_set_limit();
// Read POST codes
while (P80H81HS & 1) {
uint8_t p80h = P80HD;
uint8_t p81h = P81HD;
P80H81HS |= 1;
DEBUG("POST %02X%02X\n", p81h, p80h);
}
}