diff options
author | Axel Haslam <axelhaslam@ti.com> | 2011-05-31 17:25:26 -0500 |
---|---|---|
committer | Nishanth Menon <nm@ti.com> | 2011-06-13 16:37:49 -0500 |
commit | c246ceeb1eb438b8efb89444a2f7c770380c495a (patch) | |
tree | 3bfe552924a80acf4b3b91bf55e657e02f2393d1 | |
parent | 2fa9fd43c1cd4cfe6ab254acfa58de48765c61f2 (diff) | |
download | kernel_samsung_espresso10-c246ceeb1eb438b8efb89444a2f7c770380c495a.zip kernel_samsung_espresso10-c246ceeb1eb438b8efb89444a2f7c770380c495a.tar.gz kernel_samsung_espresso10-c246ceeb1eb438b8efb89444a2f7c770380c495a.tar.bz2 |
OMAP-PM: add API to set min mpu freq.
add the api omap_pm_set_min_mpu_freq
which will restrict the mpu freq to a particular
rate.
Signed-off-by: Axel Haslam <axelhaslam@ti.com>
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap-pm.h | 9 | ||||
-rw-r--r-- | arch/arm/plat-omap/omap-pm.c | 34 |
2 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h index a588ec8..94b4a51 100644 --- a/arch/arm/plat-omap/include/plat/omap-pm.h +++ b/arch/arm/plat-omap/include/plat/omap-pm.h @@ -359,6 +359,15 @@ unsigned long omap_pm_cpu_get_freq(void); */ int omap_pm_get_dev_context_loss_count(struct device *dev); + +/** + * omap_pm_set_min_mpu_freq - sets the min frequency the mpu should be allowed + * to run. The function works with a granularity of 1000000. Any frequency requested, + * will set the mpu frequency to the closet higher frequency that can match the request. + * to release the constraint, the f parameter should be passed as -1. + */ +int omap_pm_set_min_mpu_freq(struct device *dev, unsigned long f); + void omap_pm_enable_off_mode(void); void omap_pm_disable_off_mode(void); diff --git a/arch/arm/plat-omap/omap-pm.c b/arch/arm/plat-omap/omap-pm.c index 9e00fca..ec22f37 100644 --- a/arch/arm/plat-omap/omap-pm.c +++ b/arch/arm/plat-omap/omap-pm.c @@ -32,6 +32,7 @@ struct omap_opp *mpu_opps; struct omap_opp *l3_opps; static DEFINE_MUTEX(bus_tput_mutex); +static DEFINE_MUTEX(mpu_tput_mutex); /* Used to model a Interconnect Throughput */ static struct interconnect_tput { @@ -44,6 +45,7 @@ static struct interconnect_tput { struct mutex throughput_mutex; /* Target level for interconnect throughput */ unsigned long target_level; + } *bus_tput; /* Used to represent a user of a interconnect throughput */ @@ -554,4 +556,36 @@ void omap_pm_if_exit(void) /* Deallocate CPUFreq frequency table here */ } +int omap_pm_set_min_mpu_freq(struct device *dev, unsigned long f) +{ + + int ret = 0; + struct device *mpu_dev; + if (!dev) { + WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); + return -EINVAL; + } + + mutex_lock(&mpu_tput_mutex); + + mpu_dev = omap2_get_mpuss_device(); + if (!mpu_dev) { + pr_err("Unable to get MPU device pointer"); + ret = -EINVAL; + goto unlock; + } + + + /* Rescale the frequency if a change is detected with + * the new constraint. + */ + ret = omap_device_set_rate(dev, mpu_dev, f); + if (ret) + pr_err("Unable to set MPU frequency to %ld\n", f); + +unlock: + mutex_unlock(&mpu_tput_mutex); + return ret; +} +EXPORT_SYMBOL(omap_pm_set_min_mpu_freq); |