aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPeter Johanson <[email protected]>2023-11-09 23:59:15 +0000
committerPete Johanson <[email protected]>2024-02-09 14:32:46 -0800
commit98e3b8b4350d0d588bb8b8a38bf184090886b3ee (patch)
treef3232aa6730e04844ee0d675b0453a2aafc3963d
parentb6d9f3c911bc39095825f35c5df176d95ee07d0a (diff)
downloadzmk-98e3b8b4350d0d588bb8b8a38bf184090886b3ee.tar.gz
zmk-98e3b8b4350d0d588bb8b8a38bf184090886b3ee.zip
refactor: Move to new sys_poweroff API.
* Move to new `sys_poweroff` API for our deep sleep functionality.
-rw-r--r--app/Kconfig5
-rw-r--r--app/src/activity.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/app/Kconfig b/app/Kconfig
index 0e761bed72..3a70f294aa 100644
--- a/app/Kconfig
+++ b/app/Kconfig
@@ -387,13 +387,12 @@ config ZMK_IDLE_TIMEOUT
config ZMK_SLEEP
bool "Enable deep sleep support"
+ depends on HAS_POWEROFF
+ select POWEROFF
imply USB
if ZMK_SLEEP
-config PM_DEVICE
- default y
-
config ZMK_IDLE_SLEEP_TIMEOUT
int "Milliseconds of inactivity before entering deep sleep"
default 900000
diff --git a/app/src/activity.c b/app/src/activity.c
index 330008b3e4..1140915168 100644
--- a/app/src/activity.c
+++ b/app/src/activity.c
@@ -7,7 +7,7 @@
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
-#include <zephyr/pm/pm.h>
+#include <zephyr/sys/poweroff.h>
#include <zephyr/logging/log.h>
@@ -70,7 +70,7 @@ void activity_work_handler(struct k_work *work) {
if (inactive_time > MAX_SLEEP_MS && !is_usb_power_present()) {
// Put devices in suspend power mode before sleeping
set_state(ZMK_ACTIVITY_SLEEP);
- pm_state_force(0U, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
+ sys_poweroff();
} else
#endif /* IS_ENABLED(CONFIG_ZMK_SLEEP) */
if (inactive_time > MAX_IDLE_MS) {