Commit cdcd2dff authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

power: Consider the exit latency required by an idle state



Set the timeout to expire "exit_latency_us" earlier to the CPU be
capable of honor the next scheduled event.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent 0f5cfa9f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

#include <zephyr.h>
#include <kernel.h>
#include <timeout_q.h>
#include <init.h>
#include <string.h>
#include <power/power.h>
@@ -180,6 +181,15 @@ enum pm_state pm_system_suspend(int32_t ticks)
	}
	post_ops_done = 0;

	if (ticks != K_TICKS_FOREVER) {
		/*
		 * We need to set the timer to interrupt a little bit early to
		 * accommodate the time required by the CPU to fully wake up.
		 */
		z_set_timeout_expiry(ticks -
		     k_us_to_ticks_ceil32(z_power_state.exit_latency_us), true);
	}

#if CONFIG_PM_DEVICE

	bool should_resume_devices = true;