ec/google/wilco: Fix ACPI power status events

This change fixes the power status events for AC and battery
events from the EC.  The register that was being used is not
returning the expected information.

BUG=b:125472740
TEST=enable ACPI debug in the kernel and verify that AC and
battery insert/remove are detected properly.

Change-Id: I15f71fcf0ca6aa9438e951865787c9fc273792d8
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/31560
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Duncan Laurie
2019-02-21 17:38:03 -08:00
committed by Patrick Georgi
parent 47b9e457fa
commit a213ed659a
3 changed files with 7 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ Device (EC0)
EREG = Arg1 EREG = Arg1
/* Store initial value for power status */ /* Store initial value for power status */
ECPR = R (APWR) ECPR = R (PWSR)
/* Indicate to EC that OS is ready for queries */ /* Indicate to EC that OS is ready for queries */
W (ERDY, Arg1) W (ERDY, Arg1)

View File

@@ -53,6 +53,7 @@ Name (P5U1, Package () { 0x04, 0x01, RD }) /* PmSt5_BAT1_UPDATE */
Name (P6ST, Package () { 0x05, 0xff, RD }) /* PmSt6 */ Name (P6ST, Package () { 0x05, 0xff, RD }) /* PmSt6 */
Name (P6AC, Package () { 0x05, 0x08, RD }) /* PmSt6_AC_UPDATE */ Name (P6AC, Package () { 0x05, 0x08, RD }) /* PmSt6_AC_UPDATE */
Name (PWSR, Package () { 0x06, 0xff, RD }) /* POWER_SOURCE */
Name (ACEX, Package () { 0x06, 0x01, RD }) /* AC Present */ Name (ACEX, Package () { 0x06, 0x01, RD }) /* AC Present */
Name (BTEX, Package () { 0x06, 0x02, RD }) /* Battery Present */ Name (BTEX, Package () { 0x06, 0x02, RD }) /* Battery Present */
Name (BTSC, Package () { 0x06, 0x04, RD }) /* Battery Status Changed */ Name (BTSC, Package () { 0x06, 0x04, RD }) /* Battery Status Changed */
@@ -122,11 +123,6 @@ Name (OERL, Package () { 0x3a, 0x02, RD }) /* Event: Rotation Lock */
Name (BCCY, Package () { 0x3e, 0xffff, RD }) /* BCACHE: Cycle Count */ Name (BCCY, Package () { 0x3e, 0xffff, RD }) /* BCACHE: Cycle Count */
Name (APWR, Package () { 0x47, 0xff, RD }) /* POWER: Full Status */
Name (APAC, Package () { 0x47, 0x01, RD }) /* POWER: AC */
Name (APB1, Package () { 0x47, 0x02, RD }) /* POWER: Main Battery */
Name (APC1, Package () { 0x47, 0x04, RD }) /* POWER: Main Batt Status */
/* /*
* EC RAM WRITE * EC RAM WRITE
*/ */

View File

@@ -19,17 +19,17 @@ Name (ECPR, 0)
Method (ECQP, 0, Serialized) Method (ECQP, 0, Serialized)
{ {
Local0 = R (APWR) Local0 = R (PWSR)
Local1 = Local0 ^ ECPR Local1 = Local0 ^ ECPR
ECPR = Local0 ECPR = Local0
If (EBIT (APAC, Local1)) { If (EBIT (ACEX, Local1)) {
Printf ("AC Power Status Changed") Printf ("AC Power Status Changed")
Notify (AC, 0x80) Notify (AC, 0x80)
} }
If (EBIT (APB1, Local1)) { If (EBIT (BTEX, Local1)) {
If (EBIT (APB1, Local0)) { If (EBIT (BTEX, Local0)) {
Printf ("BAT0 Inserted") Printf ("BAT0 Inserted")
Notify (BAT0, 0x81) Notify (BAT0, 0x81)
} Else { } Else {
@@ -39,7 +39,7 @@ Method (ECQP, 0, Serialized)
} }
} }
If (EBIT (APC1, Local1)) { If (EBIT (BTSC, Local1)) {
Printf ("BAT0 Status Change") Printf ("BAT0 Status Change")
Notify (BAT0, 0x80) Notify (BAT0, 0x80)
} }