aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
authorLukasz Luba <l.luba@partner.samsung.com>2018-12-05 06:05:54 -0500
committerMyungJoo Ham <myungjoo.ham@samsung.com>2018-12-10 21:40:13 -0500
commit5903195605287681f55094bbcdf8711ea109969b (patch)
treed86178f405d858f69b909b24bb66d40f0e8e4c38 /drivers/devfreq/devfreq.c
parent83f8ca45afbf041e312909f442128b99657d90b7 (diff)
PM / devfreq: add devfreq_suspend/resume() functions
This patch adds implementation for global suspend/resume for devfreq framework. System suspend will next use these functions. Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Suggested-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 46517b61b3a2..0ae3de76833b 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -935,6 +935,50 @@ int devfreq_resume_device(struct devfreq *devfreq)
935EXPORT_SYMBOL(devfreq_resume_device); 935EXPORT_SYMBOL(devfreq_resume_device);
936 936
937/** 937/**
938 * devfreq_suspend() - Suspend devfreq governors and devices
939 *
940 * Called during system wide Suspend/Hibernate cycles for suspending governors
941 * and devices preserving the state for resume. On some platforms the devfreq
942 * device must have precise state (frequency) after resume in order to provide
943 * fully operating setup.
944 */
945void devfreq_suspend(void)
946{
947 struct devfreq *devfreq;
948 int ret;
949
950 mutex_lock(&devfreq_list_lock);
951 list_for_each_entry(devfreq, &devfreq_list, node) {
952 ret = devfreq_suspend_device(devfreq);
953 if (ret)
954 dev_err(&devfreq->dev,
955 "failed to suspend devfreq device\n");
956 }
957 mutex_unlock(&devfreq_list_lock);
958}
959
960/**
961 * devfreq_resume() - Resume devfreq governors and devices
962 *
963 * Called during system wide Suspend/Hibernate cycle for resuming governors and
964 * devices that are suspended with devfreq_suspend().
965 */
966void devfreq_resume(void)
967{
968 struct devfreq *devfreq;
969 int ret;
970
971 mutex_lock(&devfreq_list_lock);
972 list_for_each_entry(devfreq, &devfreq_list, node) {
973 ret = devfreq_resume_device(devfreq);
974 if (ret)
975 dev_warn(&devfreq->dev,
976 "failed to resume devfreq device\n");
977 }
978 mutex_unlock(&devfreq_list_lock);
979}
980
981/**
938 * devfreq_add_governor() - Add devfreq governor 982 * devfreq_add_governor() - Add devfreq governor
939 * @governor: the devfreq governor to be added 983 * @governor: the devfreq governor to be added
940 */ 984 */