Skip to content

Commit 8c3c19c

Browse files
nordic-aukogmarull
authored andcommitted
[nrf fromtree] drivers: mfd: npm2100: Add hibernate_pt mode support
Extend mfd_npm2100_hibernate function with pass_through argument, which is used to differentiate between hibernate and hibernate_pt modes. Signed-off-by: Audun Korneliussen <[email protected]> (cherry picked from commit 7fd3472)
1 parent ec9f2e7 commit 8c3c19c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

drivers/mfd/mfd_npm2100.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define SHPHLD_WAKEUP 0xC1U
2727
#define SHPHLD_SHPHLD 0xC2U
2828
#define HIBERNATE_TASKS_HIBER 0xC8U
29+
#define HIBERNATE_TASKS_HIBERPT 0xC9U
2930
#define RESET_TASKS_RESET 0xD0U
3031
#define RESET_BUTTON 0xD2U
3132
#define RESET_PIN 0xD3U
@@ -337,7 +338,7 @@ int mfd_npm2100_reset(const struct device *dev)
337338
return i2c_reg_write_byte_dt(&config->i2c, RESET_TASKS_RESET, 1U);
338339
}
339340

340-
int mfd_npm2100_hibernate(const struct device *dev, uint32_t time_ms)
341+
int mfd_npm2100_hibernate(const struct device *dev, uint32_t time_ms, bool pass_through)
341342
{
342343
const struct mfd_npm2100_config *config = dev->config;
343344
int ret;
@@ -365,7 +366,8 @@ int mfd_npm2100_hibernate(const struct device *dev, uint32_t time_ms)
365366
return ret;
366367
}
367368

368-
return i2c_reg_write_byte_dt(&config->i2c, HIBERNATE_TASKS_HIBER, 1U);
369+
return i2c_reg_write_byte_dt(
370+
&config->i2c, pass_through ? HIBERNATE_TASKS_HIBERPT : HIBERNATE_TASKS_HIBER, 1U);
369371
}
370372

371373
int mfd_npm2100_add_callback(const struct device *dev, struct gpio_callback *callback)

include/zephyr/drivers/mfd/npm2100.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,18 @@ int mfd_npm2100_reset(const struct device *dev);
9292
* @brief npm2100 hibernate
9393
*
9494
* Enters low power state, and wakes after specified time or "shphld" pin signal.
95+
* Pass-through mode can be used when the battery voltage is high enough to supply the pmic directly
96+
* without boosting. This lowers the power consumption of the pmic when hibernate mode is active.
9597
*
9698
* @param dev npm2100 mfd device
9799
* @param time_ms timer value in ms. Set to 0 to disable timer.
100+
* @param pass_through set to use pass-through hibernate mode.
98101
* @retval 0 If successful
99102
* @retval -EINVAL if time value is too large
100103
* @retval -EBUSY if the timer is already in use.
101104
* @retval -errno In case of any bus error (see i2c_write_dt())
102105
*/
103-
int mfd_npm2100_hibernate(const struct device *dev, uint32_t time_ms);
106+
int mfd_npm2100_hibernate(const struct device *dev, uint32_t time_ms, bool pass_through);
104107

105108
/**
106109
* @brief Add npm2100 event callback

0 commit comments

Comments
 (0)