Skip to content

Commit 6eca817

Browse files
jackpot51crawfxrd
authored andcommitted
Implement Panther Lake power sequence
1 parent 57c7276 commit 6eca817

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

src/app/main/power/intel.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
#define HAVE_PD_EN 0
8585
#endif
8686

87+
// Introduced with Panther Lake, disabled by default
88+
#ifndef HAVE_VCCST_EN
89+
#define HAVE_VCCST_EN 0
90+
#endif
91+
8792
#ifndef HAVE_XLP_OUT
8893
#define HAVE_XLP_OUT 1
8994
#endif
@@ -138,12 +143,12 @@ enum PowerState calculate_power_state(void) {
138143
#if CONFIG_BUS_ESPI
139144
// Use eSPI virtual wires if available
140145

141-
if (vw_get(&VW_SLP_S4_N) != VWS_HIGH) {
146+
if (vw_get_ignore_invalid(&VW_SLP_S4_N) != VWS_HIGH) {
142147
// S4 plane not powered
143148
return POWER_STATE_S5;
144149
}
145150

146-
if (vw_get(&VW_SLP_S3_N) != VWS_HIGH) {
151+
if (vw_get_ignore_invalid(&VW_SLP_S3_N) != VWS_HIGH) {
147152
// S3 plane not powered
148153
return POWER_STATE_S3;
149154
}
@@ -201,6 +206,27 @@ void power_init(void) {
201206
update_power_state();
202207
}
203208

209+
#if HAVE_VCCST_EN
210+
static void power_vccst_update(void) {
211+
//TODO: verify against panther lake design guide
212+
static bool last_vccst_en = false;
213+
bool vccst_en = gpio_get(&VCCST_EN);
214+
if (vccst_en != last_vccst_en) {
215+
if (vccst_en) {
216+
DEBUG("%02X: VCCST_EN asserted\n", main_cycle);
217+
218+
// Delay for power good
219+
//TODO: determine ideal delay
220+
delay_ms(200);
221+
} else {
222+
DEBUG("%02X: VCCST_EN de-asserted\n", main_cycle);
223+
}
224+
GPIO_SET_DEBUG(VCCST_EN_PG, vccst_en);
225+
last_vccst_en = vccst_en;
226+
}
227+
}
228+
#endif
229+
204230
void power_on(void) {
205231
// Configure WLAN GPIOs before powering on
206232
wireless_power(true);
@@ -266,6 +292,10 @@ void power_on(void) {
266292
break;
267293
}
268294

295+
#if HAVE_VCCST_EN
296+
power_vccst_update();
297+
#endif
298+
269299
#if CONFIG_BUS_ESPI
270300
// Check for VW changes
271301
espi_event();
@@ -524,6 +554,10 @@ void power_event(void) {
524554
#endif
525555
#endif // HAVE_SLP_SUS_N
526556

557+
#if HAVE_VCCST_EN
558+
power_vccst_update();
559+
#endif
560+
527561
#if CONFIG_BUS_ESPI
528562
// ESPI systems must keep S5 planes powered unless VW_SUS_PWRDN_ACK is high
529563
if (vw_get(&VW_SUS_PWRDN_ACK) == VWS_HIGH)

src/ec/ite/espi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ enum VirtualWireState vw_get(struct VirtualWire *const vw) __critical {
5050
}
5151
}
5252

53+
// Panther Lake sets validity only when signals change
54+
enum VirtualWireState vw_get_ignore_invalid(struct VirtualWire *const vw) __critical {
55+
uint8_t index = *vw->index;
56+
if (index & vw->data_mask) {
57+
return VWS_HIGH;
58+
} else {
59+
return VWS_LOW;
60+
}
61+
}
62+
5363
void vw_set(struct VirtualWire *const vw, enum VirtualWireState state) __critical {
5464
uint8_t index = *vw->index;
5565
switch (state) {

src/ec/ite/include/ec/espi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum VirtualWireState {
2626
};
2727

2828
enum VirtualWireState vw_get(struct VirtualWire *const vw) __critical;
29+
enum VirtualWireState vw_get_ignore_invalid(struct VirtualWire *const vw) __critical;
2930

3031
void vw_set(struct VirtualWire *const vw, enum VirtualWireState state) __critical;
3132

0 commit comments

Comments
 (0)