Re: [PATCH v2] platform/chrome: cros_ec: Always expose last resume result

From: Tzung-Bi Shih
Date: Tue Jun 14 2022 - 01:30:32 EST


On Fri, Jun 10, 2022 at 11:18:25PM -0700, Stephen Boyd wrote:
> @@ -135,10 +135,10 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
> buf.msg.command = EC_CMD_HOST_SLEEP_EVENT;
>
> ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg);
> -
> - /* For now, report failure to transition to S0ix with a warning. */
> + /* Report failure to transition to system wide suspend with a warning. */
> if (ret >= 0 && ec_dev->host_sleep_v1 &&
> - (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME)) {
> + (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME ||
> + sleep_event == HOST_SLEEP_EVENT_S3_RESUME)) {
> ec_dev->last_resume_result =
> buf.u.resp1.resume_response.sleep_transitions;

The warning in the if-block:
WARN_ONCE(buf.u.resp1.resume_response.sleep_transitions &
EC_HOST_RESUME_SLEEP_TIMEOUT,
"EC detected sleep transition timeout. Total slp_s0 transitions: %d",
buf.u.resp1.resume_response.sleep_transitions &
EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK);

Not sure and I wonder if the term "slp_s0" is still generic enough to the case.
And also [1].

[1]: https://crrev.com/a311a7657ca0a488f507fa78fd9c2d825cbf083e/power_manager/powerd/system/suspend_configurator.cc#98

At least we should fix [2] once the patch landed.

[2]: https://crrev.com/a311a7657ca0a488f507fa78fd9c2d825cbf083e/power_manager/tools/suspend_stress_test#369