Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 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> |
Paul Gortmaker | 313162d | 2012-01-30 11:46:54 -0500 | [diff] [blame] | 13 | #include <linux/mutex.h> |
| 14 | #include <linux/pm.h> |
Guennadi Liakhovetski | 4f042cd | 2011-12-01 00:05:31 +0100 | [diff] [blame] | 15 | #include <linux/err.h> |
Thomas Abraham | c8aa130 | 2012-01-27 15:22:07 +0900 | [diff] [blame] | 16 | #include <linux/of.h> |
Rafael J. Wysocki | 6ff7bb0d0 | 2012-05-01 21:34:07 +0200 | [diff] [blame] | 17 | #include <linux/notifier.h> |
Lina Iyer | d716f47 | 2016-10-14 10:47:55 -0700 | [diff] [blame] | 18 | #include <linux/spinlock.h> |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 19 | |
Ulf Hansson | c11f6f5 | 2014-12-01 12:50:21 +0100 | [diff] [blame] | 20 | /* Defines used for the flags field in the struct generic_pm_domain */ |
Geert Uytterhoeven | 95a20ef | 2017-11-07 13:48:11 +0100 | [diff] [blame] | 21 | #define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */ |
| 22 | #define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */ |
| 23 | #define GENPD_FLAG_ALWAYS_ON (1U << 2) /* PM domain is always powered on */ |
| 24 | #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) /* Keep devices active if wakeup */ |
Ulf Hansson | c11f6f5 | 2014-12-01 12:50:21 +0100 | [diff] [blame] | 25 | |
Rafael J. Wysocki | 17b75ec | 2011-07-12 00:39:29 +0200 | [diff] [blame] | 26 | enum gpd_status { |
| 27 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ |
Rafael J. Wysocki | 17b75ec | 2011-07-12 00:39:29 +0200 | [diff] [blame] | 28 | GPD_STATE_POWER_OFF, /* PM domain is off */ |
| 29 | }; |
Rafael J. Wysocki | 596ba34 | 2011-07-01 22:13:19 +0200 | [diff] [blame] | 30 | |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 31 | struct dev_power_governor { |
| 32 | bool (*power_down_ok)(struct dev_pm_domain *domain); |
Ulf Hansson | 9df3921 | 2016-03-31 11:21:25 +0200 | [diff] [blame] | 33 | bool (*suspend_ok)(struct device *dev); |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
Rafael J. Wysocki | d5e4cbf | 2011-11-27 13:11:36 +0100 | [diff] [blame] | 36 | struct gpd_dev_ops { |
| 37 | int (*start)(struct device *dev); |
| 38 | int (*stop)(struct device *dev); |
Rafael J. Wysocki | d5e4cbf | 2011-11-27 13:11:36 +0100 | [diff] [blame] | 39 | }; |
| 40 | |
Axel Haslam | fc5cbf0 | 2016-02-15 11:10:51 +0100 | [diff] [blame] | 41 | struct genpd_power_state { |
| 42 | s64 power_off_latency_ns; |
| 43 | s64 power_on_latency_ns; |
Lina Iyer | 405f722 | 2016-10-14 10:47:50 -0700 | [diff] [blame] | 44 | s64 residency_ns; |
Lina Iyer | 0c9b694 | 2016-10-14 10:47:52 -0700 | [diff] [blame] | 45 | struct fwnode_handle *fwnode; |
Thara Gopinath | afece3a | 2017-07-14 13:10:15 -0400 | [diff] [blame] | 46 | ktime_t idle_time; |
Axel Haslam | fc5cbf0 | 2016-02-15 11:10:51 +0100 | [diff] [blame] | 47 | }; |
| 48 | |
Lina Iyer | 35241d1 | 2016-10-14 10:47:54 -0700 | [diff] [blame] | 49 | struct genpd_lock_ops; |
Viresh Kumar | 6e41766 | 2017-11-29 15:21:51 +0530 | [diff] [blame] | 50 | struct dev_pm_opp; |
Lina Iyer | 35241d1 | 2016-10-14 10:47:54 -0700 | [diff] [blame] | 51 | |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 52 | struct generic_pm_domain { |
Viresh Kumar | 401ea15 | 2017-03-17 11:26:19 +0530 | [diff] [blame] | 53 | struct device dev; |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 54 | struct dev_pm_domain domain; /* PM domain operations */ |
Rafael J. Wysocki | 5125bbf38 | 2011-07-13 12:31:52 +0200 | [diff] [blame] | 55 | struct list_head gpd_list_node; /* Node in the global PM domains list */ |
Rafael J. Wysocki | 5063ce1 | 2011-08-08 23:43:40 +0200 | [diff] [blame] | 56 | struct list_head master_links; /* Links with PM domain as a master */ |
| 57 | struct list_head slave_links; /* Links with PM domain as a slave */ |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 58 | struct list_head dev_list; /* List of devices */ |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 59 | struct dev_power_governor *gov; |
| 60 | struct work_struct power_off_work; |
Jon Hunter | de0aa06d | 2016-09-12 12:01:12 +0100 | [diff] [blame] | 61 | struct fwnode_handle *provider; /* Identity of the domain provider */ |
| 62 | bool has_provider; |
Geert Uytterhoeven | d07e9c1 | 2014-08-29 15:13:21 +0200 | [diff] [blame] | 63 | const char *name; |
Rafael J. Wysocki | c4bb316 | 2011-08-08 23:43:04 +0200 | [diff] [blame] | 64 | atomic_t sd_count; /* Number of subdomains with power "on" */ |
Rafael J. Wysocki | 17b75ec | 2011-07-12 00:39:29 +0200 | [diff] [blame] | 65 | enum gpd_status status; /* Current state of the domain */ |
Rafael J. Wysocki | 596ba34 | 2011-07-01 22:13:19 +0200 | [diff] [blame] | 66 | unsigned int device_count; /* Number of devices */ |
| 67 | unsigned int suspended_count; /* System suspend device counter */ |
| 68 | unsigned int prepared_count; /* Suspend counter of prepared devices */ |
Viresh Kumar | 42f6284 | 2017-10-12 15:07:23 +0530 | [diff] [blame] | 69 | unsigned int performance_state; /* Aggregated max performance state */ |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 70 | int (*power_off)(struct generic_pm_domain *domain); |
| 71 | int (*power_on)(struct generic_pm_domain *domain); |
Viresh Kumar | 6e41766 | 2017-11-29 15:21:51 +0530 | [diff] [blame] | 72 | unsigned int (*opp_to_performance_state)(struct generic_pm_domain *genpd, |
| 73 | struct dev_pm_opp *opp); |
Viresh Kumar | 42f6284 | 2017-10-12 15:07:23 +0530 | [diff] [blame] | 74 | int (*set_performance_state)(struct generic_pm_domain *genpd, |
| 75 | unsigned int state); |
Rafael J. Wysocki | d5e4cbf | 2011-11-27 13:11:36 +0100 | [diff] [blame] | 76 | struct gpd_dev_ops dev_ops; |
Rafael J. Wysocki | 221e9b5 | 2011-12-01 00:02:10 +0100 | [diff] [blame] | 77 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ |
Rafael J. Wysocki | 6ff7bb0d0 | 2012-05-01 21:34:07 +0200 | [diff] [blame] | 78 | bool max_off_time_changed; |
| 79 | bool cached_power_down_ok; |
Ulf Hansson | c16561e | 2014-11-06 00:37:08 +0100 | [diff] [blame] | 80 | int (*attach_dev)(struct generic_pm_domain *domain, |
| 81 | struct device *dev); |
| 82 | void (*detach_dev)(struct generic_pm_domain *domain, |
| 83 | struct device *dev); |
Ulf Hansson | c11f6f5 | 2014-12-01 12:50:21 +0100 | [diff] [blame] | 84 | unsigned int flags; /* Bit field of configs for genpd */ |
Lina Iyer | 59d65b7 | 2016-10-14 10:47:49 -0700 | [diff] [blame] | 85 | struct genpd_power_state *states; |
Axel Haslam | fc5cbf0 | 2016-02-15 11:10:51 +0100 | [diff] [blame] | 86 | unsigned int state_count; /* number of states */ |
| 87 | unsigned int state_idx; /* state that genpd will go to when off */ |
Lina Iyer | 59d65b7 | 2016-10-14 10:47:49 -0700 | [diff] [blame] | 88 | void *free; /* Free the state that was allocated for default */ |
Thara Gopinath | afece3a | 2017-07-14 13:10:15 -0400 | [diff] [blame] | 89 | ktime_t on_time; |
| 90 | ktime_t accounting_time; |
Lina Iyer | 35241d1 | 2016-10-14 10:47:54 -0700 | [diff] [blame] | 91 | const struct genpd_lock_ops *lock_ops; |
Lina Iyer | d716f47 | 2016-10-14 10:47:55 -0700 | [diff] [blame] | 92 | union { |
| 93 | struct mutex mlock; |
| 94 | struct { |
| 95 | spinlock_t slock; |
| 96 | unsigned long lock_flags; |
| 97 | }; |
| 98 | }; |
Axel Haslam | fc5cbf0 | 2016-02-15 11:10:51 +0100 | [diff] [blame] | 99 | |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 100 | }; |
| 101 | |
Rafael J. Wysocki | 596ba34 | 2011-07-01 22:13:19 +0200 | [diff] [blame] | 102 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) |
| 103 | { |
| 104 | return container_of(pd, struct generic_pm_domain, domain); |
| 105 | } |
| 106 | |
Rafael J. Wysocki | 5063ce1 | 2011-08-08 23:43:40 +0200 | [diff] [blame] | 107 | struct gpd_link { |
| 108 | struct generic_pm_domain *master; |
| 109 | struct list_head master_node; |
| 110 | struct generic_pm_domain *slave; |
| 111 | struct list_head slave_node; |
| 112 | }; |
| 113 | |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 114 | struct gpd_timing_data { |
Ulf Hansson | 2b1d88c | 2015-10-15 17:02:19 +0200 | [diff] [blame] | 115 | s64 suspend_latency_ns; |
| 116 | s64 resume_latency_ns; |
Rafael J. Wysocki | a5bef810 | 2012-04-29 22:54:17 +0200 | [diff] [blame] | 117 | s64 effective_constraint_ns; |
Rafael J. Wysocki | 6ff7bb0d0 | 2012-05-01 21:34:07 +0200 | [diff] [blame] | 118 | bool constraint_changed; |
Ulf Hansson | 9df3921 | 2016-03-31 11:21:25 +0200 | [diff] [blame] | 119 | bool cached_suspend_ok; |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 120 | }; |
| 121 | |
Ulf Hansson | 00e7c29 | 2014-11-14 08:41:32 +0100 | [diff] [blame] | 122 | struct pm_domain_data { |
| 123 | struct list_head list_node; |
| 124 | struct device *dev; |
| 125 | }; |
| 126 | |
Rafael J. Wysocki | cd0ea67 | 2011-09-26 20:22:02 +0200 | [diff] [blame] | 127 | struct generic_pm_domain_data { |
| 128 | struct pm_domain_data base; |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 129 | struct gpd_timing_data td; |
Rafael J. Wysocki | 6ff7bb0d0 | 2012-05-01 21:34:07 +0200 | [diff] [blame] | 130 | struct notifier_block nb; |
Viresh Kumar | 42f6284 | 2017-10-12 15:07:23 +0530 | [diff] [blame] | 131 | unsigned int performance_state; |
Dave Gerlach | a5ea7a0 | 2017-04-04 08:51:29 -0700 | [diff] [blame] | 132 | void *data; |
Rafael J. Wysocki | cd0ea67 | 2011-09-26 20:22:02 +0200 | [diff] [blame] | 133 | }; |
| 134 | |
Guennadi Liakhovetski | 9b4f617b | 2012-02-04 22:26:49 +0100 | [diff] [blame] | 135 | #ifdef CONFIG_PM_GENERIC_DOMAINS |
Rafael J. Wysocki | cd0ea67 | 2011-09-26 20:22:02 +0200 | [diff] [blame] | 136 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) |
| 137 | { |
| 138 | return container_of(pdd, struct generic_pm_domain_data, base); |
| 139 | } |
| 140 | |
Rafael J. Wysocki | d5e4cbf | 2011-11-27 13:11:36 +0100 | [diff] [blame] | 141 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |
| 142 | { |
| 143 | return to_gpd_data(dev->power.subsys_data->domain_data); |
| 144 | } |
| 145 | |
Ulf Hansson | 1a7a670 | 2018-05-29 12:04:14 +0200 | [diff] [blame^] | 146 | int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev); |
Ulf Hansson | 781b9d6 | 2018-05-29 12:04:13 +0200 | [diff] [blame] | 147 | int pm_genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev); |
| 148 | int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
| 149 | struct generic_pm_domain *new_subdomain); |
| 150 | int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
| 151 | struct generic_pm_domain *target); |
| 152 | int pm_genpd_init(struct generic_pm_domain *genpd, |
| 153 | struct dev_power_governor *gov, bool is_off); |
| 154 | int pm_genpd_remove(struct generic_pm_domain *genpd); |
| 155 | int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state); |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 156 | |
Ulf Hansson | ae3c511 | 2014-09-03 12:52:31 +0200 | [diff] [blame] | 157 | extern struct dev_power_governor simple_qos_governor; |
Mark Brown | 925b44a | 2011-12-08 23:27:28 +0100 | [diff] [blame] | 158 | extern struct dev_power_governor pm_domain_always_on_gov; |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 159 | #else |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 160 | |
Magnus Damm | b642631 | 2012-02-25 22:14:18 +0100 | [diff] [blame] | 161 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |
| 162 | { |
| 163 | return ERR_PTR(-ENOSYS); |
| 164 | } |
Ulf Hansson | 1a7a670 | 2018-05-29 12:04:14 +0200 | [diff] [blame^] | 165 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, |
| 166 | struct device *dev) |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 167 | { |
| 168 | return -ENOSYS; |
| 169 | } |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 170 | static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, |
| 171 | struct device *dev) |
| 172 | { |
| 173 | return -ENOSYS; |
| 174 | } |
| 175 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
| 176 | struct generic_pm_domain *new_sd) |
| 177 | { |
| 178 | return -ENOSYS; |
| 179 | } |
| 180 | static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
| 181 | struct generic_pm_domain *target) |
| 182 | { |
| 183 | return -ENOSYS; |
| 184 | } |
Ulf Hansson | 7eb231c | 2016-06-17 12:27:52 +0200 | [diff] [blame] | 185 | static inline int pm_genpd_init(struct generic_pm_domain *genpd, |
| 186 | struct dev_power_governor *gov, bool is_off) |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 187 | { |
Ulf Hansson | 7eb231c | 2016-06-17 12:27:52 +0200 | [diff] [blame] | 188 | return -ENOSYS; |
Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame] | 189 | } |
Jon Hunter | 3fe5771 | 2016-09-12 12:01:13 +0100 | [diff] [blame] | 190 | static inline int pm_genpd_remove(struct generic_pm_domain *genpd) |
| 191 | { |
| 192 | return -ENOTSUPP; |
| 193 | } |
Geert Uytterhoeven | 16d0bf1 | 2017-02-08 19:37:55 +0100 | [diff] [blame] | 194 | |
Viresh Kumar | 42f6284 | 2017-10-12 15:07:23 +0530 | [diff] [blame] | 195 | static inline int dev_pm_genpd_set_performance_state(struct device *dev, |
| 196 | unsigned int state) |
| 197 | { |
| 198 | return -ENOTSUPP; |
| 199 | } |
| 200 | |
Geert Uytterhoeven | 16d0bf1 | 2017-02-08 19:37:55 +0100 | [diff] [blame] | 201 | #define simple_qos_governor (*(struct dev_power_governor *)(NULL)) |
| 202 | #define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL)) |
Rafael J. Wysocki | 17f2ae7 | 2011-08-14 13:34:31 +0200 | [diff] [blame] | 203 | #endif |
| 204 | |
Rafael J. Wysocki | 77f827d | 2012-08-06 01:39:57 +0200 | [diff] [blame] | 205 | #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP |
Ulf Hansson | 781b9d6 | 2018-05-29 12:04:13 +0200 | [diff] [blame] | 206 | void pm_genpd_syscore_poweroff(struct device *dev); |
| 207 | void pm_genpd_syscore_poweron(struct device *dev); |
Rafael J. Wysocki | 77f827d | 2012-08-06 01:39:57 +0200 | [diff] [blame] | 208 | #else |
Ulf Hansson | d47e646 | 2014-09-03 12:52:24 +0200 | [diff] [blame] | 209 | static inline void pm_genpd_syscore_poweroff(struct device *dev) {} |
| 210 | static inline void pm_genpd_syscore_poweron(struct device *dev) {} |
Rafael J. Wysocki | 77f827d | 2012-08-06 01:39:57 +0200 | [diff] [blame] | 211 | #endif |
| 212 | |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 213 | /* OF PM domain providers */ |
| 214 | struct of_device_id; |
| 215 | |
Thierry Reding | 4084552 | 2017-03-29 18:34:50 +0200 | [diff] [blame] | 216 | typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args, |
| 217 | void *data); |
| 218 | |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 219 | struct genpd_onecell_data { |
| 220 | struct generic_pm_domain **domains; |
| 221 | unsigned int num_domains; |
Thierry Reding | 4084552 | 2017-03-29 18:34:50 +0200 | [diff] [blame] | 222 | genpd_xlate_t xlate; |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 223 | }; |
| 224 | |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 225 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF |
Jon Hunter | 892ebdcc | 2016-09-12 12:01:09 +0100 | [diff] [blame] | 226 | int of_genpd_add_provider_simple(struct device_node *np, |
| 227 | struct generic_pm_domain *genpd); |
| 228 | int of_genpd_add_provider_onecell(struct device_node *np, |
| 229 | struct genpd_onecell_data *data); |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 230 | void of_genpd_del_provider(struct device_node *np); |
Ulf Hansson | 781b9d6 | 2018-05-29 12:04:13 +0200 | [diff] [blame] | 231 | int of_genpd_add_device(struct of_phandle_args *args, struct device *dev); |
| 232 | int of_genpd_add_subdomain(struct of_phandle_args *parent, |
| 233 | struct of_phandle_args *new_subdomain); |
| 234 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); |
| 235 | int of_genpd_parse_idle_states(struct device_node *dn, |
| 236 | struct genpd_power_state **states, int *n); |
| 237 | unsigned int of_genpd_opp_to_performance_state(struct device *dev, |
Viresh Kumar | 6e41766 | 2017-11-29 15:21:51 +0530 | [diff] [blame] | 238 | struct device_node *opp_node); |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 239 | |
| 240 | int genpd_dev_pm_attach(struct device *dev); |
| 241 | #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ |
Jon Hunter | 892ebdcc | 2016-09-12 12:01:09 +0100 | [diff] [blame] | 242 | static inline int of_genpd_add_provider_simple(struct device_node *np, |
| 243 | struct generic_pm_domain *genpd) |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 244 | { |
Jon Hunter | 892ebdcc | 2016-09-12 12:01:09 +0100 | [diff] [blame] | 245 | return -ENOTSUPP; |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 246 | } |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 247 | |
Jon Hunter | 892ebdcc | 2016-09-12 12:01:09 +0100 | [diff] [blame] | 248 | static inline int of_genpd_add_provider_onecell(struct device_node *np, |
| 249 | struct genpd_onecell_data *data) |
| 250 | { |
| 251 | return -ENOTSUPP; |
| 252 | } |
| 253 | |
| 254 | static inline void of_genpd_del_provider(struct device_node *np) {} |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 255 | |
Jon Hunter | ec69572 | 2016-09-12 12:01:05 +0100 | [diff] [blame] | 256 | static inline int of_genpd_add_device(struct of_phandle_args *args, |
| 257 | struct device *dev) |
| 258 | { |
| 259 | return -ENODEV; |
| 260 | } |
| 261 | |
| 262 | static inline int of_genpd_add_subdomain(struct of_phandle_args *parent, |
| 263 | struct of_phandle_args *new_subdomain) |
| 264 | { |
| 265 | return -ENODEV; |
| 266 | } |
| 267 | |
Lina Iyer | 30f6042 | 2016-10-14 10:47:51 -0700 | [diff] [blame] | 268 | static inline int of_genpd_parse_idle_states(struct device_node *dn, |
| 269 | struct genpd_power_state **states, int *n) |
| 270 | { |
| 271 | return -ENODEV; |
| 272 | } |
| 273 | |
Viresh Kumar | 6e41766 | 2017-11-29 15:21:51 +0530 | [diff] [blame] | 274 | static inline unsigned int |
| 275 | of_genpd_opp_to_performance_state(struct device *dev, |
| 276 | struct device_node *opp_node) |
| 277 | { |
| 278 | return -ENODEV; |
| 279 | } |
| 280 | |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 281 | static inline int genpd_dev_pm_attach(struct device *dev) |
| 282 | { |
Ulf Hansson | 919b730 | 2018-05-09 12:17:52 +0200 | [diff] [blame] | 283 | return 0; |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 284 | } |
Jon Hunter | 1792655 | 2016-09-12 12:01:14 +0100 | [diff] [blame] | 285 | |
| 286 | static inline |
| 287 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) |
| 288 | { |
| 289 | return ERR_PTR(-ENOTSUPP); |
| 290 | } |
Tomasz Figa | aa42240 | 2014-09-19 20:27:36 +0200 | [diff] [blame] | 291 | #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ |
| 292 | |
Ulf Hansson | f48c767 | 2014-09-29 13:58:47 +0200 | [diff] [blame] | 293 | #ifdef CONFIG_PM |
Ulf Hansson | 781b9d6 | 2018-05-29 12:04:13 +0200 | [diff] [blame] | 294 | int dev_pm_domain_attach(struct device *dev, bool power_on); |
| 295 | void dev_pm_domain_detach(struct device *dev, bool power_off); |
| 296 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); |
Ulf Hansson | f48c767 | 2014-09-29 13:58:47 +0200 | [diff] [blame] | 297 | #else |
| 298 | static inline int dev_pm_domain_attach(struct device *dev, bool power_on) |
| 299 | { |
Ulf Hansson | 919b730 | 2018-05-09 12:17:52 +0200 | [diff] [blame] | 300 | return 0; |
Ulf Hansson | f48c767 | 2014-09-29 13:58:47 +0200 | [diff] [blame] | 301 | } |
| 302 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} |
Tomeu Vizoso | 989561d | 2016-01-07 16:46:13 +0100 | [diff] [blame] | 303 | static inline void dev_pm_domain_set(struct device *dev, |
| 304 | struct dev_pm_domain *pd) {} |
Ulf Hansson | f48c767 | 2014-09-29 13:58:47 +0200 | [diff] [blame] | 305 | #endif |
| 306 | |
Rafael J. Wysocki | f721889 | 2011-07-01 22:12:45 +0200 | [diff] [blame] | 307 | #endif /* _LINUX_PM_DOMAIN_H */ |