diff options
| -rw-r--r-- | drivers/devfreq/devfreq.c | 44 | ||||
| -rw-r--r-- | include/linux/devfreq.h | 6 |
2 files changed, 50 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) | |||
| 935 | EXPORT_SYMBOL(devfreq_resume_device); | 935 | EXPORT_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 | */ | ||
| 945 | void 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 | */ | ||
| 966 | void 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 | */ |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d98519996927..fbffa74bfc1b 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
| @@ -205,6 +205,9 @@ extern void devm_devfreq_remove_device(struct device *dev, | |||
| 205 | extern int devfreq_suspend_device(struct devfreq *devfreq); | 205 | extern int devfreq_suspend_device(struct devfreq *devfreq); |
| 206 | extern int devfreq_resume_device(struct devfreq *devfreq); | 206 | extern int devfreq_resume_device(struct devfreq *devfreq); |
| 207 | 207 | ||
| 208 | extern void devfreq_suspend(void); | ||
| 209 | extern void devfreq_resume(void); | ||
| 210 | |||
| 208 | /** | 211 | /** |
| 209 | * update_devfreq() - Reevaluate the device and configure frequency | 212 | * update_devfreq() - Reevaluate the device and configure frequency |
| 210 | * @devfreq: the devfreq device | 213 | * @devfreq: the devfreq device |
| @@ -331,6 +334,9 @@ static inline int devfreq_resume_device(struct devfreq *devfreq) | |||
| 331 | return 0; | 334 | return 0; |
| 332 | } | 335 | } |
| 333 | 336 | ||
| 337 | static inline void devfreq_suspend(void) {} | ||
| 338 | static inline void devfreq_resume(void) {} | ||
| 339 | |||
| 334 | static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, | 340 | static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, |
| 335 | unsigned long *freq, u32 flags) | 341 | unsigned long *freq, u32 flags) |
| 336 | { | 342 | { |
