Skip to content

Commit da516ff

Browse files
committed
Implement Panther Lake power sequence
1 parent 17e9cba commit da516ff

5 files changed

Lines changed: 57 additions & 6 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/board/system76/lemp14/gpio.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ struct Gpio __code LID_SW_N = GPIO(B, 1);
2020
struct Gpio __code ME_WE = GPIO(D, 7);
2121
struct Gpio __code PCH_PWROK_EC = GPIO(F, 3);
2222
struct Gpio __code PD_EN = GPIO(D, 0); // renamed to PD_POWER_EN
23+
struct Gpio __code PM_PWROK = GPIO(H, 7); // renamed to EC_PWROK
2324
struct Gpio __code PWR_BTN_N = GPIO(D, 5);
2425
struct Gpio __code PWR_SW_N = GPIO(B, 3);
2526
struct Gpio __code SLP_S0_N = GPIO(B, 5);
2627
struct Gpio __code SUSB_N_PCH = GPIO(H, 0);
2728
struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
2829
struct Gpio __code VA_EC_EN = GPIO(J, 4);
30+
struct Gpio __code VCCST_EN = GPIO(D, 3);
31+
struct Gpio __code VCCST_EN_PG = GPIO(H, 6);
2932
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
3033
struct Gpio __code XLP_OUT = GPIO(B, 4);
3134
// uncrustify:on
@@ -90,7 +93,7 @@ static const struct GpioInit __code gpio_cfg_init[] = {
9093
{ &GPCRD0, GPIO_OUT }, // PD_POWER_EN
9194
{ &GPCRD1, GPIO_OUT }, // CCD_EN
9295
{ &GPCRD2, GPIO_ALT }, // ESPI_RESET#
93-
{ &GPCRD3, GPIO_IN }, // SLP_A#
96+
{ &GPCRD3, GPIO_IN }, // VCCST_EN
9497
{ &GPCRD4, GPIO_OUT }, // LED_PWR
9598
{ &GPCRD5, GPIO_OUT }, // EC_PWR_BTN#
9699
{ &GPCRD6, GPIO_ALT | GPIO_DOWN }, // CPU_FANSEN
@@ -129,8 +132,8 @@ static const struct GpioInit __code gpio_cfg_init[] = {
129132
{ &GPCRH3, GPIO_OUT }, // 3G_EN
130133
{ &GPCRH4, GPIO_OUT }, // 3G_PWR_EN
131134
{ &GPCRH5, GPIO_IN }, // TBTA_VBUS_1_EN#
132-
{ &GPCRH6, GPIO_IN }, // Not connected
133-
{ &GPCRH7, GPIO_IN }, // Not connected
135+
{ &GPCRH6, GPIO_OUT }, // VCCST_EN_PG
136+
{ &GPCRH7, GPIO_OUT }, // EC_PWROK
134137

135138
{ &GPCRI0, GPIO_ALT }, // BAT_DET
136139
{ &GPCRI1, GPIO_ALT }, // BAT_VOLT

src/board/system76/lemp14/include/board/gpio.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern struct Gpio __code ME_WE;
3030
extern struct Gpio __code PCH_PWROK_EC;
3131
#define HAVE_PD_EN 1
3232
extern struct Gpio __code PD_EN;
33-
#define HAVE_PM_PWROK 0
33+
extern struct Gpio __code PM_PWROK;
3434
extern struct Gpio __code PWR_BTN_N;
3535
extern struct Gpio __code PWR_SW_N;
3636
extern struct Gpio __code SLP_S0_N;
@@ -40,6 +40,9 @@ extern struct Gpio __code SUSC_N_PCH;
4040
#define HAVE_SUSWARN_N 0
4141
#define HAVE_SUS_PWR_ACK 0
4242
extern struct Gpio __code VA_EC_EN;
43+
#define HAVE_VCCST_EN 1
44+
extern struct Gpio __code VCCST_EN;
45+
extern struct Gpio __code VCCST_EN_PG;
4346
#define HAVE_WLAN_EN 0
4447
extern struct Gpio __code WLAN_PWR_EN;
4548
extern struct Gpio __code XLP_OUT;

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)