Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Anson Huang and committed by
Rafael J. Wysocki
22d0628a 78e27086

+21 -14
+21 -14
drivers/cpufreq/imx6q-cpufreq.c
··· 66 66 67 67 /* scaling up? scale voltage before frequency */ 68 68 if (new_freq > old_freq) { 69 - ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 70 - if (ret) { 71 - dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret); 72 - return ret; 69 + if (!IS_ERR(pu_reg)) { 70 + ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 71 + if (ret) { 72 + dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret); 73 + return ret; 74 + } 73 75 } 74 76 ret = regulator_set_voltage_tol(soc_reg, imx6_soc_volt[index], 0); 75 77 if (ret) { ··· 123 121 dev_warn(cpu_dev, "failed to scale vddsoc down: %d\n", ret); 124 122 ret = 0; 125 123 } 126 - ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 127 - if (ret) { 128 - dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret); 129 - ret = 0; 124 + if (!IS_ERR(pu_reg)) { 125 + ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0); 126 + if (ret) { 127 + dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret); 128 + ret = 0; 129 + } 130 130 } 131 131 } 132 132 ··· 186 182 } 187 183 188 184 arm_reg = regulator_get(cpu_dev, "arm"); 189 - pu_reg = regulator_get(cpu_dev, "pu"); 185 + pu_reg = regulator_get_optional(cpu_dev, "pu"); 190 186 soc_reg = regulator_get(cpu_dev, "soc"); 191 - if (IS_ERR(arm_reg) || IS_ERR(pu_reg) || IS_ERR(soc_reg)) { 187 + if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) { 192 188 dev_err(cpu_dev, "failed to get regulators\n"); 193 189 ret = -ENOENT; 194 190 goto put_reg; ··· 272 268 ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); 273 269 if (ret > 0) 274 270 transition_latency += ret * 1000; 275 - ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); 276 - if (ret > 0) 277 - transition_latency += ret * 1000; 271 + if (!IS_ERR(pu_reg)) { 272 + ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); 273 + if (ret > 0) 274 + transition_latency += ret * 1000; 275 + } 278 276 279 277 /* 280 278 * OPP is maintained in order of increasing frequency, and ··· 333 327 cpufreq_unregister_driver(&imx6q_cpufreq_driver); 334 328 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); 335 329 regulator_put(arm_reg); 336 - regulator_put(pu_reg); 330 + if (!IS_ERR(pu_reg)) 331 + regulator_put(pu_reg); 337 332 regulator_put(soc_reg); 338 333 clk_put(arm_clk); 339 334 clk_put(pll1_sys_clk);