diff options
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 4f730af70e7c..3586571814b2 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -189,17 +189,18 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
189 | int ret = 0; | 189 | int ret = 0; |
190 | u32 val; | 190 | u32 val; |
191 | 191 | ||
192 | initdata = of_get_regulator_init_data(dev, np); | ||
193 | sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL); | 192 | sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL); |
194 | if (!sreg) | 193 | if (!sreg) |
195 | return -ENOMEM; | 194 | return -ENOMEM; |
196 | sreg->initdata = initdata; | ||
197 | sreg->name = of_get_property(np, "regulator-name", NULL); | 195 | sreg->name = of_get_property(np, "regulator-name", NULL); |
198 | rdesc = &sreg->rdesc; | 196 | rdesc = &sreg->rdesc; |
199 | rdesc->name = sreg->name; | 197 | rdesc->name = sreg->name; |
200 | rdesc->type = REGULATOR_VOLTAGE; | 198 | rdesc->type = REGULATOR_VOLTAGE; |
201 | rdesc->owner = THIS_MODULE; | 199 | rdesc->owner = THIS_MODULE; |
202 | 200 | ||
201 | initdata = of_get_regulator_init_data(dev, np, rdesc); | ||
202 | sreg->initdata = initdata; | ||
203 | |||
203 | anatop_np = of_get_parent(np); | 204 | anatop_np = of_get_parent(np); |
204 | if (!anatop_np) | 205 | if (!anatop_np) |
205 | return -ENODEV; | 206 | return -ENODEV; |
@@ -283,6 +284,19 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
283 | sreg->sel = 0; | 284 | sreg->sel = 0; |
284 | sreg->bypass = true; | 285 | sreg->bypass = true; |
285 | } | 286 | } |
287 | |||
288 | /* | ||
289 | * In case vddpu was disabled by the bootloader, we need to set | ||
290 | * a sane default until imx6-cpufreq was probed and changes the | ||
291 | * voltage to the correct value. In this case we set 1.25V. | ||
292 | */ | ||
293 | if (!sreg->sel && !strcmp(sreg->name, "vddpu")) | ||
294 | sreg->sel = 22; | ||
295 | |||
296 | if (!sreg->sel) { | ||
297 | dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n"); | ||
298 | return -EINVAL; | ||
299 | } | ||
286 | } else { | 300 | } else { |
287 | rdesc->ops = &anatop_rops; | 301 | rdesc->ops = &anatop_rops; |
288 | } | 302 | } |