Commit faa06ac4 authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Carles Cufi
Browse files

pm: improve logging



List of improvements:

- The PM logging module was only available if CONFIG_PM=y, however, it
  was also used by Device PM (which can be selected without PM). A new
  logging module has been created for Device PM.
- Log level is passed to LOG_MODULE_(DECLARE|REGISTER)
- Logger name has been adjusted to `pm` (was `power`)

Signed-off-by: default avatarGerard Marull-Paretas <gerard.marull@nordicsemi.no>
parent e3ce7859
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -15,6 +15,10 @@ menuconfig PM

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
@@ -23,11 +27,6 @@ config PM_STATS

source "subsys/pm/policy/Kconfig"

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


endif # PM

config HAS_NO_SYS_PM
@@ -49,11 +48,19 @@ config PM_DEVICE
	  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_RUNTIME
	bool "Runtime Device Power Management"
	depends on PM_DEVICE
	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.

endif # PM_DEVICE

endmenu
+1 −2
Original line number Diff line number Diff line
@@ -7,9 +7,8 @@
#include <device.h>
#include <pm/device.h>

#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */
#include <logging/log.h>
LOG_MODULE_DECLARE(power);
LOG_MODULE_REGISTER(pm_device, CONFIG_PM_DEVICE_LOG_LEVEL);

#if defined(CONFIG_PM_DEVICE)
extern const struct device *__pm_device_slots_start[];
+1 −2
Original line number Diff line number Diff line
@@ -7,9 +7,8 @@
#include <sys/__assert.h>
#include <pm/device_runtime.h>

#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */
#include <logging/log.h>
LOG_MODULE_DECLARE(power);
LOG_MODULE_DECLARE(pm_device, CONFIG_PM_DEVICE_LOG_LEVEL);

/* Device PM request type */
#define PM_DEVICE_SYNC          BIT(0)
+1 −2
Original line number Diff line number Diff line
@@ -10,9 +10,8 @@
#include <sys/atomic.h>
#include <pm/state.h>

#define LOG_LEVEL CONFIG_PM_LOG_LEVEL /* From power module Kconfig */
#include <logging/log.h>
LOG_MODULE_DECLARE(power);
LOG_MODULE_DECLARE(pm, CONFIG_PM_LOG_LEVEL);

#define PM_STATES_LEN (1 + PM_STATE_SOFT_OFF - PM_STATE_ACTIVE)

+1 −2
Original line number Diff line number Diff line
@@ -17,9 +17,8 @@
#include "pm_priv.h"

#define PM_STATES_LEN (1 + PM_STATE_SOFT_OFF - PM_STATE_ACTIVE)
#define LOG_LEVEL CONFIG_PM_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER(power);
LOG_MODULE_REGISTER(pm, CONFIG_PM_LOG_LEVEL);

static int post_ops_done = 1;
static struct pm_state_info z_power_state;