diff options
author | Rajagopal Venkat <rajagopal.venkat@linaro.org> | 2012-10-25 19:50:18 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-14 18:35:04 -0500 |
commit | 206c30cfeb7c05dfb9fdfd81b1deb933627e43c1 (patch) | |
tree | 0cc26302a81b78cf7d790e0483d2734753cf3d04 /drivers | |
parent | 7e6fdd4bad033fa2d73716377b184fa975b0d985 (diff) |
PM / devfreq: Add suspend and resume apis
Add devfreq suspend/resume apis for devfreq users. This patch
supports suspend and resume of devfreq load monitoring, required
for devices which can idle.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/devfreq/devfreq.c | 28 | ||||
-rw-r--r-- | drivers/devfreq/governor.h | 2 | ||||
-rw-r--r-- | drivers/devfreq/governor_simpleondemand.c | 9 |
3 files changed, 39 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 1aaf1aeb1f1d..999600da21c7 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -427,6 +427,34 @@ int devfreq_remove_device(struct devfreq *devfreq) | |||
427 | } | 427 | } |
428 | EXPORT_SYMBOL(devfreq_remove_device); | 428 | EXPORT_SYMBOL(devfreq_remove_device); |
429 | 429 | ||
430 | /** | ||
431 | * devfreq_suspend_device() - Suspend devfreq of a device. | ||
432 | * @devfreq: the devfreq instance to be suspended | ||
433 | */ | ||
434 | int devfreq_suspend_device(struct devfreq *devfreq) | ||
435 | { | ||
436 | if (!devfreq) | ||
437 | return -EINVAL; | ||
438 | |||
439 | return devfreq->governor->event_handler(devfreq, | ||
440 | DEVFREQ_GOV_SUSPEND, NULL); | ||
441 | } | ||
442 | EXPORT_SYMBOL(devfreq_suspend_device); | ||
443 | |||
444 | /** | ||
445 | * devfreq_resume_device() - Resume devfreq of a device. | ||
446 | * @devfreq: the devfreq instance to be resumed | ||
447 | */ | ||
448 | int devfreq_resume_device(struct devfreq *devfreq) | ||
449 | { | ||
450 | if (!devfreq) | ||
451 | return -EINVAL; | ||
452 | |||
453 | return devfreq->governor->event_handler(devfreq, | ||
454 | DEVFREQ_GOV_RESUME, NULL); | ||
455 | } | ||
456 | EXPORT_SYMBOL(devfreq_resume_device); | ||
457 | |||
430 | static ssize_t show_governor(struct device *dev, | 458 | static ssize_t show_governor(struct device *dev, |
431 | struct device_attribute *attr, char *buf) | 459 | struct device_attribute *attr, char *buf) |
432 | { | 460 | { |
diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h index bb3aff32d627..26432ac0a398 100644 --- a/drivers/devfreq/governor.h +++ b/drivers/devfreq/governor.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #define DEVFREQ_GOV_START 0x1 | 22 | #define DEVFREQ_GOV_START 0x1 |
23 | #define DEVFREQ_GOV_STOP 0x2 | 23 | #define DEVFREQ_GOV_STOP 0x2 |
24 | #define DEVFREQ_GOV_INTERVAL 0x3 | 24 | #define DEVFREQ_GOV_INTERVAL 0x3 |
25 | #define DEVFREQ_GOV_SUSPEND 0x4 | ||
26 | #define DEVFREQ_GOV_RESUME 0x5 | ||
25 | 27 | ||
26 | /* Caution: devfreq->lock must be locked before calling update_devfreq */ | 28 | /* Caution: devfreq->lock must be locked before calling update_devfreq */ |
27 | extern int update_devfreq(struct devfreq *devfreq); | 29 | extern int update_devfreq(struct devfreq *devfreq); |
diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c index 3716a659122b..b5cf0fb24efe 100644 --- a/drivers/devfreq/governor_simpleondemand.c +++ b/drivers/devfreq/governor_simpleondemand.c | |||
@@ -104,6 +104,15 @@ static int devfreq_simple_ondemand_handler(struct devfreq *devfreq, | |||
104 | case DEVFREQ_GOV_INTERVAL: | 104 | case DEVFREQ_GOV_INTERVAL: |
105 | devfreq_interval_update(devfreq, (unsigned int *)data); | 105 | devfreq_interval_update(devfreq, (unsigned int *)data); |
106 | break; | 106 | break; |
107 | |||
108 | case DEVFREQ_GOV_SUSPEND: | ||
109 | devfreq_monitor_suspend(devfreq); | ||
110 | break; | ||
111 | |||
112 | case DEVFREQ_GOV_RESUME: | ||
113 | devfreq_monitor_resume(devfreq); | ||
114 | break; | ||
115 | |||
107 | default: | 116 | default: |
108 | break; | 117 | break; |
109 | } | 118 | } |