diff options
author | Rajagopal Venkat <rajagopal.venkat@linaro.org> | 2013-01-08 00:50:39 -0500 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2013-06-03 07:20:29 -0400 |
commit | 39688ce6facd63de796def41a0b9012882b5cc14 (patch) | |
tree | ea8d71c2309912f01575130fc8593b35062ca470 /drivers/devfreq | |
parent | 6ccce69955c1bf2973bdec0d023685401de543f4 (diff) |
PM / devfreq: account suspend/resume for stats
devfreq stats is not taking device suspend and resume into
account. Fix it.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/devfreq.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 3b367973a802..abfa14dd8b4c 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -271,6 +271,7 @@ void devfreq_monitor_suspend(struct devfreq *devfreq) | |||
271 | return; | 271 | return; |
272 | } | 272 | } |
273 | 273 | ||
274 | devfreq_update_status(devfreq, devfreq->previous_freq); | ||
274 | devfreq->stop_polling = true; | 275 | devfreq->stop_polling = true; |
275 | mutex_unlock(&devfreq->lock); | 276 | mutex_unlock(&devfreq->lock); |
276 | cancel_delayed_work_sync(&devfreq->work); | 277 | cancel_delayed_work_sync(&devfreq->work); |
@@ -287,6 +288,8 @@ EXPORT_SYMBOL(devfreq_monitor_suspend); | |||
287 | */ | 288 | */ |
288 | void devfreq_monitor_resume(struct devfreq *devfreq) | 289 | void devfreq_monitor_resume(struct devfreq *devfreq) |
289 | { | 290 | { |
291 | unsigned long freq; | ||
292 | |||
290 | mutex_lock(&devfreq->lock); | 293 | mutex_lock(&devfreq->lock); |
291 | if (!devfreq->stop_polling) | 294 | if (!devfreq->stop_polling) |
292 | goto out; | 295 | goto out; |
@@ -295,8 +298,14 @@ void devfreq_monitor_resume(struct devfreq *devfreq) | |||
295 | devfreq->profile->polling_ms) | 298 | devfreq->profile->polling_ms) |
296 | queue_delayed_work(devfreq_wq, &devfreq->work, | 299 | queue_delayed_work(devfreq_wq, &devfreq->work, |
297 | msecs_to_jiffies(devfreq->profile->polling_ms)); | 300 | msecs_to_jiffies(devfreq->profile->polling_ms)); |
301 | |||
302 | devfreq->last_stat_updated = jiffies; | ||
298 | devfreq->stop_polling = false; | 303 | devfreq->stop_polling = false; |
299 | 304 | ||
305 | if (devfreq->profile->get_cur_freq && | ||
306 | !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) | ||
307 | devfreq->previous_freq = freq; | ||
308 | |||
300 | out: | 309 | out: |
301 | mutex_unlock(&devfreq->lock); | 310 | mutex_unlock(&devfreq->lock); |
302 | } | 311 | } |
@@ -905,11 +914,11 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att | |||
905 | { | 914 | { |
906 | struct devfreq *devfreq = to_devfreq(dev); | 915 | struct devfreq *devfreq = to_devfreq(dev); |
907 | ssize_t len; | 916 | ssize_t len; |
908 | int i, j, err; | 917 | int i, j; |
909 | unsigned int max_state = devfreq->profile->max_state; | 918 | unsigned int max_state = devfreq->profile->max_state; |
910 | 919 | ||
911 | err = devfreq_update_status(devfreq, devfreq->previous_freq); | 920 | if (!devfreq->stop_polling && |
912 | if (err) | 921 | devfreq_update_status(devfreq, devfreq->previous_freq)) |
913 | return 0; | 922 | return 0; |
914 | 923 | ||
915 | len = sprintf(buf, " From : To\n"); | 924 | len = sprintf(buf, " From : To\n"); |