summaryrefslogtreecommitdiff
path: root/zephyr/subsys/ap_pwrseq/include
diff options
context:
space:
mode:
authorLi Feng <li1.feng@intel.com>2022-03-30 16:59:52 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-13 02:30:57 +0000
commitd12fb951bc0efbd8fc1ef366cbc835e4147faf92 (patch)
tree4c9102ade019a87b26c5630db65c651a9da749d1 /zephyr/subsys/ap_pwrseq/include
parent229bb8111cd47592ac2cc012683f4f7169705d6a (diff)
downloadchrome-ec-d12fb951bc0efbd8fc1ef366cbc835e4147faf92.tar.gz
zephyr: ap_pwrseq: support host sleep event and wake mask
S0ix enablement has multiple patches, this is second one of the series. HC EC_CMD_HOST_SLEEP_EVENT implementation in legacy EC code is reused. This will be migrated to Zephyr implementation. ap_pwrseq provides ap_power_chipset_handle_host_sleep_event() to process host sleep event changes. BIOS sets wake masks for each sleep state (S3/S5/S0ix) only once during boot up. EC has to take care wake mask update when power state changes. Updating wake mask at run time is added to ap_pwrseq. HC get/set wake mask in legacy EC code is resued. This should migrate to Zephyr implementation too. Refer to CL:576047 for original design. BUG=b:203446068 b:203446865 BRANCH=none TEST=zmake testall Signed-off-by: Li Feng <li1.feng@intel.com> Change-Id: Id972b904add5b3170fb91a8aa180736b42923dfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3562042 Reviewed-by: Andrew McRae <amcrae@google.com>
Diffstat (limited to 'zephyr/subsys/ap_pwrseq/include')
-rw-r--r--zephyr/subsys/ap_pwrseq/include/ap_power_host_sleep.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/zephyr/subsys/ap_pwrseq/include/ap_power_host_sleep.h b/zephyr/subsys/ap_pwrseq/include/ap_power_host_sleep.h
new file mode 100644
index 0000000000..e16816d185
--- /dev/null
+++ b/zephyr/subsys/ap_pwrseq/include/ap_power_host_sleep.h
@@ -0,0 +1,35 @@
+/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __AP_POWER_HOST_SLEEP_H
+#define __AP_POWER_HOST_SLEEP_H
+
+#include <ap_power/ap_power_interface.h>
+#include <power_host_sleep.h>
+
+/*
+ * Deferred call to set active mask according to current power state
+ */
+void ap_power_set_active_wake_mask(void);
+
+/*
+ * Get lazy wake masks for the sleep state provided
+ *
+ * @param state Power state
+ * @param mask Lazy wake mask.
+ *
+ * @return 0 for success; -EINVAL if power state is not S3/S5/S0ix
+ */
+int ap_power_get_lazy_wake_mask(
+ enum power_states_ndsx state, host_event_t *mask);
+
+#if CONFIG_AP_PWRSEQ_S0IX
+/*
+ * Reset host sleep state and clean up
+ */
+void ap_power_reset_host_sleep_state(void);
+#endif /* CONFIG_AP_PWRSEQ_S0IX */
+
+#endif /* __AP_PWRSEQ_HOST_SLEEP_H */