Matt DeVillier has uploaded this change for review.

View Change

ec/google/chromeec: Guard battery-related ACPI code

Boards which do not have a built-in battery, like Fizz and
Puff-based Chromeboxes, still report the board using a battery
but one not being connected, leading to a red battery icon with
a disabled symbol in many OSes.

Mitigate this by guarding the inclusion of battery.asl with
ifndef EC_NO_BATTERY_PRESENT, and define this for Fizz and
Puff-based boards. Also guard _Qxx methods which reference
BAT0.

Test: build/boot Puff variant, boot OS (eg, Windows 10 2H20),
check that a missing battery is not reported by the OS.

Change-Id: I41df5a925c9a15553d9e818a2efed2210311fd45
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
---
M src/ec/google/chromeec/acpi/ec.asl
M src/mainboard/google/fizz/variants/baseboard/include/baseboard/ec.h
M src/mainboard/google/hatch/variants/baseboard/include/puff/ec.h
3 files changed, 18 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/48859/1
diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl
index 218d08b..effc2bf 100644
--- a/src/ec/google/chromeec/acpi/ec.asl
+++ b/src/ec/google/chromeec/acpi/ec.asl
@@ -263,20 +263,25 @@
// Battery Low Event
Method (_Q06, 0, NotSerialized)
{
+#ifndef EC_NO_BATTERY_PRESENT
Store ("EC: BATTERY LOW", Debug)
Notify (BAT0, 0x80)
+#endif
}

// Battery Critical Event
Method (_Q07, 0, NotSerialized)
{
+#ifndef EC_NO_BATTERY_PRESENT
Store ("EC: BATTERY CRITICAL", Debug)
Notify (BAT0, 0x80)
+#endif
}

// Battery Info Event
Method (_Q08, 0, NotSerialized)
{
+#ifndef EC_NO_BATTERY_PRESENT
Store ("EC: BATTERY INFO", Debug)
Notify (BAT0, 0x81)
#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE
@@ -284,6 +289,7 @@
Notify (BAT1, 0x81)
}
#endif
+#endif
}

// Thermal Overload Event
@@ -323,8 +329,10 @@
// Battery Shutdown Imminent
Method (_Q11, 0, NotSerialized)
{
+#ifndef EC_NO_BATTERY_PRESENT
Store ("EC: BATTERY SHUTDOWN", Debug)
Notify (BAT0, 0x80)
+#endif
}

// Throttle Start
@@ -357,6 +365,7 @@
// Battery Status
Method (_Q17, 0, NotSerialized)
{
+#ifndef EC_NO_BATTERY_PRESENT
Store ("EC: BATTERY STATUS", Debug)
Notify (BAT0, 0x80)
#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE
@@ -364,6 +373,7 @@
Notify (BAT1, 0x80)
}
#endif
+#endif
}

// MKBP interrupt.
@@ -567,7 +577,9 @@
#endif

#include "ac.asl"
+#ifndef EC_NO_BATTERY_PRESENT
#include "battery.asl"
+#endif
#include "cros_ec.asl"

#ifdef EC_ENABLE_ALS_DEVICE
diff --git a/src/mainboard/google/fizz/variants/baseboard/include/baseboard/ec.h b/src/mainboard/google/fizz/variants/baseboard/include/baseboard/ec.h
index 504b6de..b02a389 100644
--- a/src/mainboard/google/fizz/variants/baseboard/include/baseboard/ec.h
+++ b/src/mainboard/google/fizz/variants/baseboard/include/baseboard/ec.h
@@ -53,4 +53,7 @@

#define EC_ENABLE_MKBP_DEVICE /* Enable cros_ec_keyb device */

+/* Fizz-based boards do not have a built-in battery */
+#define EC_NO_BATTERY_PRESENT
+
#endif
diff --git a/src/mainboard/google/hatch/variants/baseboard/include/puff/ec.h b/src/mainboard/google/hatch/variants/baseboard/include/puff/ec.h
index 986cf61..36e1b73 100644
--- a/src/mainboard/google/hatch/variants/baseboard/include/puff/ec.h
+++ b/src/mainboard/google/hatch/variants/baseboard/include/puff/ec.h
@@ -56,4 +56,7 @@
/* Enable EC sync interrupt, EC_SYNC_IRQ is defined in baseboard/gpio.h */
#define EC_ENABLE_SYNC_IRQ

+/* Puff-based boards do not have a built-in battery */
+#define EC_NO_BATTERY_PRESENT
+
#endif /* __BASEBOARD_EC_H__ */

To view, visit change 48859. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I41df5a925c9a15553d9e818a2efed2210311fd45
Gerrit-Change-Number: 48859
Gerrit-PatchSet: 1
Gerrit-Owner: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-MessageType: newchange