diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-08-28 01:52:29 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-08 19:44:41 -0400 |
commit | 2d2c5e0e72546c1b4375ff5820ca8016c7123cbb (patch) | |
tree | 7c68dff7ab1009909c30b55e006a58d44bb8f823 | |
parent | d2f31f1da54f83c4eb2738402284c49cd51798d1 (diff) |
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: 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>
-rw-r--r-- | drivers/cpufreq/cpufreq-cpu0.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 03e352b627dd..de38952dab1a 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -113,6 +113,7 @@ static int allocate_resources(struct device **cdev, | |||
113 | struct regulator *cpu_reg; | 113 | struct regulator *cpu_reg; |
114 | struct clk *cpu_clk; | 114 | struct clk *cpu_clk; |
115 | int ret = 0; | 115 | int ret = 0; |
116 | char *reg_cpu0 = "cpu0", *reg_cpu = "cpu", *reg; | ||
116 | 117 | ||
117 | cpu_dev = get_cpu_device(0); | 118 | cpu_dev = get_cpu_device(0); |
118 | if (!cpu_dev) { | 119 | if (!cpu_dev) { |
@@ -120,7 +121,11 @@ static int allocate_resources(struct device **cdev, | |||
120 | return -ENODEV; | 121 | return -ENODEV; |
121 | } | 122 | } |
122 | 123 | ||
123 | cpu_reg = regulator_get_optional(cpu_dev, "cpu0"); | 124 | /* Try "cpu0" for older DTs */ |
125 | reg = reg_cpu0; | ||
126 | |||
127 | try_again: | ||
128 | cpu_reg = regulator_get_optional(cpu_dev, reg); | ||
124 | if (IS_ERR(cpu_reg)) { | 129 | if (IS_ERR(cpu_reg)) { |
125 | /* | 130 | /* |
126 | * If cpu0 regulator supply node is present, but regulator is | 131 | * If cpu0 regulator supply node is present, but regulator is |
@@ -130,6 +135,13 @@ static int allocate_resources(struct device **cdev, | |||
130 | dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n"); | 135 | dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n"); |
131 | return -EPROBE_DEFER; | 136 | return -EPROBE_DEFER; |
132 | } | 137 | } |
138 | |||
139 | /* Try with "cpu-supply" */ | ||
140 | if (reg == reg_cpu0) { | ||
141 | reg = reg_cpu; | ||
142 | goto try_again; | ||
143 | } | ||
144 | |||
133 | dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n", | 145 | dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n", |
134 | PTR_ERR(cpu_reg)); | 146 | PTR_ERR(cpu_reg)); |
135 | } | 147 | } |