Skip to content

Commit fd9f2fc

Browse files
committed
Report SMBIOS Wake-up Type
Wake-up Type identifies the event that caused the system to power on. 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 <tcrawford@system76.com>
1 parent e032c5f commit fd9f2fc

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/board/system76/common/include/board/power.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ enum PowerState {
1212

1313
extern enum PowerState power_state;
1414

15+
// SMBIOS Wake-up Type
16+
enum PowerWakeupType {
17+
POWER_WAKEUP_TYPE_RESERVED = 0,
18+
POWER_WAKEUP_TYPE_OTHER = 1,
19+
POWER_WAKEUP_TYPE_UNKNOWN = 2,
20+
POWER_WAKEUP_TYPE_APM_TIMER = 3,
21+
POWER_WAKEUP_TYPE_MODEM_RING = 4,
22+
POWER_WAKEUP_TYPE_LAN_REMOTE = 5,
23+
POWER_WAKEUP_TYPE_POWER_SWITCH = 6,
24+
POWER_WAKEUP_TYPE_PCI_PME = 7,
25+
POWER_WAKEUP_TYPE_AC_POWER_RESTORED = 8,
26+
};
27+
28+
extern enum PowerWakeupType power_wakeup_type;
29+
1530
void power_init(void);
1631
void power_on(void);
1732
void power_off(void);

src/board/system76/common/power.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ extern uint8_t main_cycle;
125125

126126
enum PowerState power_state = POWER_STATE_OFF;
127127

128+
// Event that caused the system to power on.
129+
// Note: Must not be Reserved (0x00) or Unknown (0x02) when reported.
130+
enum PowerWakeupType power_wakeup_type = POWER_WAKEUP_TYPE_UNKNOWN;
131+
128132
enum PowerState calculate_power_state(void) {
129133
//TODO: Deep Sx states using SLP_SUS#
130134

@@ -429,6 +433,7 @@ void power_event(void) {
429433
if (config_should_reset())
430434
config_reset();
431435
power_on();
436+
power_wakeup_type = POWER_WAKEUP_TYPE_POWER_SWITCH;
432437

433438
// After power on ensure there is no secondary press sent to PCH
434439
ps_new = ps_last;
@@ -548,6 +553,7 @@ void power_event(void) {
548553
DEBUG("%02X: LAN_WAKEUP# asserted\n", main_cycle);
549554
if (power_state == POWER_STATE_OFF) {
550555
power_on();
556+
power_wakeup_type = POWER_WAKEUP_TYPE_LAN_REMOTE;
551557
}
552558
}
553559
#if LEVEL >= LEVEL_DEBUG

0 commit comments

Comments
 (0)