Skip to content

Commit

Permalink
cpufreq: cpu0: try regulators with name "cpu-supply"
Browse files Browse the repository at this point in the history
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: Stephen Boyd <sboyd@codeaurora.org>
Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Sep 8, 2014
1 parent d2f31f1 commit 2d2c5e0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ static int allocate_resources(struct device **cdev,
struct regulator *cpu_reg;
struct clk *cpu_clk;
int ret = 0;
char *reg_cpu0 = "cpu0", *reg_cpu = "cpu", *reg;

cpu_dev = get_cpu_device(0);
if (!cpu_dev) {
pr_err("failed to get cpu0 device\n");
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 cpu0 regulator supply node is present, but regulator is
Expand All @@ -130,6 +135,13 @@ static int allocate_resources(struct device **cdev,
dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n");
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",
PTR_ERR(cpu_reg));
}
Expand Down

0 comments on commit 2d2c5e0

Please sign in to comment.