Skip to content

Commit b0a351c

Browse files
authored
Merge pull request #715 from FrameworkComputer/azalea.keyboard_wa
azalea: workaround fix keyboard can't wakeup s0ix
2 parents 9278663 + 8c0d1a0 commit b0a351c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

common/keyboard_8042.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,9 @@ void simulate_keyboard(uint16_t scancode, int is_pressed)
11391139
* Only send the scan code if main chipset is fully awake and
11401140
* keystrokes are enabled.
11411141
*/
1142-
if (!chipset_in_state(CHIPSET_STATE_ON) || !keystroke_enabled)
1142+
if (chipset_in_state(CHIPSET_STATE_ANY_OFF) ||
1143+
!keystroke_enabled ||
1144+
chipset_in_state(CHIPSET_STATE_SUSPEND))
11431145
return;
11441146

11451147
code_set = acting_code_set(scancode_set);

zephyr/program/lotus/azalea/src/power_sequence.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ static void key_stuck_wa(void)
272272
int wa_bit = *host_get_memmap(EC_CUSTOMIZED_MEMMAP_DISPLAY_ON);
273273

274274
if (wa_bit) {
275-
simulate_keyboard(SCANCODE_UNASSIGNED, 1);
276-
simulate_keyboard(SCANCODE_UNASSIGNED, 0);
277-
keyboard_clear_buffer();
278275
*host_get_memmap(EC_CUSTOMIZED_MEMMAP_DISPLAY_ON) = 0;
279276
hook_call_deferred(&key_stuck_wa_data, -1);
277+
simulate_keyboard(SCANCODE_UNASSIGNED, 1);
278+
simulate_keyboard(SCANCODE_UNASSIGNED, 0);
280279
} else
281-
hook_call_deferred(&key_stuck_wa_data, 250 * MSEC);
280+
hook_call_deferred(&key_stuck_wa_data, 10 * MSEC);
281+
282282
}
283283

284284
enum power_state power_handle_state(enum power_state state)
@@ -460,13 +460,15 @@ enum power_state power_handle_state(enum power_state state)
460460

461461
case POWER_S0ixS3:
462462
CPRINTS("PH S0ixS3");
463+
hook_call_deferred(&key_stuck_wa_data, -1);
463464
/* follow power sequence Disable S3 power */
464465
chipset_prepare_S3(0);
465466
CPRINTS("PH S0ixS0->S3");
466467
return POWER_S3;
467468

468469
case POWER_S3S0ix:
469470
CPRINTS("PH S3->S0ix");
471+
hook_call_deferred(&key_stuck_wa_data, 1);
470472
/* Enable power for CPU check system */
471473
chipset_prepare_S3(1);
472474
CPRINTS("PH S3S0ix->S0ix");
@@ -476,8 +478,8 @@ enum power_state power_handle_state(enum power_state state)
476478
CPRINTS("PH S0ixS0");
477479
resume_ms_flag = 0;
478480
enter_ms_flag = 0;
479-
hook_call_deferred(&key_stuck_wa_data, 10 * MSEC);
480481
lpc_s0ix_resume_restore_masks();
482+
hook_call_deferred(&key_stuck_wa_data, 50 * MSEC);
481483
/* Call hooks now that rails are up */
482484
hook_notify(HOOK_CHIPSET_RESUME);
483485
CPRINTS("PH S0ixS0->S0");

0 commit comments

Comments
 (0)