Skip to contentSkip to conversation

platform/chrome: cros_ec: Notify the PM of wake events during resume

PATCH Applied Jameson Thies 2 participants 3 messages Sep 13, 2022 – Sep 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 platform/chrome: cros_ec: Notify the PM of wake events during resume

cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended.

Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event.

---

Changes since v1:
- Updated wording in commit message from "Log" to "Notify PM of".

Changes since v2:
- Removed Reviewed-by tag and provided more context for the update in the commit message.

Changes since v3:
- Added reviewers back into commit message.

---
 drivers/platform/chrome/cros_ec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec.c +7 -1
index 8aace50d446d..110df0fd4b00 100644
@@ -349,10 +349,16 @@ EXPORT_SYMBOL(cros_ec_suspend);
 
 static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
 {
+	bool wake_event;
+
 	while (ec_dev->mkbp_event_supported &&
-	       cros_ec_get_next_event(ec_dev, NULL, NULL) > 0)
+	       cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) {
 		blocking_notifier_call_chain(&ec_dev->event_notifier,
 					     1, ec_dev);
+
+		if (wake_event && device_may_wakeup(ec_dev->dev))
+			pm_wakeup_event(ec_dev->dev, 0);
+	}
 }
 
 /**
Signature · 1 line
2.37.2.789.g6183377224-goog
#1 lore raw
This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Quoted 9 lines · On Tue, 13 Sep 2022 20:49:54 +0000 you wrote:

cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended.

[...]

Here is the summary with links:
- [v4] platform/chrome: cros_ec: Notify the PM of wake events during resume

    https://git.kernel.org/chrome-platform/c/8edd2752b0aa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#2 lore raw
In reply to Jameson Thies
This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Quoted 9 lines · On Tue, 13 Sep 2022 20:49:54 +0000 you wrote:

cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended.

[...]

Here is the summary with links:
- [v4] platform/chrome: cros_ec: Notify the PM of wake events during resume

    https://git.kernel.org/chrome-platform/c/8edd2752b0aa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html