power: regulator: max9807: add regulator support
Added a new regulator driver for the MAXIM MAX8907 PMIC, providing
essential regulator functionalities and incorporated the necessary binding
framework within the core PMIC driver.
Tested-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
diff --git a/drivers/power/pmic/max8907.c b/drivers/power/pmic/max8907.c
index aeb6fe7..5d35957 100644
--- a/drivers/power/pmic/max8907.c
+++ b/drivers/power/pmic/max8907.c
@@ -6,6 +6,13 @@
#include <dm.h>
#include <dm/lists.h>
#include <power/pmic.h>
+#include <power/max8907.h>
+
+static const struct pmic_child_info pmic_children_info[] = {
+ { .prefix = "ldo", .driver = MAX8907_LDO_DRIVER },
+ { .prefix = "sd", .driver = MAX8907_SD_DRIVER },
+ { },
+};
static int max8907_write(struct udevice *dev, uint reg, const uint8_t *buff, int len)
{
@@ -32,6 +39,27 @@
return ret;
}
+ return 0;
+}
+
+static int max8907_bind(struct udevice *dev)
+{
+ ofnode regulators_node;
+ int children;
+
+ regulators_node = dev_read_subnode(dev, "regulators");
+ if (!ofnode_valid(regulators_node)) {
+ log_err("%s regulators subnode not found!\n", dev->name);
+ return -ENXIO;
+ }
+
+ log_debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
+
+ children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+ if (!children)
+ log_err("%s - no child found\n", dev->name);
+
+ /* Always return success for this device */
return 0;
}
@@ -49,5 +77,6 @@
.name = "max8907_pmic",
.id = UCLASS_PMIC,
.of_match = max8907_ids,
+ .bind = max8907_bind,
.ops = &max8907_ops,
};