ec/google/wilco: Suppress UCSI events in S0ix

If a UCSI event comes in when the EC is in S0ix mode then the kernel
driver attempts a transaction but fails and this can leave the system
in an unexpected state where the only wake source is the power button.

This change will not notify the UCSI driver if the EC is in S0ix mode
and instead keep track of the event and send it on resume.

BUG=b:157923800
TEST=tested on drallion system:
1. Put drallion system into suspend
2. Attach power supply
3. Ensure the system can wake with keypress

Signed-off-by: Duncan Laurie <dlaurie@google.com>
Change-Id: I43acb089385d9b41ac955f053e409daad67423f1
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42237
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Duncan Laurie 2020-06-09 15:13:15 -07:00 committed by Duncan Laurie
parent 6f2f236862
commit 3cd3cb6f33
2 changed files with 17 additions and 2 deletions

View File

@ -7,6 +7,8 @@ Device (EC0)
Name (_GPE, EC_SCI_GPI) Name (_GPE, EC_SCI_GPI)
Name (_STA, 0xf) Name (_STA, 0xf)
Name (DBUG, Zero) Name (DBUG, Zero)
Name (ISSX, Zero) /* Is the EC in S0ix mode? */
Name (UCEP, Zero) /* Is there a pending UCSI event? */
Name (_CRS, ResourceTemplate() { Name (_CRS, ResourceTemplate() {
IO (Decode16, IO (Decode16,
@ -140,6 +142,8 @@ Device (EC0)
*/ */
Method (S0IX, 1, Serialized) Method (S0IX, 1, Serialized)
{ {
^ISSX = Arg0 /* Update S0ix state. */
If (Arg0) { If (Arg0) {
Printf ("EC Enter S0ix") Printf ("EC Enter S0ix")
W (CSEX, One) W (CSEX, One)
@ -152,6 +156,11 @@ Device (EC0)
} Else { } Else {
Printf ("EC Exit S0ix") Printf ("EC Exit S0ix")
W (CSEX, Zero) W (CSEX, Zero)
/* If UCSI event happened during S0ix send it now. */
If (^UCEP == One) {
^_Q79 ()
}
} }
} }

View File

@ -139,6 +139,12 @@ Method (_Q66, 0, Serialized)
/* UCSI SCI uses a unique event code */ /* UCSI SCI uses a unique event code */
Method (_Q79, 0, Serialized) Method (_Q79, 0, Serialized)
{ {
Printf ("EC _Q79 UCSI Event") If (ISSX == Zero) {
Notify (^UCSI, 0x80) Printf ("EC _Q79 UCSI Event")
Notify (^UCSI, 0x80)
^UCEP = Zero
} Else {
Printf ("EC _Q79 UCSI Event Masked in S0ix")
^UCEP = One
}
} }