summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/dvfs.c
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2012-05-26 20:12:01 -0700
committerSimone Willett <swillett@nvidia.com>2012-06-07 12:56:02 -0700
commitcc87e66730f603e339476619818d7b30906a172a (patch)
tree5211271034a156c5a4c53eee27f8f743ab59afc0 /arch/arm/mach-tegra/dvfs.c
parent25c3334f0e1ea6bde84c0514bad0eb1859566dba (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/dvfs.c')
-rw-r--r--arch/arm/mach-tegra/dvfs.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/arch/arm/mach-tegra/dvfs.c b/arch/arm/mach-tegra/dvfs.c
index 8723e6fa60df..cb33e3db862f 100644
--- a/arch/arm/mach-tegra/dvfs.c
+++ b/arch/arm/mach-tegra/dvfs.c
@@ -322,8 +322,7 @@ static int dvfs_rail_connect_to_regulator(struct dvfs_rail *rail)
static inline unsigned long *dvfs_get_freqs(struct dvfs *d)
{
- return (d->alt_freqs_state == ALT_FREQS_ENABLED) ?
- &d->alt_freqs[0] : &d->freqs[0];
+ return d->alt_freqs ? : &d->freqs[0];
}
static int
@@ -367,26 +366,16 @@ __tegra_dvfs_set_rate(struct dvfs *d, unsigned long rate)
return ret;
}
-static inline int dvfs_alt_freqs_set(struct dvfs *d, bool enable)
+int tegra_dvfs_alt_freqs_set(struct dvfs *d, unsigned long *alt_freqs)
{
- if (d->alt_freqs_state == ALT_FREQS_NOT_SUPPORTED)
- return -ENOSYS;
-
- d->alt_freqs_state = enable ? ALT_FREQS_ENABLED : ALT_FREQS_DISABLED;
- return 0;
-}
-
-int tegra_dvfs_alt_freqs_set(struct dvfs *d, bool enable)
-{
- int ret;
- enum dvfs_alt_freqs old_state;
+ int ret = 0;
mutex_lock(&dvfs_lock);
- old_state = d->alt_freqs_state;
- ret = dvfs_alt_freqs_set(d, enable);
- if (!ret && (old_state != d->alt_freqs_state))
+ if (d->alt_freqs != alt_freqs) {
+ d->alt_freqs = alt_freqs;
ret = __tegra_dvfs_set_rate(d, d->cur_rate);
+ }
mutex_unlock(&dvfs_lock);
return ret;
@@ -407,7 +396,7 @@ int tegra_dvfs_predict_millivolts(struct clk *c, unsigned long rate)
* frequency limits. For now, just fail the call for clock that has
* alternative limits initialized.
*/
- if (c->dvfs->alt_freqs_state != ALT_FREQS_NOT_SUPPORTED)
+ if (c->dvfs->alt_freqs)
return -ENOSYS;
for (i = 0; i < c->dvfs->num_freqs; i++) {