From 4b38963bc60b83d09b40be5d3aa93151d5d57302 Mon Sep 17 00:00:00 2001 From: Vladimir Razgulin Date: Thu, 7 Nov 2013 11:15:48 -0700 Subject: [PATCH] PM / devfreq: Add a new target flag for the performance governor The new flag for the devfreq profile->target() function is used by the performance governor to notify the driver that the device should wakeup on the max frequency. Change-Id: I91c2d649177bdd1841a087a2125d1cdbc979f5c1 Signed-off-by: Vladimir Razgulin --- drivers/devfreq/governor_performance.c | 21 +++++++++++++++++---- include/linux/devfreq.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/devfreq/governor_performance.c b/drivers/devfreq/governor_performance.c index af2edc2bf48..74ae3bb277c 100644 --- a/drivers/devfreq/governor_performance.c +++ b/drivers/devfreq/governor_performance.c @@ -32,13 +32,26 @@ static int devfreq_performance_handler(struct devfreq *devfreq, unsigned int event, void *data) { int ret = 0; + unsigned long freq; - if (event == DEVFREQ_GOV_START || event == DEVFREQ_GOV_RESUME) { - mutex_lock(&devfreq->lock); + mutex_lock(&devfreq->lock); + freq = devfreq->previous_freq; + switch (event) { + case DEVFREQ_GOV_START: + devfreq->profile->target(devfreq->dev.parent, + &freq, + DEVFREQ_FLAG_WAKEUP_MAXFREQ); + /* fall through */ + case DEVFREQ_GOV_RESUME: ret = update_devfreq(devfreq); - mutex_unlock(&devfreq->lock); + break; + case DEVFREQ_GOV_SUSPEND: + devfreq->profile->target(devfreq->dev.parent, + &freq, + DEVFREQ_FLAG_WAKEUP_MAXFREQ); + break; } - + mutex_unlock(&devfreq->lock); return ret; } diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d00847aa919..c65599edac4 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -51,6 +51,7 @@ struct devfreq_dev_status { * bound (greatest lower bound) */ #define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1 +#define DEVFREQ_FLAG_WAKEUP_MAXFREQ 0x2 #define DEVFREQ_FLAG_FAST_HINT 0x2 #define DEVFREQ_FLAG_SLOW_HINT 0x4