summaryrefslogtreecommitdiff
path: root/drivers/power/pmic/max8907.c
diff options
context:
space:
mode:
authorSvyatoslav Ryhel <clamor95@gmail.com>2024-10-06 16:51:21 +0300
committerSvyatoslav Ryhel <clamor95@gmail.com>2025-05-08 08:30:53 +0300
commit5f3588a94d219818c1b3a2dac4d063f77f48a5ef (patch)
tree7d3ce8934615f4aec5092377d75c62acda0b6196 /drivers/power/pmic/max8907.c
parent5204a362b8c80049e5242d92994637b3bac94d14 (diff)
sysreset: implement MAX9807 sysreset functions
MAX8907 PMIC has embedded poweroff function used by some device to initiane device power off. Implement it as optional sysreset driver guarded by kconfig option and system-power-controller device tree property. Tested-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Diffstat (limited to 'drivers/power/pmic/max8907.c')
-rw-r--r--drivers/power/pmic/max8907.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/power/pmic/max8907.c b/drivers/power/pmic/max8907.c
index 5d35957bf40..a7ef70177de 100644
--- a/drivers/power/pmic/max8907.c
+++ b/drivers/power/pmic/max8907.c
@@ -45,7 +45,19 @@ static int max8907_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
static int max8907_bind(struct udevice *dev)
{
ofnode regulators_node;
- int children;
+ int children, ret;
+
+ if (IS_ENABLED(CONFIG_SYSRESET_MAX8907) &&
+ dev_read_bool(dev, "maxim,system-power-controller")) {
+ ret = device_bind_driver_to_node(dev, MAX8907_RST_DRIVER,
+ "sysreset", dev_ofnode(dev),
+ NULL);
+ if (ret) {
+ log_debug("%s: cannot bind SYSRESET (ret = %d)\n",
+ __func__, ret);
+ return ret;
+ }
+ }
regulators_node = dev_read_subnode(dev, "regulators");
if (!ofnode_valid(regulators_node)) {