Add ACPI thermal interface

This commit is contained in:
Jeremy Soller 2020-09-02 09:51:46 -06:00 committed by Jeremy Soller
parent ee404071fb
commit db6e85eb56
7 changed files with 26 additions and 6 deletions

View File

@ -118,9 +118,9 @@ void gpio_init() {
// PWR_BTN# // PWR_BTN#
GPCRD5 = GPIO_OUT | GPIO_UP; GPCRD5 = GPIO_OUT | GPIO_UP;
// CPU_FANSEN // CPU_FANSEN
GPCRD6 = GPIO_IN; GPCRD6 = GPIO_ALT;
// VGA_FANSEN // VGA_FANSEN
GPCRD7 = GPIO_IN; GPCRD7 = GPIO_ALT;
// SMC_BAT_EC // SMC_BAT_EC
GPCRE0 = GPIO_ALT; GPCRE0 = GPIO_ALT;
// AC_PRESENT // AC_PRESENT

View File

@ -1,10 +1,12 @@
#include <board/acpi.h> #include <board/acpi.h>
#include <board/battery.h> #include <board/battery.h>
#include <board/dgpu.h>
#include <board/gpio.h> #include <board/gpio.h>
#include <board/kbled.h> #include <board/kbled.h>
#include <board/lid.h> #include <board/lid.h>
#include <board/peci.h> #include <board/peci.h>
#include <common/debug.h> #include <common/debug.h>
#include <ec/pwm.h>
#ifndef HAVE_LED_AIRPLANE_N #ifndef HAVE_LED_AIRPLANE_N
#define HAVE_LED_AIRPLANE_N 1 #define HAVE_LED_AIRPLANE_N 1
@ -89,6 +91,8 @@ uint8_t acpi_read(uint8_t addr) {
} }
break; break;
ACPI_8(0x07, peci_temp >> 6);
// Handle AC adapter and battery present // Handle AC adapter and battery present
case 0x10: case 0x10:
if (!gpio_get(&ACIN_N)) { if (!gpio_get(&ACIN_N)) {
@ -122,6 +126,16 @@ uint8_t acpi_read(uint8_t addr) {
ACPI_8(0xCC, sci_extra); ACPI_8(0xCC, sci_extra);
ACPI_8(0xCE, DCR2);
ACPI_8(0xD0, F1TMRR);
ACPI_8(0xD1, F1TLRR);
#if HAVE_DGPU
ACPI_8(0xCD, dgpu_temp);
ACPI_8(0xCF, DCR4);
ACPI_8(0xD2, F2TMRR);
ACPI_8(0xD3, F2TLRR);
#endif // HAVE_DGPU
#if HAVE_LED_AIRPLANE_N #if HAVE_LED_AIRPLANE_N
// Airplane mode LED // Airplane mode LED
case 0xD9: case 0xD9:

View File

@ -3,7 +3,6 @@
#if HAVE_DGPU #if HAVE_DGPU
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <board/gpio.h> #include <board/gpio.h>
#include <board/power.h> #include <board/power.h>

View File

@ -1,10 +1,17 @@
#ifndef _BOARD_DGPU_H #ifndef _BOARD_DGPU_H
#define _BOARD_DGPU_H #define _BOARD_DGPU_H
#include <stdint.h>
#ifndef HAVE_DGPU #ifndef HAVE_DGPU
#define HAVE_DGPU 0 #define HAVE_DGPU 0
#endif #endif
#if HAVE_DGPU
extern int16_t dgpu_temp;
extern uint8_t dgpu_duty;
#endif // HAVE_DGPU
void dgpu_init(void); void dgpu_init(void);
void dgpu_event(void); void dgpu_event(void);

View File

@ -121,7 +121,7 @@ void gpio_init() {
// PWR_BTN# // PWR_BTN#
GPCRD5 = GPIO_OUT; GPCRD5 = GPIO_OUT;
// CPU_FANSEN // CPU_FANSEN
GPCRD6 = GPIO_IN; GPCRD6 = GPIO_ALT;
// SUSWARN# // SUSWARN#
GPCRD7 = GPIO_IN; GPCRD7 = GPIO_IN;
// SWI# // SWI#

View File

@ -121,7 +121,7 @@ void gpio_init() {
// PWR_BTN# // PWR_BTN#
GPCRD5 = GPIO_OUT; GPCRD5 = GPIO_OUT;
// CPU_FANSEN // CPU_FANSEN
GPCRD6 = GPIO_IN; GPCRD6 = GPIO_ALT;
// SUSWARN# // SUSWARN#
GPCRD7 = GPIO_IN; GPCRD7 = GPIO_IN;
// SWI# // SWI#

View File

@ -119,7 +119,7 @@ void gpio_init() {
// PWR_BTN# // PWR_BTN#
GPCRD5 = GPIO_OUT; GPCRD5 = GPIO_OUT;
// CPU_FANSEN // CPU_FANSEN
GPCRD6 = GPIO_IN; GPCRD6 = GPIO_ALT;
// SUSWARN# // SUSWARN#
GPCRD7 = GPIO_IN; GPCRD7 = GPIO_IN;
// SMC_BAT // SMC_BAT