summaryrefslogtreecommitdiff
path: root/drivers/power/pmic/max8907.c
diff options
context:
space:
mode:
authorSvyatoslav Ryhel <clamor95@gmail.com>2024-10-06 14:59:54 +0300
committerSvyatoslav Ryhel <clamor95@gmail.com>2025-05-08 08:30:53 +0300
commit5204a362b8c80049e5242d92994637b3bac94d14 (patch)
tree28ea8511953d93f7057b454194e12a75ef1ce8e4 /drivers/power/pmic/max8907.c
parent68d1b0f84aa8128eeed4a1d13ddf8e5a57630011 (diff)
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>
Diffstat (limited to 'drivers/power/pmic/max8907.c')
-rw-r--r--drivers/power/pmic/max8907.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/power/pmic/max8907.c b/drivers/power/pmic/max8907.c
index aeb6fe734e6..5d35957bf40 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)
{
@@ -35,6 +42,27 @@ static int max8907_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
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;
+}
+
static struct dm_pmic_ops max8907_ops = {
.read = max8907_read,
.write = max8907_write,
@@ -49,5 +77,6 @@ U_BOOT_DRIVER(pmic_max8907) = {
.name = "max8907_pmic",
.id = UCLASS_PMIC,
.of_match = max8907_ids,
+ .bind = max8907_bind,
.ops = &max8907_ops,
};