Skip to content

Commit

Permalink
Report SMBIOS Wake-up Type
Browse files Browse the repository at this point in the history
Wake-up type identifies the event that caused the system to power up.
Only power switch and Wake-on-LAN are currently implemented.

The list of values is defined in section 7.2.2 System - Wake-up Type.

Ref: SMBIOS Reference Specification 3.6.0

Signed-off-by: Tim Crawford <[email protected]>
  • Loading branch information
crawfxrd committed Jan 10, 2023
1 parent e032c5f commit 093c5d4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/board/system76/common/include/board/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ enum PowerState {

extern enum PowerState power_state;

// Ref: SMBIOS 3.6.0, 7.2.2 System - Wake-up Type
enum WakeType {
WAKE_RESERVED,
WAKE_OTHER,
WAKE_UNKNOWN,
WAKE_APM_TIMER,
WAKE_MODEM_RING,
WAKE_LAN_REMOTE,
WAKE_POWER_SWITCH,
WAKE_PCI_PME,
WAKE_AC_POWER_RESTORED,
};

extern enum WakeType power_wake_type;

void power_init(void);
void power_on(void);
void power_off(void);
Expand Down
5 changes: 5 additions & 0 deletions src/board/system76/common/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ extern uint8_t main_cycle;

enum PowerState power_state = POWER_STATE_OFF;

// Note: Must not be Reserved (0x00) or Unknown (0x02) when reported.
enum WakeType power_wake_type = WAKE_UNKNOWN;

enum PowerState calculate_power_state(void) {
//TODO: Deep Sx states using SLP_SUS#

Expand Down Expand Up @@ -429,6 +432,7 @@ void power_event(void) {
if (config_should_reset())
config_reset();
power_on();
power_wake_type = WAKE_POWER_SWITCH;

// After power on ensure there is no secondary press sent to PCH
ps_new = ps_last;
Expand Down Expand Up @@ -548,6 +552,7 @@ void power_event(void) {
DEBUG("%02X: LAN_WAKEUP# asserted\n", main_cycle);
if (power_state == POWER_STATE_OFF) {
power_on();
power_wake_type = WAKE_LAN_REMOTE;
}
}
#if LEVEL >= LEVEL_DEBUG
Expand Down

0 comments on commit 093c5d4

Please sign in to comment.