dm: power: Convert as3722 to driver model
[oweals/u-boot.git] / drivers / power / pmic / max77686.c
index 3523b4a2de2f2d55a122f8dc3e9b4d1a79c4842b..ceca9f96a7f3c237ecd96a8bb24029aad79a9ef9 100644 (file)
@@ -17,8 +17,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 static const struct pmic_child_info pmic_children_info[] = {
-       { .prefix = "ldo", .driver = MAX77686_LDO_DRIVER },
-       { .prefix = "buck", .driver = MAX77686_BUCK_DRIVER },
+       { .prefix = "LDO", .driver = MAX77686_LDO_DRIVER },
+       { .prefix = "BUCK", .driver = MAX77686_BUCK_DRIVER },
        { },
 };
 
@@ -50,13 +50,11 @@ static int max77686_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 static int max77686_bind(struct udevice *dev)
 {
-       int regulators_node;
-       const void *blob = gd->fdt_blob;
+       ofnode regulators_node;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
-                                            "voltage-regulators");
-       if (regulators_node <= 0) {
+       regulators_node = dev_read_subnode(dev, "voltage-regulators");
+       if (!ofnode_valid(regulators_node)) {
                debug("%s: %s regulators subnode not found!", __func__,
                                                             dev->name);
                return -ENXIO;
@@ -84,7 +82,7 @@ static const struct udevice_id max77686_ids[] = {
 };
 
 U_BOOT_DRIVER(pmic_max77686) = {
-       .name = "max77686 pmic",
+       .name = "max77686_pmic",
        .id = UCLASS_PMIC,
        .of_match = max77686_ids,
        .bind = max77686_bind,