Skip to content

Commit 8c0d1a0

Browse files
committed
azalea: workaround fix keyboard can't wakeup s0ix
for AMD design when resume from s0ix, host wouldn't take KBC data, so can't wake by press keyboard, co-work with BIOS use workaround to wake system by scan code. Signed-off-by: LeoCX_Tsai <LeoCX_Tsai@compal.com>
1 parent ba4355a commit 8c0d1a0

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
@@ -1146,7 +1146,9 @@ void simulate_keyboard(uint16_t scancode, int is_pressed)
11461146
* Only send the scan code if main chipset is fully awake and
11471147
* keystrokes are enabled.
11481148
*/
1149-
if (!chipset_in_state(CHIPSET_STATE_ON) || !keystroke_enabled)
1149+
if (chipset_in_state(CHIPSET_STATE_ANY_OFF) ||
1150+
!keystroke_enabled ||
1151+
chipset_in_state(CHIPSET_STATE_SUSPEND))
11501152
return;
11511153

11521154
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)