Fix cpufreq for imx8mq
* Removes hard-coded min/max, relies on DT values.
* "arm" regulator doesn't exist, rename dc-supply to arm-supply so that
arm properly resolves. This matches imx8mm DT.
Tested:
* Force performance/powersave, verify regulator voltage change.
Change-Id: Id7598578b357d77a5c0dfbd1b246458e964f1ed3
diff --git a/arch/arm64/boot/dts/freescale/fsl-imx8mq-som.dtsi b/arch/arm64/boot/dts/freescale/fsl-imx8mq-som.dtsi
index 78b068f..e701eb5 100644
--- a/arch/arm64/boot/dts/freescale/fsl-imx8mq-som.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-imx8mq-som.dtsi
@@ -665,7 +665,7 @@
1000000 850000
500000 850000
>;
- dc-supply = <&buck2_reg>;
+ arm-supply = <&buck2_reg>;
};
&hdmi {
diff --git a/drivers/cpufreq/imx8mq-cpufreq.c b/drivers/cpufreq/imx8mq-cpufreq.c
index d1d1ad4..d76e5e2 100644
--- a/drivers/cpufreq/imx8mq-cpufreq.c
+++ b/drivers/cpufreq/imx8mq-cpufreq.c
@@ -20,9 +20,6 @@
#include <linux/suspend.h>
#include <linux/device_cooling.h>
-#define DC_VOLTAGE_MIN 850000
-#define DC_VOLTAGE_MAX 1000000
-
static struct device *cpu_dev;
static bool free_opp;
static struct cpufreq_frequency_table *freq_table;
@@ -33,7 +30,6 @@
static struct clk *arm_pll_out_clk;
static struct clk *sys1_pll_800m_clk;
struct thermal_cooling_device *cdev;
-static struct regulator *dc_reg;
static struct regulator *arm_reg;
static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
@@ -58,16 +54,6 @@
dev_dbg(cpu_dev, "%u MHz --> %u MHz\n",
old_freq / 1000, new_freq / 1000);
- if (new_freq == policy->max) {
- if (!IS_ERR(dc_reg)) {
- ret = regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MAX, 0);
- if (ret) {
- dev_err(cpu_dev, "failed to scale dc_reg up: %d\n", ret);
- return ret;
- }
- }
- }
-
if (new_freq > old_freq) {
if (!IS_ERR(arm_reg)) {
ret = regulator_set_voltage_tol(arm_reg, volt, 0);
@@ -75,6 +61,8 @@
dev_err(cpu_dev, "failed to scale arm_reg up: %d\n", ret);
return ret;
}
+ } else {
+ dev_err(cpu_dev, "Can't change CPU voltage\n");
}
}
@@ -82,16 +70,6 @@
clk_set_rate(arm_pll_clk, new_freq * 1000);
clk_set_parent(arm_a53_src_clk, arm_pll_out_clk);
- if (old_freq == policy->max) {
- if (!IS_ERR(dc_reg)) {
- ret = regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0);
- if (ret) {
- dev_err(cpu_dev, "failed to scale dc_reg down: %d\n", ret);
- return ret;
- }
- }
- }
-
if (new_freq < old_freq) {
if (!IS_ERR(arm_reg)) {
ret = regulator_set_voltage_tol(arm_reg, volt, 0);
@@ -99,6 +77,8 @@
dev_err(cpu_dev, "failed to scale arm_reg down: %d\n", ret);
return ret;
}
+ } else {
+ dev_err(cpu_dev, "Can't change CPU voltage\n");
}
}
@@ -262,7 +242,6 @@
goto put_clk;
}
- dc_reg = regulator_get_optional(cpu_dev, "dc");
arm_reg = regulator_get_optional(cpu_dev, "arm");
/*