Skip to content

Commit ca78597

Browse files
Jordan YatesNickolasLapp
authored andcommitted
power_domain: gpio: improve logging
Improve the power domain logging by making the log level configurable and boosting the log level of the messages printed when the domain turns on and off. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
1 parent 6cce5a8 commit ca78597

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/power_domain/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ menuconfig POWER_DOMAIN
88

99
if POWER_DOMAIN
1010

11+
module = POWER_DOMAIN
12+
module-str = power_domain
13+
source "subsys/logging/Kconfig.template.log_config"
14+
1115
config POWER_DOMAIN_GPIO
1216
bool "GPIO controlled power domain"
1317
depends on GPIO

drivers/power_domain/power_domain_gpio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <zephyr/pm/device_runtime.h>
1414

1515
#include <zephyr/logging/log.h>
16-
LOG_MODULE_REGISTER(power_domain_gpio, LOG_LEVEL_INF);
16+
LOG_MODULE_REGISTER(power_domain_gpio, CONFIG_POWER_DOMAIN_LOG_LEVEL);
1717

1818
struct pd_gpio_config {
1919
struct gpio_dt_spec enable;
@@ -45,7 +45,7 @@ static int pd_gpio_pm_action(const struct device *dev,
4545
k_sleep(data->next_boot);
4646
/* Switch power on */
4747
gpio_pin_set_dt(&cfg->enable, 1);
48-
LOG_DBG("%s is now ON", dev->name);
48+
LOG_INF("%s is now ON", dev->name);
4949
/* Wait for domain to come up */
5050
k_sleep(K_USEC(cfg->startup_delay_us));
5151
/* Notify supported devices they are now powered */
@@ -56,7 +56,7 @@ static int pd_gpio_pm_action(const struct device *dev,
5656
pm_device_children_action_run(dev, PM_DEVICE_ACTION_TURN_OFF, NULL);
5757
/* Switch power off */
5858
gpio_pin_set_dt(&cfg->enable, 0);
59-
LOG_DBG("%s is now OFF and powered", dev->name);
59+
LOG_INF("%s is now OFF", dev->name);
6060
/* Store next time we can boot */
6161
next_boot_ticks = k_uptime_ticks() + k_us_to_ticks_ceil32(cfg->off_on_delay_us);
6262
data->next_boot = K_TIMEOUT_ABS_TICKS(next_boot_ticks);

0 commit comments

Comments
 (0)