Commit 2d2c5e0e authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: cpu0: try regulators with name "cpu-supply"

Currently, we expect regulator name to be "cpu0", but as we are going to support
multiple cpu-blocks (all CPUs in a block share clock/voltage) later, we need to
pass some generic string instead of that.

For backwards compatibility try for "cpu0" first and if it fails, then try for
"cpu".
Suggested-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Tested-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d2f31f1d
...@@ -113,6 +113,7 @@ static int allocate_resources(struct device **cdev, ...@@ -113,6 +113,7 @@ static int allocate_resources(struct device **cdev,
struct regulator *cpu_reg; struct regulator *cpu_reg;
struct clk *cpu_clk; struct clk *cpu_clk;
int ret = 0; int ret = 0;
char *reg_cpu0 = "cpu0", *reg_cpu = "cpu", *reg;
cpu_dev = get_cpu_device(0); cpu_dev = get_cpu_device(0);
if (!cpu_dev) { if (!cpu_dev) {
...@@ -120,7 +121,11 @@ static int allocate_resources(struct device **cdev, ...@@ -120,7 +121,11 @@ static int allocate_resources(struct device **cdev,
return -ENODEV; return -ENODEV;
} }
cpu_reg = regulator_get_optional(cpu_dev, "cpu0"); /* Try "cpu0" for older DTs */
reg = reg_cpu0;
try_again:
cpu_reg = regulator_get_optional(cpu_dev, reg);
if (IS_ERR(cpu_reg)) { if (IS_ERR(cpu_reg)) {
/* /*
* If cpu0 regulator supply node is present, but regulator is * If cpu0 regulator supply node is present, but regulator is
...@@ -130,6 +135,13 @@ static int allocate_resources(struct device **cdev, ...@@ -130,6 +135,13 @@ static int allocate_resources(struct device **cdev,
dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n"); dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n");
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
/* Try with "cpu-supply" */
if (reg == reg_cpu0) {
reg = reg_cpu;
goto try_again;
}
dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n", dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n",
PTR_ERR(cpu_reg)); PTR_ERR(cpu_reg));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment