aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2014-06-20 03:42:18 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-21 07:43:19 -0400
commit22d0628a226c9864fabd621ef2bf64c841219b46 (patch)
tree5a53d3fb71d1702eb83a510d821e34856fd13762
parent78e2708691e9289f97750eb71aca31b5a2973d94 (diff)
cpufreq: imx6: remove pu regulator dependency for SOCs with no PU regulator
PU regulator is not a necessary regulator for cpufreq, not all i.MX6 SoCs have PU regulator, only if SOC has PU regulator, then its voltage must be equal to SOC regulator, so remove the dependency to support i.MX6SX which has no PU regulator. Signed-off-by: Anson Huang <b20788@freescale.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index af366c21d4b4..c2d30765bf3d 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -66,10 +66,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
66 66
67 /* scaling up? scale voltage before frequency */ 67 /* scaling up? scale voltage before frequency */
68 if (new_freq > old_freq) { 68 if (new_freq > old_freq) {
69 ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 69 if (!IS_ERR(pu_reg)) {
70 if (ret) { 70 ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
71 dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret); 71 if (ret) {
72 return ret; 72 dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret);
73 return ret;
74 }
73 } 75 }
74 ret = regulator_set_voltage_tol(soc_reg, imx6_soc_volt[index], 0); 76 ret = regulator_set_voltage_tol(soc_reg, imx6_soc_volt[index], 0);
75 if (ret) { 77 if (ret) {
@@ -121,10 +123,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
121 dev_warn(cpu_dev, "failed to scale vddsoc down: %d\n", ret); 123 dev_warn(cpu_dev, "failed to scale vddsoc down: %d\n", ret);
122 ret = 0; 124 ret = 0;
123 } 125 }
124 ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 126 if (!IS_ERR(pu_reg)) {
125 if (ret) { 127 ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
126 dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret); 128 if (ret) {
127 ret = 0; 129 dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret);
130 ret = 0;
131 }
128 } 132 }
129 } 133 }
130 134
@@ -182,9 +186,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
182 } 186 }
183 187
184 arm_reg = regulator_get(cpu_dev, "arm"); 188 arm_reg = regulator_get(cpu_dev, "arm");
185 pu_reg = regulator_get(cpu_dev, "pu"); 189 pu_reg = regulator_get_optional(cpu_dev, "pu");
186 soc_reg = regulator_get(cpu_dev, "soc"); 190 soc_reg = regulator_get(cpu_dev, "soc");
187 if (IS_ERR(arm_reg) || IS_ERR(pu_reg) || IS_ERR(soc_reg)) { 191 if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
188 dev_err(cpu_dev, "failed to get regulators\n"); 192 dev_err(cpu_dev, "failed to get regulators\n");
189 ret = -ENOENT; 193 ret = -ENOENT;
190 goto put_reg; 194 goto put_reg;
@@ -268,9 +272,11 @@ soc_opp_out:
268 ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); 272 ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
269 if (ret > 0) 273 if (ret > 0)
270 transition_latency += ret * 1000; 274 transition_latency += ret * 1000;
271 ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); 275 if (!IS_ERR(pu_reg)) {
272 if (ret > 0) 276 ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
273 transition_latency += ret * 1000; 277 if (ret > 0)
278 transition_latency += ret * 1000;
279 }
274 280
275 /* 281 /*
276 * OPP is maintained in order of increasing frequency, and 282 * OPP is maintained in order of increasing frequency, and
@@ -327,7 +333,8 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev)
327 cpufreq_unregister_driver(&imx6q_cpufreq_driver); 333 cpufreq_unregister_driver(&imx6q_cpufreq_driver);
328 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); 334 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
329 regulator_put(arm_reg); 335 regulator_put(arm_reg);
330 regulator_put(pu_reg); 336 if (!IS_ERR(pu_reg))
337 regulator_put(pu_reg);
331 regulator_put(soc_reg); 338 regulator_put(soc_reg);
332 clk_put(arm_clk); 339 clk_put(arm_clk);
333 clk_put(pll1_sys_clk); 340 clk_put(pll1_sys_clk);