Message ID | 20230121231307.42628-4-samuel@sholland.org |
---|---|
State | Accepted |
Commit | 55ad509c119d65d7387bb972147a25fd3582ab74 |
Delegated to: | Andre Przywara |
Headers | show |
Series | power: X-Powers PMIC regulator support | expand |
On Sat, 21 Jan 2023 17:13:06 -0600 Samuel Holland <samuel@sholland.org> wrote: Hi, > Now that a regulator driver exists for this PMIC, hook it up to the > device tree "regulators" subnodes. > > Signed-off-by: Samuel Holland <samuel@sholland.org> > --- > > (no changes since v1) > > drivers/power/pmic/axp.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c > index e0005994e2..025dac24f2 100644 > --- a/drivers/power/pmic/axp.c > +++ b/drivers/power/pmic/axp.c > @@ -45,14 +45,32 @@ static struct dm_pmic_ops axp_pmic_ops = { > .write = dm_i2c_write, > }; > > +static const struct pmic_child_info axp_pmic_child_info[] = { > + { "aldo", "axp_regulator" }, > + { "bldo", "axp_regulator" }, > + { "cldo", "axp_regulator" }, > + { "dc", "axp_regulator" }, > + { "dldo", "axp_regulator" }, > + { "eldo", "axp_regulator" }, > + { "fldo", "axp_regulator" }, > + { "ldo", "axp_regulator" }, Technically I think this list misses "rtc" (for rtc[_-]ldo), but those are real fixed regulators, and I see only one weird consumer (GPS device in sun8i-a83t-tbs-a711.dts, not relevant to U-Boot), so I think it's fine. Should an actual user emerge, we can always add it. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Cheers, Andre > + { "sw", "axp_regulator" }, > + { } > +}; > + > 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);
diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c index e0005994e2..025dac24f2 100644 --- a/drivers/power/pmic/axp.c +++ b/drivers/power/pmic/axp.c @@ -45,14 +45,32 @@ static struct dm_pmic_ops axp_pmic_ops = { .write = dm_i2c_write, }; +static const struct pmic_child_info axp_pmic_child_info[] = { + { "aldo", "axp_regulator" }, + { "bldo", "axp_regulator" }, + { "cldo", "axp_regulator" }, + { "dc", "axp_regulator" }, + { "dldo", "axp_regulator" }, + { "eldo", "axp_regulator" }, + { "fldo", "axp_regulator" }, + { "ldo", "axp_regulator" }, + { "sw", "axp_regulator" }, + { } +}; + 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);
Now that a regulator driver exists for this PMIC, hook it up to the device tree "regulators" subnodes. Signed-off-by: Samuel Holland <samuel@sholland.org> --- (no changes since v1) drivers/power/pmic/axp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)