Check if any device is busy before sleep
Some devices might be in the middle of something that can't be interrupted. Device drivers can communicate with the power management module with the device busy API but the pm module also needs to check the busy flags.
This commit is contained in:
parent
2ad8f687c0
commit
5d658206df
1 changed files with 1 additions and 1 deletions
|
@ -24,7 +24,7 @@ bool is_usb_power_present() {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pm_state_info pm_policy_next_state(int32_t ticks) {
|
struct pm_state_info pm_policy_next_state(int32_t ticks) {
|
||||||
if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present()) {
|
if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present() && !device_any_busy_check()) {
|
||||||
return (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0};
|
return (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue