|
58 | 58 | */
|
59 | 59 | #define PWRBTN_DELAY_T0 (32 * MSEC) /* 32ms (PCH requires >16ms) */
|
60 | 60 | #define PWRBTN_DELAY_T1 (4 * SECOND - PWRBTN_DELAY_T0) /* 4 secs - t0 */
|
61 |
| -#define PWRBTN_DELAY_T2 (1 * SECOND) /* 20s - (T1 + 16s hold) */ |
62 |
| -#define PWRBTN_DELAY_T3 (1 * SECOND) /* 11s - (T1 + 6s hold) */ |
| 61 | +#define PWRBTN_DELAY_T2 (1 * MSEC) /* (T1 + 16s hold) */ |
| 62 | +#define PWRBTN_DELAY_T3 (1 * SECOND) /* 1s + (T1 + 6s hold) */ |
63 | 63 | /*
|
64 | 64 | * Length of time to stretch initial power button press to give chipset a
|
65 | 65 | * chance to wake up (~100ms) and react to the press (~16ms). Also used as
|
@@ -446,10 +446,12 @@ static void state_machine(uint64_t tnow)
|
446 | 446 | if (power_button_is_pressed()) {
|
447 | 447 | tnext_state = tnow + PWRBTN_WAIT_HOLD;
|
448 | 448 | if (!gpio_get_level(GPIO_ON_OFF_FP_L)) {
|
449 |
| - if (++hold_check < PWRBTN_FP_HOLD_COUNT) |
450 |
| - break; |
451 | 449 |
|
452 |
| - hold_check = 0; |
| 450 | + if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) { |
| 451 | + CPRINTS("PB held press 4s execute force shutdown"); |
| 452 | + chipset_force_shutdown(CHIPSET_SHUTDOWN_G3); |
| 453 | + } |
| 454 | + |
453 | 455 | tnext_state = tnow + PWRBTN_STATE_DELAY;
|
454 | 456 | pwrbtn_state = PWRBTN_STATE_NEED_SHUTDOWN;
|
455 | 457 | } else if (!gpio_get_level(GPIO_ON_OFF_BTN_L)) {
|
@@ -499,13 +501,19 @@ static void state_machine(uint64_t tnow)
|
499 | 501 |
|
500 | 502 | if (power_button_is_pressed()) {
|
501 | 503 | if (!gpio_get_level(GPIO_ON_OFF_FP_L)) {
|
| 504 | + tnext_state = tnow + PWRBTN_WAIT_HOLD; |
| 505 | + if (++hold_check < PWRBTN_FP_HOLD_COUNT) |
| 506 | + break; |
| 507 | + |
| 508 | + hold_check = 0; |
502 | 509 | tnext_state = tnow + PWRBTN_DELAY_T2;
|
503 | 510 | pwrbtn_state = PWRBTN_STATE_NEED_RESET;
|
504 | 511 | } else if (!gpio_get_level(GPIO_ON_OFF_BTN_L)) {
|
505 | 512 | tnext_state = tnow + PWRBTN_DELAY_T3;
|
506 | 513 | pwrbtn_state = PWRBTN_STATE_NEED_BATT_CUTOFF;
|
507 | 514 | }
|
508 | 515 | } else {
|
| 516 | + hold_check = 0; |
509 | 517 | power_button_released(tnow);
|
510 | 518 | }
|
511 | 519 |
|
|
0 commit comments