[PATCH] platform/chrome: cros_ec_lpc: Only check for events on MKBP notifies

Rob Barnes posted 1 patch 12 months ago
drivers/platform/chrome/cros_ec_lpc.c       | 2 +-
include/linux/platform_data/cros_ec_proto.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
[PATCH] platform/chrome: cros_ec_lpc: Only check for events on MKBP notifies
Posted by Rob Barnes 12 months ago
Only check EC for MKBP events when the ACPI notify value indicates the
notify is due to an MKBP host event. This reduces unnecessary queries to
the EC.

Notify value 0x80 is reserved for devices specific notifies. It is used
by many devices to indicate various events. It's only used by cros_ec
for MKBP events.

Signed-off-by: Rob Barnes <robbarnes@google.com>
---
 drivers/platform/chrome/cros_ec_lpc.c       | 2 +-
 include/linux/platform_data/cros_ec_proto.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index c784119ab5dc0..5405762ea5558 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -419,7 +419,7 @@ static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
 		return;
 	}
 
-	if (ec_dev->mkbp_event_supported)
+	if (value == ACPI_NOTIFY_CROS_EC_MKBP && ec_dev->mkbp_event_supported)
 		do {
 			ret = cros_ec_get_next_event(ec_dev, NULL,
 						     &ec_has_more_events);
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index b34ed0cc1f8dc..7d5b8a6bba3cc 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -48,6 +48,11 @@
  */
 #define ACPI_NOTIFY_CROS_EC_PANIC 0xB0
 
+/*
+ * ACPI notify value for MKBP host event.
+ */
+#define ACPI_NOTIFY_CROS_EC_MKBP 0x80
+
 /*
  * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
  */
-- 
2.47.1.613.gc27f4b7a9f-goog
Re: [PATCH] platform/chrome: cros_ec_lpc: Only check for events on MKBP notifies
Posted by Tzung-Bi Shih 12 months ago
On Wed, Dec 18, 2024 at 01:57:59AM +0000, Rob Barnes wrote:
> Only check EC for MKBP events when the ACPI notify value indicates the
> notify is due to an MKBP host event. This reduces unnecessary queries to
> the EC.
> 
> Notify value 0x80 is reserved for devices specific notifies. It is used
> by many devices to indicate various events. It's only used by cros_ec
> for MKBP events.
> 
> [...]

Applied to

    https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

[1/1] platform/chrome: cros_ec_lpc: Only check for events on MKBP notifies
      commit: a15ab7a5cc2a17b6a803f624fcf215f4e68d56b6

Thanks!