From 14fa11f9b9d2f3aa0c5d2ca5839ff6b3073cb2e9 Mon Sep 17 00:00:00 2001
From: Tim Van Patten <timvp@google.com>
Date: Mon, 22 Aug 2022 14:06:11 -0600
Subject: ec/google/chromeec: Call PNOT() when Battery Status Changes

PNOT() should be called when the battery status changes, to give the SOC
an opportunity to handle it. This is in preparation for the low/no
battery boot changes.

This CL also updates the PNOT() comments to better match the name of the
function and why it's called.

BRANCH=none
BUG=b:217911928
TEST=Boot skyrim

Change-Id: I8b74313d242fd4959315a67579eb6c5f49a31a76
Signed-off-by: Tim Van Patten <timvp@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66993
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
---
 src/ec/google/chromeec/acpi/ec.asl | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

(limited to 'src/ec')

diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl
index 99f9344b77..b85e1861a0 100644
--- a/src/ec/google/chromeec/acpi/ec.asl
+++ b/src/ec/google/chromeec/acpi/ec.asl
@@ -166,8 +166,10 @@ Device (EC0)
 		// Initialize AC power state
 		Store (ACEX, \PWRS)
 		/*
-		 * Inform platform code about the current AC power state.
-		 * This allows the platform to take any action based on the initialized state.
+		 * Call PNOT (Platform Notify) to inform platform code
+		 * about the current AC/battery state. This handles all cases,
+		 * the battery transitioning into and out of having critically
+		 * low charge.
 		 * PWRS isn't valid before this point.
 		 */
 		\PNOT ()
@@ -258,6 +260,12 @@ Device (EC0)
 			Notify (\_SB.DPTF.TCHG, 0x80)
 		}
 #endif
+		/*
+		 * Call PNOT (Platform Notify) to inform platform code
+		 * about the current battery state. This handles all cases,
+		 * the battery transitioning into and out of having critically
+		 * low charge.
+		 */
 		\PNOT ()
 	}
 
@@ -272,6 +280,12 @@ Device (EC0)
 			Notify (\_SB.DPTF.TCHG, 0x80)
 		}
 #endif
+		/*
+		 * Call PNOT (Platform Notify) to inform platform code
+		 * about the current battery state. This handles all cases,
+		 * the battery transitioning into and out of having critically
+		 * low charge.
+		 */
 		\PNOT ()
 	}
 
@@ -384,6 +398,14 @@ Device (EC0)
 			Notify (BAT1, 0x80)
 		}
 #endif
+
+		/*
+		 * Call PNOT (Platform Notify) to inform platform code
+		 * about the current battery state. This handles all cases,
+		 * the battery transitioning into and out of having critically
+		 * low charge.
+		 */
+		\PNOT ()
 	}
 
 	// MKBP interrupt.
-- 
cgit v1.2.3