diff options
author | Alex Frid <afrid@nvidia.com> | 2014-03-31 20:28:54 -0700 |
---|---|---|
committer | Yu-Huan Hsu <yhsu@nvidia.com> | 2014-04-03 16:52:25 -0700 |
commit | bfd498975e9750f52982faea7e64fdee19d1fe24 (patch) | |
tree | 37b8afc08b1c94f8c731aa7b6318c6bb4ba765d4 /arch/arm/mach-tegra/tegra_cl_dvfs.c | |
parent | 5c1ae4dd885cdc4f5e559573e384e83351600272 (diff) |
ARM: tegra: dvfs: Compare set and required DFLL Vmin
Added CL-DVFS driver interface to compare set and required DFLL Vmin.
Commonly while operating in closed loop these two levels are equal.
However, when DFLL is disabled or in transition to/from disabled state
temperature or SiMon grade changes are not immediately delivered to
PMIC, and the levels may be different.
Bug 1343366
Change-Id: I7ecd782b37ddb5e3ca7a0f0dfa658ebb526e9fc6
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/391050
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra_cl_dvfs.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra_cl_dvfs.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra_cl_dvfs.c b/arch/arm/mach-tegra/tegra_cl_dvfs.c index 477a666f7b78..13719cd48e10 100644 --- a/arch/arm/mach-tegra/tegra_cl_dvfs.c +++ b/arch/arm/mach-tegra/tegra_cl_dvfs.c @@ -2724,6 +2724,42 @@ int tegra_cl_dvfs_vmax_read_retry(struct tegra_cl_dvfs *cld, uint start) return read_seqcount_retry(&cld->v_limits.vmax_seqcnt, start); } + +/* + * Compare actually set (last delivered) and required Vmin. These levels may + * be different if temperature or SiMon grade changes while cl-dvfs output + * interface is disabled, and new required setting is not delivered to PMIC. + * It actually may happen while cl_dvfs is disabled, or during transition + * to/from disabled state. + * + * Return: + * 0 if levels are equal, + * +1 if last Vmin is above required, + * -1 if last Vmin is below required. + */ +int tegra_cl_dvfs_vmin_cmp_needed(struct tegra_cl_dvfs *cld, int *needed_mv) +{ + int ret = 0; + unsigned long flags; + u8 needed_out_min, last_out_min; + + + clk_lock_save(cld->dfll_clk, &flags); + needed_out_min = get_output_min(cld); + last_out_min = cld->lut_min; + + if (last_out_min > needed_out_min) + ret = 1; + else if (last_out_min < needed_out_min) + ret = -1; + + if (needed_mv) + *needed_mv = get_mv(cld, needed_out_min); + + clk_unlock_restore(cld->dfll_clk, &flags); + return ret; +} + /* * Voltage clamping interface: set maximum and minimum voltage limits at the * same lowest safe (for current temperature and tuning range) level. Allows |