From a213ed659a5a535875166a8a1d1f631dd6c606f7 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Thu, 21 Feb 2019 17:38:03 -0800 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/31560 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/ec/google/wilco/acpi/ec.asl | 2 +- src/ec/google/wilco/acpi/ec_ram.asl | 6 +----- src/ec/google/wilco/acpi/event.asl | 10 +++++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/ec/google/wilco/acpi/ec.asl b/src/ec/google/wilco/acpi/ec.asl index 5aca1878d6..675ee3778e 100644 --- a/src/ec/google/wilco/acpi/ec.asl +++ b/src/ec/google/wilco/acpi/ec.asl @@ -42,7 +42,7 @@ Device (EC0) EREG = Arg1 /* Store initial value for power status */ - ECPR = R (APWR) + ECPR = R (PWSR) /* Indicate to EC that OS is ready for queries */ W (ERDY, Arg1) diff --git a/src/ec/google/wilco/acpi/ec_ram.asl b/src/ec/google/wilco/acpi/ec_ram.asl index 1c030af06f..b7cfefae35 100644 --- a/src/ec/google/wilco/acpi/ec_ram.asl +++ b/src/ec/google/wilco/acpi/ec_ram.asl @@ -53,6 +53,7 @@ Name (P5U1, Package () { 0x04, 0x01, RD }) /* PmSt5_BAT1_UPDATE */ Name (P6ST, Package () { 0x05, 0xff, RD }) /* PmSt6 */ 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 (BTEX, Package () { 0x06, 0x02, RD }) /* Battery Present */ 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 (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 */ diff --git a/src/ec/google/wilco/acpi/event.asl b/src/ec/google/wilco/acpi/event.asl index 24cf268636..fab4fc46c3 100644 --- a/src/ec/google/wilco/acpi/event.asl +++ b/src/ec/google/wilco/acpi/event.asl @@ -19,17 +19,17 @@ Name (ECPR, 0) Method (ECQP, 0, Serialized) { - Local0 = R (APWR) + Local0 = R (PWSR) Local1 = Local0 ^ ECPR ECPR = Local0 - If (EBIT (APAC, Local1)) { + If (EBIT (ACEX, Local1)) { Printf ("AC Power Status Changed") Notify (AC, 0x80) } - If (EBIT (APB1, Local1)) { - If (EBIT (APB1, Local0)) { + If (EBIT (BTEX, Local1)) { + If (EBIT (BTEX, Local0)) { Printf ("BAT0 Inserted") Notify (BAT0, 0x81) } Else { @@ -39,7 +39,7 @@ Method (ECQP, 0, Serialized) } } - If (EBIT (APC1, Local1)) { + If (EBIT (BTSC, Local1)) { Printf ("BAT0 Status Change") Notify (BAT0, 0x80) }