aboutsummaryrefslogtreecommitdiff
path: root/package/boot/uboot-d1/patches/0008-power-pmic-axp-Probe-the-drivevbus-regulator-from-th.patch
blob: 2e8ed790ded41970cf8ed47540ab7970bb71de83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From a588c97f146b67bae47099bc419cf10c02eca169 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 26 Aug 2021 21:34:33 -0500
Subject: [PATCH 08/90] power: pmic: axp: Probe the drivevbus regulator from
 the DT

Now that some regulator driver exists for this PMIC, add support for
probing regulator drivers from the device tree subnodes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 drivers/power/pmic/axp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/power/pmic/axp.c
+++ b/drivers/power/pmic/axp.c
@@ -45,14 +45,24 @@ static struct dm_pmic_ops axp_pmic_ops =
 	.write		= dm_i2c_write,
 };
 
+static const struct pmic_child_info axp_pmic_child_info[] = {
+	{ "drivevbus",	"axp_drivevbus"	},
+	{ }
+};
+
 static int axp_pmic_bind(struct udevice *dev)
 {
+	ofnode regulators_node;
 	int ret;
 
 	ret = dm_scan_fdt_dev(dev);
 	if (ret)
 		return ret;
 
+	regulators_node = dev_read_subnode(dev, "regulators");
+	if (ofnode_valid(regulators_node))
+		pmic_bind_children(dev, regulators_node, axp_pmic_child_info);
+
 	if (CONFIG_IS_ENABLED(SYSRESET)) {
 		ret = device_bind_driver_to_node(dev, "axp_sysreset", "axp_sysreset",
 						 dev_ofnode(dev), NULL);