diff options
author | Alex Frid <afrid@nvidia.com> | 2012-05-26 20:12:01 -0700 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2012-06-08 16:07:09 +0530 |
commit | df5e4c2dac995d1d07b4509a9c7e06e946288d9f (patch) | |
tree | bb38506d3b692c96f074ab11f8675d9ff74614d1 /arch/arm/mach-tegra/tegra3_dvfs.c | |
parent | 9f2462bb18175889ff8251d399e8d6a31777d237 (diff) |
ARM: tegra: dvfs: Re-factor CPU alternative dvfs
Removed alternative frequencies table from dvfs structure, and
replaced it with table pointer to facilitate future support for
multiple alternative tables. Actually supported alternative dvfs
table (Tegra3 CPU cold zone table) is not changed.
Change-Id: Ia8c1d1f2dd450f0e48685e769ca925b8e6f5b57b
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/104882
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra3_dvfs.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra3_dvfs.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/arm/mach-tegra/tegra3_dvfs.c b/arch/arm/mach-tegra/tegra3_dvfs.c index 1108f4780cdc..6b1f659e7e72 100644 --- a/arch/arm/mach-tegra/tegra3_dvfs.c +++ b/arch/arm/mach-tegra/tegra3_dvfs.c @@ -352,6 +352,8 @@ static struct dvfs core_dvfs_table[] = { CORE_DVFS("spdif_out", -1, 1, KHZ, 1, 26000, 26000, 26000, 26000, 26000, 26000, 26000, 26000), }; +/* CPU alternative DVFS table for cold zone */ +static unsigned long cpu_cold_freqs[MAX_DVFS_FREQS]; int tegra_dvfs_disable_core_set(const char *arg, const struct kernel_param *kp) { @@ -473,19 +475,18 @@ static void __init init_dvfs_cold(struct dvfs *d, int nominal_mv_index) for (i = 0; i < d->num_freqs; i++) { offs = cpu_cold_offs_mhz[i] * MHZ; if (i > nominal_mv_index) - d->alt_freqs[i] = d->alt_freqs[i - 1]; + cpu_cold_freqs[i] = cpu_cold_freqs[i - 1]; else if (d->freqs[i] > offs) - d->alt_freqs[i] = d->freqs[i] - offs; + cpu_cold_freqs[i] = d->freqs[i] - offs; else { - d->alt_freqs[i] = d->freqs[i]; + cpu_cold_freqs[i] = d->freqs[i]; pr_warn("tegra3_dvfs: cold offset %lu is too high for" " regular dvfs limit %lu\n", offs, d->freqs[i]); } if (i) - BUG_ON(d->alt_freqs[i] < d->alt_freqs[i - 1]); + BUG_ON(cpu_cold_freqs[i] < cpu_cold_freqs[i - 1]); } - d->alt_freqs_state = ALT_FREQS_DISABLED; } static bool __init match_dvfs_one(struct dvfs *d, int speedo_id, int process_id) @@ -664,10 +665,11 @@ void __init tegra3_init_dvfs(void) void tegra_cpu_dvfs_alter(int edp_thermal_index, bool before_clk_update) { - bool enable = !edp_thermal_index; + bool cpu_warm = !!edp_thermal_index; + unsigned long *alt_freqs = cpu_warm ? NULL : cpu_cold_freqs; - if (enable != before_clk_update) { - int ret = tegra_dvfs_alt_freqs_set(cpu_dvfs, enable); + if (cpu_warm == before_clk_update) { + int ret = tegra_dvfs_alt_freqs_set(cpu_dvfs, alt_freqs); WARN_ONCE(ret, "tegra dvfs: failed to set CPU alternative" " frequency limits for cold temeperature\n"); } |