Add gaze15 and oryp6
This commit is contained in:
committed by
Jeremy Soller
parent
ffde1ca9ef
commit
9ec6122153
66
src/board/system76/gaze15/board.c
Normal file
66
src/board/system76/gaze15/board.c
Normal file
@@ -0,0 +1,66 @@
|
||||
#include <arch/time.h>
|
||||
#include <board/battery.h>
|
||||
#include <board/board.h>
|
||||
#include <board/dgpu.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);
|
||||
|
||||
dgpu_init();
|
||||
}
|
||||
|
||||
void board_event(void) {
|
||||
if (main_cycle == 0) {
|
||||
bool acin = !gpio_get(&ACIN_N);
|
||||
gpio_set(&AC_PRESENT, acin);
|
||||
if (acin) {
|
||||
// Discharging (no AC adapter)
|
||||
gpio_set(&LED_BAT_CHG, false);
|
||||
gpio_set(&LED_BAT_FULL, false);
|
||||
} else if (battery_status & 0x0020) {
|
||||
// Fully charged
|
||||
// TODO: turn off charger
|
||||
gpio_set(&LED_BAT_CHG, false);
|
||||
gpio_set(&LED_BAT_FULL, true);
|
||||
} else {
|
||||
// Charging
|
||||
// TODO: detect no battery connected
|
||||
gpio_set(&LED_BAT_CHG, true);
|
||||
gpio_set(&LED_BAT_FULL, false);
|
||||
}
|
||||
|
||||
if (power_state == POWER_STATE_S0 || power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3) {
|
||||
// System is on
|
||||
} else if (!acin) {
|
||||
// Power off VDD3 if system should be off
|
||||
gpio_set(&XLP_OUT, 0);
|
||||
}
|
||||
|
||||
static uint32_t last_time = 0;
|
||||
uint32_t time = time_get();
|
||||
// Only run the following once a second
|
||||
if (last_time > time || (time - last_time) >= 1000) {
|
||||
last_time = time;
|
||||
|
||||
// Updates discrete GPU fan status and temps
|
||||
dgpu_event();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user