diff options
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r-- | drivers/devfreq/devfreq.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 3b367973a802..e94e619fe050 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 | } |
@@ -477,7 +486,7 @@ struct devfreq *devfreq_add_device(struct device *dev, | |||
477 | GFP_KERNEL); | 486 | GFP_KERNEL); |
478 | devfreq->last_stat_updated = jiffies; | 487 | devfreq->last_stat_updated = jiffies; |
479 | 488 | ||
480 | dev_set_name(&devfreq->dev, dev_name(dev)); | 489 | dev_set_name(&devfreq->dev, "%s", dev_name(dev)); |
481 | err = device_register(&devfreq->dev); | 490 | err = device_register(&devfreq->dev); |
482 | if (err) { | 491 | if (err) { |
483 | put_device(&devfreq->dev); | 492 | put_device(&devfreq->dev); |
@@ -518,6 +527,8 @@ EXPORT_SYMBOL(devfreq_add_device); | |||
518 | /** | 527 | /** |
519 | * devfreq_remove_device() - Remove devfreq feature from a device. | 528 | * devfreq_remove_device() - Remove devfreq feature from a device. |
520 | * @devfreq: the devfreq instance to be removed | 529 | * @devfreq: the devfreq instance to be removed |
530 | * | ||
531 | * The opposite of devfreq_add_device(). | ||
521 | */ | 532 | */ |
522 | int devfreq_remove_device(struct devfreq *devfreq) | 533 | int devfreq_remove_device(struct devfreq *devfreq) |
523 | { | 534 | { |
@@ -533,6 +544,10 @@ EXPORT_SYMBOL(devfreq_remove_device); | |||
533 | /** | 544 | /** |
534 | * devfreq_suspend_device() - Suspend devfreq of a device. | 545 | * devfreq_suspend_device() - Suspend devfreq of a device. |
535 | * @devfreq: the devfreq instance to be suspended | 546 | * @devfreq: the devfreq instance to be suspended |
547 | * | ||
548 | * This function is intended to be called by the pm callbacks | ||
549 | * (e.g., runtime_suspend, suspend) of the device driver that | ||
550 | * holds the devfreq. | ||
536 | */ | 551 | */ |
537 | int devfreq_suspend_device(struct devfreq *devfreq) | 552 | int devfreq_suspend_device(struct devfreq *devfreq) |
538 | { | 553 | { |
@@ -550,6 +565,10 @@ EXPORT_SYMBOL(devfreq_suspend_device); | |||
550 | /** | 565 | /** |
551 | * devfreq_resume_device() - Resume devfreq of a device. | 566 | * devfreq_resume_device() - Resume devfreq of a device. |
552 | * @devfreq: the devfreq instance to be resumed | 567 | * @devfreq: the devfreq instance to be resumed |
568 | * | ||
569 | * This function is intended to be called by the pm callbacks | ||
570 | * (e.g., runtime_resume, resume) of the device driver that | ||
571 | * holds the devfreq. | ||
553 | */ | 572 | */ |
554 | int devfreq_resume_device(struct devfreq *devfreq) | 573 | int devfreq_resume_device(struct devfreq *devfreq) |
555 | { | 574 | { |
@@ -905,11 +924,11 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att | |||
905 | { | 924 | { |
906 | struct devfreq *devfreq = to_devfreq(dev); | 925 | struct devfreq *devfreq = to_devfreq(dev); |
907 | ssize_t len; | 926 | ssize_t len; |
908 | int i, j, err; | 927 | int i, j; |
909 | unsigned int max_state = devfreq->profile->max_state; | 928 | unsigned int max_state = devfreq->profile->max_state; |
910 | 929 | ||
911 | err = devfreq_update_status(devfreq, devfreq->previous_freq); | 930 | if (!devfreq->stop_polling && |
912 | if (err) | 931 | devfreq_update_status(devfreq, devfreq->previous_freq)) |
913 | return 0; | 932 | return 0; |
914 | 933 | ||
915 | len = sprintf(buf, " From : To\n"); | 934 | len = sprintf(buf, " From : To\n"); |