mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume
@ 2022-09-13 14:55 Jameson Thies
  2022-09-13 17:17 ` Prashant Malani
  2022-09-13 18:28 ` Benson Leung
  0 siblings, 2 replies; 3+ messages in thread
From: Jameson Thies @ 2022-09-13 14:55 UTC (permalink / raw)
  To: chrome-platform
  Cc: linux-kernel, pmalani, bleung, groeck, tzungbi, Jameson Thies

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.

Signed-off-by: Jameson Thies <jthies@google.com>
---

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.
---
 drivers/platform/chrome/cros_ec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
index 8aace50d446d..110df0fd4b00 100644
--- a/drivers/platform/chrome/cros_ec.c
+++ b/drivers/platform/chrome/cros_ec.c
@@ -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);
+	}
 }
 
 /**
-- 
2.37.2.789.g6183377224-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume
  2022-09-13 14:55 [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume Jameson Thies
@ 2022-09-13 17:17 ` Prashant Malani
  2022-09-13 18:28 ` Benson Leung
  1 sibling, 0 replies; 3+ messages in thread
From: Prashant Malani @ 2022-09-13 17:17 UTC (permalink / raw)
  To: Jameson Thies; +Cc: chrome-platform, linux-kernel, bleung, groeck, tzungbi

HI Jameson,

On Tue, Sep 13, 2022 at 7:55 AM Jameson Thies <jthies@google.com> 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.
>
> Update cros_ec_report_events_during_suspend to notify the PM of wake
> events during resume by calling pm_wakeup_event.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
Although I've already provided the tag, here it is again:

Reviewed-by: Prashant Malani <pmalani@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume
  2022-09-13 14:55 [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume Jameson Thies
  2022-09-13 17:17 ` Prashant Malani
@ 2022-09-13 18:28 ` Benson Leung
  1 sibling, 0 replies; 3+ messages in thread
From: Benson Leung @ 2022-09-13 18:28 UTC (permalink / raw)
  To: Jameson Thies; +Cc: chrome-platform, linux-kernel, pmalani, groeck, tzungbi

Hi Jameson,

On Tue, Sep 13, 2022 at 7:55 AM Jameson Thies <jthies@google.com> 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.
>
> Update cros_ec_report_events_during_suspend to notify the PM of wake
> events during resume by calling pm_wakeup_event.
>
> Signed-off-by: Jameson Thies <jthies@google.com>

Reviewed-by: Benson Leung <bleung@chromium.org>

> ---
>
> 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.
> ---
>  drivers/platform/chrome/cros_ec.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
> index 8aace50d446d..110df0fd4b00 100644
> --- a/drivers/platform/chrome/cros_ec.c
> +++ b/drivers/platform/chrome/cros_ec.c
> @@ -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);
> +       }
>  }
>
>  /**
> --
> 2.37.2.789.g6183377224-goog
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-13 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 14:55 [PATCH v3] platform/chrome: cros_ec: Notify the PM of wake events during resume Jameson Thies
2022-09-13 17:17 ` Prashant Malani
2022-09-13 18:28 ` Benson Leung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®