diff options
author | Bai Ping <b51503@freescale.com> | 2015-07-16 19:08:28 +0800 |
---|---|---|
committer | Bai Ping <b51503@freescale.com> | 2015-07-22 18:26:09 +0800 |
commit | 31f0773ee7d6ba5715486a221857f2ceccb434b4 (patch) | |
tree | c65480c50cc738410ca0fdf32d401387c2fef16d /drivers | |
parent | b2352a71bd1b6ab97a5a64fe7cf919b22911dacb (diff) |
MLK-11252-02 cpufreq: imx: add dc regulator in cpufreq driver
In some i.MX6 board (i.MX6UL EVK), it will have a additional
GPIO controlled DC-DC regulator. we need to change this regulator's
voltage According the maximum frequency that CPU can run at.
At present, we only need to set the voltage to minimum one, we need
to set the voltage to the maximum before suspend, resume back to the
minimum voltage after suspend.
Signed-off-by: Bai Ping <b51503@freescale.com>
(cherry picked from commit 0ee93c0d55bf0d9468de759cbee3087068ea4233)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/imx6q-cpufreq.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 176b9da5ead4..518d8a0a183b 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -21,12 +21,15 @@ #define PU_SOC_VOLTAGE_NORMAL 1250000 #define PU_SOC_VOLTAGE_HIGH 1275000 +#define DC_VOLTAGE_MIN 1300000 +#define DC_VOLTAGE_MAX 1400000 #define FREQ_1P2_GHZ 1200000000 #define FREQ_396_MHZ 396000 static struct regulator *arm_reg; static struct regulator *pu_reg; static struct regulator *soc_reg; +static struct regulator *dc_reg; static struct clk *arm_clk; static struct clk *pll1_sys_clk; @@ -244,9 +247,15 @@ static int imx6_cpufreq_pm_notify(struct notifier_block *nb, case PM_SUSPEND_PREPARE: cpufreq_policy_min_pre_suspend = data->user_policy.min; data->user_policy.min = data->user_policy.max; + + if (!IS_ERR(dc_reg)) + regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MAX, 0); break; case PM_POST_SUSPEND: data->user_policy.min = cpufreq_policy_min_pre_suspend; + + if (!IS_ERR(dc_reg)) + regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0); break; default: break; @@ -315,6 +324,10 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_node; } + dc_reg = devm_regulator_get_optional(cpu_dev, "dc"); + if (!IS_ERR(dc_reg)) + regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0); + /* * soc_reg sync with arm_reg if arm shares the same regulator * with soc. Otherwise, regulator common framework will refuse to update |