]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/regulator/anatop-regulator.c
Merge remote-tracking branches 'regulator/topic/anatop', 'regulator/topic/arizona...
[mirror_ubuntu-bionic-kernel.git] / drivers / regulator / anatop-regulator.c
index b041f277a38b7ba6634656785012ed5737ab03e6..7d6478e6a5037ea446767ececa7ba0cdfea0d609 100644 (file)
@@ -39,7 +39,6 @@
 #define LDO_FET_FULL_ON                        0x1f
 
 struct anatop_regulator {
-       const char *name;
        u32 control_reg;
        struct regmap *anatop;
        int vol_bit_shift;
@@ -193,13 +192,21 @@ static int anatop_regulator_probe(struct platform_device *pdev)
        sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
        if (!sreg)
                return -ENOMEM;
-       sreg->name = of_get_property(np, "regulator-name", NULL);
+
        rdesc = &sreg->rdesc;
-       rdesc->name = sreg->name;
        rdesc->type = REGULATOR_VOLTAGE;
        rdesc->owner = THIS_MODULE;
 
+       of_property_read_string(np, "regulator-name", &rdesc->name);
+       if (!rdesc->name) {
+               dev_err(dev, "failed to get a regulator-name\n");
+               return -EINVAL;
+       }
+
        initdata = of_get_regulator_init_data(dev, np, rdesc);
+       if (!initdata)
+               return -ENOMEM;
+
        initdata->supply_regulator = "vin";
        sreg->initdata = initdata;
 
@@ -293,9 +300,13 @@ static int anatop_regulator_probe(struct platform_device *pdev)
                 * a sane default until imx6-cpufreq was probed and changes the
                 * voltage to the correct value. In this case we set 1.25V.
                 */
-               if (!sreg->sel && !strcmp(sreg->name, "vddpu"))
+               if (!sreg->sel && !strcmp(rdesc->name, "vddpu"))
                        sreg->sel = 22;
 
+               /* set the default voltage of the pcie phy to be 1.100v */
+               if (!sreg->sel && !strcmp(rdesc->name, "vddpcie"))
+                       sreg->sel = 0x10;
+
                if (!sreg->bypass && !sreg->sel) {
                        dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
                        return -EINVAL;