# Copyright (c) 2014-2015 Wind River Systems, Inc.
# Copyright (c) 2016 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

menu "Power Management"

config HAS_PM
	bool
	help
	  This option must be selected by SoCs that provide PM hooks, that is,
	  calls to configure low-power states.

config PM
	bool "System Power Management"
	depends on SYS_CLOCK_EXISTS && HAS_PM
	help
	  This option enables the board to implement extra power management
	  policies whenever the kernel becomes idle. The kernel informs the
	  power management subsystem of the number of ticks until the next kernel
	  timer is due to expire.

if PM

module = PM
module-str = System Power Management
source "subsys/logging/Kconfig.template.log_config"

config PM_STATS
	bool "System Power Management Stats"
	depends on STATS
	help
	  Enable System Power Management Stats.

config PM_S2RAM
	bool "Suspend-to-RAM (S2RAM)"
	depends on ARCH_HAS_SUSPEND_TO_RAM
	help
	  This option enables suspend-to-RAM (S2RAM).

choice PM_POLICY
	prompt "Idle State Power Management Policy"
	default PM_POLICY_DEFAULT
	help
	  Select the idle state power management policy.

config PM_POLICY_DEFAULT
	bool "Default PM policy"
	help
	  This option selects the default PM policy. Default policy is based
	  on CPU residency times and other constraints imposed by the drivers or
	  application.

config PM_POLICY_CUSTOM
	bool "Custom PM Policy"
	help
	  This options allows applications to override the default policy with
	  a custom implementation.

endchoice

endif # PM

config PM_DEVICE
	bool "Device Power Management"
	help
	  This option enables the device power management interface.  The
	  interface consists of hook functions implemented by device drivers
	  that get called by the power manager application when the system
	  is going to suspend state or resuming from suspend state. This allows
	  device drivers to do any necessary power management operations
	  like turning off device clocks and peripherals. The device drivers
	  may also save and restore states in these hook functions.

if PM_DEVICE

module = PM_DEVICE
module-str = Device Power Management
source "subsys/logging/Kconfig.template.log_config"

config PM_DEVICE_POWER_DOMAIN
	bool "Power domain"
	depends on PM_DEVICE
	default y
	help
	  Enable support for Power Domain. With power domain enabled,
	  devices that depend on a domain will be notified when this
	  domain is suspended or resumed.

config PM_DEVICE_POWER_DOMAIN_DYNAMIC
	bool "Dynamically bind devices to a Power Pomain"
	depends on PM_DEVICE_POWER_DOMAIN && DEVICE_DEPS_DYNAMIC
	help
	  Enable support for dynamically bind devices to a Power Domain.

config PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM
	int "Number of devices that can dynamically be bind to a Power Domain"
	depends on PM_DEVICE_POWER_DOMAIN_DYNAMIC
	default 1
	help
	  The number of devices that can dynamically be bind to a Power Domain.

config PM_DEVICE_RUNTIME
	bool "Runtime Device Power Management"
	select EVENTS
	help
	  Enable Runtime Power Management to save power. With device runtime PM
	  enabled, devices can be suspended or resumed based on the device
	  usage even while the CPU or system is running.

config PM_DEVICE_RUNTIME_EXCLUSIVE
	depends on PM_DEVICE_RUNTIME
	bool "Use only on Runtime Power Management on system suspend / resume"
	default y
	help
	  On system suspend / resume do not trigger the Device PM hooks but
	  only rely on Runtime PM to manage the devices power states.

endif # PM_DEVICE

endmenu
