Skip to content

Commit d455346

Browse files
committed
Record 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 <[email protected]>
1 parent 0d83819 commit d455346

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
@@ -13,6 +13,21 @@ enum PowerState {
1313
extern enum PowerState power_state;
1414
void update_power_state(void);
1515

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

src/board/system76/common/power.c

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

124124
enum PowerState power_state = POWER_STATE_OFF;
125125

126+
// Event that caused the system to power on.
127+
// Note: Must not be Reserved (0x00) or Unknown (0x02) when reported.
128+
enum PowerWakeupType power_wakeup_type = POWER_WAKEUP_TYPE_UNKNOWN;
129+
126130
enum PowerState calculate_power_state(void) {
127131
if (!gpio_get(&EC_RSMRST_N)) {
128132
// S5 plane not powered
@@ -435,6 +439,7 @@ void power_event(void) {
435439
if (config_should_reset())
436440
config_reset();
437441
power_on();
442+
power_wakeup_type = POWER_WAKEUP_TYPE_POWER_SWITCH;
438443

439444
// After power on ensure there is no secondary press sent to PCH
440445
ps_new = ps_last;
@@ -562,6 +567,7 @@ void power_event(void) {
562567
DEBUG("%02X: LAN_WAKEUP# asserted\n", main_cycle);
563568
if (power_state == POWER_STATE_OFF) {
564569
power_on();
570+
power_wakeup_type = POWER_WAKEUP_TYPE_LAN_REMOTE;
565571
}
566572
}
567573
#if LEVEL >= LEVEL_DEBUG

0 commit comments

Comments
 (0)