diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 4 | ||||
| -rw-r--r-- | include/linux/pm.h | 10 | ||||
| -rw-r--r-- | include/linux/pm_domain.h | 108 | ||||
| -rw-r--r-- | include/linux/pm_runtime.h | 32 |
4 files changed, 134 insertions, 20 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index e4f62d8896b7..160d4ddb2499 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -516,7 +516,7 @@ struct device_dma_parameters { | |||
| 516 | * minimizes board-specific #ifdefs in drivers. | 516 | * minimizes board-specific #ifdefs in drivers. |
| 517 | * @power: For device power management. | 517 | * @power: For device power management. |
| 518 | * See Documentation/power/devices.txt for details. | 518 | * See Documentation/power/devices.txt for details. |
| 519 | * @pwr_domain: Provide callbacks that are executed during system suspend, | 519 | * @pm_domain: Provide callbacks that are executed during system suspend, |
| 520 | * hibernation, system resume and during runtime PM transitions | 520 | * hibernation, system resume and during runtime PM transitions |
| 521 | * along with subsystem-level and driver-level callbacks. | 521 | * along with subsystem-level and driver-level callbacks. |
| 522 | * @numa_node: NUMA node this device is close to. | 522 | * @numa_node: NUMA node this device is close to. |
| @@ -567,7 +567,7 @@ struct device { | |||
| 567 | void *platform_data; /* Platform specific data, device | 567 | void *platform_data; /* Platform specific data, device |
| 568 | core doesn't touch it */ | 568 | core doesn't touch it */ |
| 569 | struct dev_pm_info power; | 569 | struct dev_pm_info power; |
| 570 | struct dev_power_domain *pwr_domain; | 570 | struct dev_pm_domain *pm_domain; |
| 571 | 571 | ||
| 572 | #ifdef CONFIG_NUMA | 572 | #ifdef CONFIG_NUMA |
| 573 | int numa_node; /* NUMA node this device is close to */ | 573 | int numa_node; /* NUMA node this device is close to */ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 411e4f4be52b..f7c84c9abd30 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -461,8 +461,8 @@ struct dev_pm_info { | |||
| 461 | unsigned long active_jiffies; | 461 | unsigned long active_jiffies; |
| 462 | unsigned long suspended_jiffies; | 462 | unsigned long suspended_jiffies; |
| 463 | unsigned long accounting_timestamp; | 463 | unsigned long accounting_timestamp; |
| 464 | void *subsys_data; /* Owned by the subsystem. */ | ||
| 465 | #endif | 464 | #endif |
| 465 | void *subsys_data; /* Owned by the subsystem. */ | ||
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | extern void update_pm_runtime_accounting(struct device *dev); | 468 | extern void update_pm_runtime_accounting(struct device *dev); |
| @@ -472,7 +472,7 @@ extern void update_pm_runtime_accounting(struct device *dev); | |||
| 472 | * hibernation, system resume and during runtime PM transitions along with | 472 | * hibernation, system resume and during runtime PM transitions along with |
| 473 | * subsystem-level and driver-level callbacks. | 473 | * subsystem-level and driver-level callbacks. |
| 474 | */ | 474 | */ |
| 475 | struct dev_power_domain { | 475 | struct dev_pm_domain { |
| 476 | struct dev_pm_ops ops; | 476 | struct dev_pm_ops ops; |
| 477 | }; | 477 | }; |
| 478 | 478 | ||
| @@ -553,11 +553,17 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
| 553 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); | 553 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); |
| 554 | 554 | ||
| 555 | extern int pm_generic_prepare(struct device *dev); | 555 | extern int pm_generic_prepare(struct device *dev); |
| 556 | extern int pm_generic_suspend_noirq(struct device *dev); | ||
| 556 | extern int pm_generic_suspend(struct device *dev); | 557 | extern int pm_generic_suspend(struct device *dev); |
| 558 | extern int pm_generic_resume_noirq(struct device *dev); | ||
| 557 | extern int pm_generic_resume(struct device *dev); | 559 | extern int pm_generic_resume(struct device *dev); |
| 560 | extern int pm_generic_freeze_noirq(struct device *dev); | ||
| 558 | extern int pm_generic_freeze(struct device *dev); | 561 | extern int pm_generic_freeze(struct device *dev); |
| 562 | extern int pm_generic_thaw_noirq(struct device *dev); | ||
| 559 | extern int pm_generic_thaw(struct device *dev); | 563 | extern int pm_generic_thaw(struct device *dev); |
| 564 | extern int pm_generic_restore_noirq(struct device *dev); | ||
| 560 | extern int pm_generic_restore(struct device *dev); | 565 | extern int pm_generic_restore(struct device *dev); |
| 566 | extern int pm_generic_poweroff_noirq(struct device *dev); | ||
| 561 | extern int pm_generic_poweroff(struct device *dev); | 567 | extern int pm_generic_poweroff(struct device *dev); |
| 562 | extern void pm_generic_complete(struct device *dev); | 568 | extern void pm_generic_complete(struct device *dev); |
| 563 | 569 | ||
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h new file mode 100644 index 000000000000..21097cb086fe --- /dev/null +++ b/include/linux/pm_domain.h | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | /* | ||
| 2 | * pm_domain.h - Definitions and headers related to device power domains. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _LINUX_PM_DOMAIN_H | ||
| 10 | #define _LINUX_PM_DOMAIN_H | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | |||
| 14 | enum gpd_status { | ||
| 15 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ | ||
| 16 | GPD_STATE_BUSY, /* Something is happening to the PM domain */ | ||
| 17 | GPD_STATE_REPEAT, /* Power off in progress, to be repeated */ | ||
| 18 | GPD_STATE_POWER_OFF, /* PM domain is off */ | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct dev_power_governor { | ||
| 22 | bool (*power_down_ok)(struct dev_pm_domain *domain); | ||
| 23 | }; | ||
| 24 | |||
| 25 | struct generic_pm_domain { | ||
| 26 | struct dev_pm_domain domain; /* PM domain operations */ | ||
| 27 | struct list_head gpd_list_node; /* Node in the global PM domains list */ | ||
| 28 | struct list_head sd_node; /* Node in the parent's subdomain list */ | ||
| 29 | struct generic_pm_domain *parent; /* Parent PM domain */ | ||
| 30 | struct list_head sd_list; /* List of dubdomains */ | ||
| 31 | struct list_head dev_list; /* List of devices */ | ||
| 32 | struct mutex lock; | ||
| 33 | struct dev_power_governor *gov; | ||
| 34 | struct work_struct power_off_work; | ||
| 35 | unsigned int in_progress; /* Number of devices being suspended now */ | ||
| 36 | unsigned int sd_count; /* Number of subdomains with power "on" */ | ||
| 37 | enum gpd_status status; /* Current state of the domain */ | ||
| 38 | wait_queue_head_t status_wait_queue; | ||
| 39 | struct task_struct *poweroff_task; /* Powering off task */ | ||
| 40 | unsigned int resume_count; /* Number of devices being resumed */ | ||
| 41 | unsigned int device_count; /* Number of devices */ | ||
| 42 | unsigned int suspended_count; /* System suspend device counter */ | ||
| 43 | unsigned int prepared_count; /* Suspend counter of prepared devices */ | ||
| 44 | bool suspend_power_off; /* Power status before system suspend */ | ||
| 45 | int (*power_off)(struct generic_pm_domain *domain); | ||
| 46 | int (*power_on)(struct generic_pm_domain *domain); | ||
| 47 | int (*start_device)(struct device *dev); | ||
| 48 | int (*stop_device)(struct device *dev); | ||
| 49 | bool (*active_wakeup)(struct device *dev); | ||
| 50 | }; | ||
| 51 | |||
| 52 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) | ||
| 53 | { | ||
| 54 | return container_of(pd, struct generic_pm_domain, domain); | ||
| 55 | } | ||
| 56 | |||
| 57 | struct dev_list_entry { | ||
| 58 | struct list_head node; | ||
| 59 | struct device *dev; | ||
| 60 | bool need_restore; | ||
| 61 | }; | ||
| 62 | |||
| 63 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
| 64 | extern int pm_genpd_add_device(struct generic_pm_domain *genpd, | ||
| 65 | struct device *dev); | ||
| 66 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, | ||
| 67 | struct device *dev); | ||
| 68 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | ||
| 69 | struct generic_pm_domain *new_subdomain); | ||
| 70 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | ||
| 71 | struct generic_pm_domain *target); | ||
| 72 | extern void pm_genpd_init(struct generic_pm_domain *genpd, | ||
| 73 | struct dev_power_governor *gov, bool is_off); | ||
| 74 | extern int pm_genpd_poweron(struct generic_pm_domain *genpd); | ||
| 75 | extern void pm_genpd_poweroff_unused(void); | ||
| 76 | extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); | ||
| 77 | #else | ||
| 78 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, | ||
| 79 | struct device *dev) | ||
| 80 | { | ||
| 81 | return -ENOSYS; | ||
| 82 | } | ||
| 83 | static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, | ||
| 84 | struct device *dev) | ||
| 85 | { | ||
| 86 | return -ENOSYS; | ||
| 87 | } | ||
| 88 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | ||
| 89 | struct generic_pm_domain *new_sd) | ||
| 90 | { | ||
| 91 | return -ENOSYS; | ||
| 92 | } | ||
| 93 | static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | ||
| 94 | struct generic_pm_domain *target) | ||
| 95 | { | ||
| 96 | return -ENOSYS; | ||
| 97 | } | ||
| 98 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, | ||
| 99 | struct dev_power_governor *gov, bool is_off) {} | ||
| 100 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) | ||
| 101 | { | ||
| 102 | return -ENOSYS; | ||
| 103 | } | ||
| 104 | static inline void pm_genpd_poweroff_unused(void) {} | ||
| 105 | static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {} | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #endif /* _LINUX_PM_DOMAIN_H */ | ||
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 878cf84baeb1..dfb8539ed686 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -247,41 +247,41 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev) | |||
| 247 | 247 | ||
| 248 | struct pm_clk_notifier_block { | 248 | struct pm_clk_notifier_block { |
| 249 | struct notifier_block nb; | 249 | struct notifier_block nb; |
| 250 | struct dev_power_domain *pwr_domain; | 250 | |
