]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00318913-5 cpufreq: imx6: remove pu regulator dependency
authorAnson Huang <b20788@freescale.com>
Thu, 19 Jun 2014 01:01:58 +0000 (09:01 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:16:58 +0000 (21:16 -0600)
PU regulator is not a necessary regulator for cpufreq, not all
i.MX6 SoCs have PU regulator, so remove the dependency to support
i.MX6SX which has NO PU regulator.

Signed-off-by: Anson Huang <b20788@freescale.com>
drivers/cpufreq/imx6q-cpufreq.c

index ce69059be1fc95318284a9aecf0c21916244e1c9..ca96902d92276666331d13b137f9bc3402338c75 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013-2014 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -67,10 +67,14 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
        /* scaling up?  scale voltage before frequency */
        if (new_freq > old_freq) {
-               ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
-               if (ret) {
-                       dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret);
-                       return ret;
+               if (!IS_ERR(pu_reg) && regulator_is_enabled(pu_reg)) {
+                       ret = regulator_set_voltage_tol(pu_reg,
+                               imx6_soc_volt[index], 0);
+                       if (ret) {
+                               dev_err(cpu_dev,
+                                       "failed to scale vddpu up: %d\n", ret);
+                               return ret;
+                       }
                }
                ret = regulator_set_voltage_tol(soc_reg, imx6_soc_volt[index], 0);
                if (ret) {
@@ -122,10 +126,15 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
                        dev_warn(cpu_dev, "failed to scale vddsoc down: %d\n", ret);
                        ret = 0;
                }
-               ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
-               if (ret) {
-                       dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret);
-                       ret = 0;
+               if (!IS_ERR(pu_reg) && regulator_is_enabled(pu_reg)) {
+                       ret = regulator_set_voltage_tol(pu_reg,
+                               imx6_soc_volt[index], 0);
+                       if (ret) {
+                               dev_warn(cpu_dev,
+                                       "failed to scale vddpu down: %d\n",
+                                       ret);
+                               ret = 0;
+                       }
                }
        }
 
@@ -186,7 +195,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
        arm_reg = devm_regulator_get(cpu_dev, "arm");
        pu_reg = devm_regulator_get(cpu_dev, "pu");
        soc_reg = devm_regulator_get(cpu_dev, "soc");
-       if (IS_ERR(arm_reg) || IS_ERR(pu_reg) || IS_ERR(soc_reg)) {
+       if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
                dev_err(cpu_dev, "failed to get regulators\n");
                ret = -ENOENT;
                goto put_node;
@@ -270,9 +279,12 @@ soc_opp_out:
        ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
        if (ret > 0)
                transition_latency += ret * 1000;
-       ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
-       if (ret > 0)
-               transition_latency += ret * 1000;
+       if (!IS_ERR(pu_reg)) {
+               ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0],
+                       imx6_soc_volt[num - 1]);
+               if (ret > 0)
+                       transition_latency += ret * 1000;
+       }
 
        /*
         * OPP is maintained in order of increasing frequency, and