If there are any errors in getting the cpu0 regulators, the driver returns
-ENOENT. In case the regulators are not yet available, the devm_regulator_get
calls will return -EPROBE_DEFER, so that the driver can be probed later.
If we return -ENOENT, the driver will fail its initialization and will
not try to probe again (when the regulators become available).
Return the actual error received from regulator_get in probe. Print a
differentiated message in case we need to probe the device later and
in case we actually failed. Also add a message to inform when the
driver has been successfully registered.
Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
pu_reg = devm_regulator_get_optional(cpu_dev, "pu");
soc_reg = devm_regulator_get(cpu_dev, "soc");
if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
- dev_err(cpu_dev, "failed to get regulators\n");
- ret = -ENOENT;
+ ret = IS_ERR(arm_reg)?PTR_ERR(arm_reg):PTR_ERR(soc_reg);
+ if (ret == -EPROBE_DEFER)
+ dev_warn(cpu_dev, "regulators not ready, retry\n");
+ else
+ dev_err(cpu_dev, "failed to get regulators: %d\n", ret);
goto put_node;
}
register_pm_notifier(&imx6_cpufreq_pm_notifier);
of_node_put(np);
+ dev_info(cpu_dev, "Registered imx6q-cpufreq\n");
return 0;
free_freq_table: