]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cpufreq: cpu0: try regulators with name "cpu-supply"
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 28 Aug 2014 05:52:29 +0000 (11:22 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 8 Sep 2014 23:44:41 +0000 (01:44 +0200)
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>
drivers/cpufreq/cpufreq-cpu0.c

index 03e352b627dd8437acee1ab5b02b93d259e9e3d2..de38952dab1abf749a7c1390b38e2b73d22aee92 100644 (file)
@@ -113,6 +113,7 @@ 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) {
@@ -120,7 +121,11 @@ static int allocate_resources(struct device **cdev,
                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
@@ -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));
        }