From 5f3588a94d219818c1b3a2dac4d063f77f48a5ef Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Sun, 6 Oct 2024 16:51:21 +0300 Subject: 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 Signed-off-by: Svyatoslav Ryhel --- drivers/power/pmic/max8907.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers/power/pmic/max8907.c') 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)) { -- cgit v1.2.3