| 1 |
|
| 2 | |
| 3 | * pm_domain.h - Definitions and headers related to device power domains.
|
| 4 | *
|
| 5 | * Copyright (C) 2011 Rafael J. Wysocki <[email protected]>, Renesas Electronics Corp.
|
| 6 |
|
| 7 |
|
| 8 | #ifndef _LINUX_PM_DOMAIN_H
|
| 9 | #define _LINUX_PM_DOMAIN_H
|
| 10 |
|
| 11 | #include <linux/device.h>
|
| 12 | #include <linux/ktime.h>
|
| 13 | #include <linux/mutex.h>
|
| 14 | #include <linux/pm.h>
|
| 15 | #include <linux/err.h>
|
| 16 | #include <linux/of.h>
|
| 17 | #include <linux/notifier.h>
|
| 18 | #include <linux/spinlock.h>
|
| 19 | #include <linux/cpumask_types.h>
|
| 20 | #include <linux/time64.h>
|
| 21 |
|
| 22 | |
| 23 | * Flags to control the behaviour when attaching a device to its PM domains.
|
| 24 | *
|
| 25 | * PD_FLAG_NO_DEV_LINK: As the default behaviour creates a device-link
|
| 26 | * for every PM domain that gets attached, this
|
| 27 | * flag can be used to skip that.
|
| 28 | *
|
| 29 | * PD_FLAG_DEV_LINK_ON: Add the DL_FLAG_RPM_ACTIVE to power-on the
|
| 30 | * supplier and its PM domain when creating the
|
| 31 | * device-links.
|
| 32 | *
|
| 33 | * PD_FLAG_REQUIRED_OPP: Assign required_devs for the required OPPs. The
|
| 34 | * index of the required OPP must correspond to the
|
| 35 | * index in the array of the pd_names. If pd_names
|
| 36 | * isn't specified, the index just follows the
|
| 37 | * index for the attached PM domain.
|
| 38 | *
|
| 39 | * PD_FLAG_ATTACH_POWER_ON: Power on the domain during attach.
|
| 40 | *
|
| 41 | * PD_FLAG_DETACH_POWER_OFF: Power off the domain during detach.
|
| 42 | *
|
| 43 |
|
| 44 | #define PD_FLAG_NO_DEV_LINK BIT(0)
|
| 45 | #define PD_FLAG_DEV_LINK_ON BIT(1)
|
| 46 | #define PD_FLAG_REQUIRED_OPP BIT(2)
|
| 47 | #define PD_FLAG_ATTACH_POWER_ON BIT(3)
|
| 48 | #define PD_FLAG_DETACH_POWER_OFF BIT(4)
|
| 49 |
|
| 50 | struct dev_pm_domain_attach_data {
|
| 51 | const char * const *pd_names;
|
| 52 | u32 num_pd_names;
|
| 53 | u32 pd_flags;
|
| 54 | };
|
| 55 |
|
| 56 | struct dev_pm_domain_list {
|
| 57 | struct device **pd_devs;
|
| 58 | struct device_link **pd_links;
|
| 59 | u32 *opp_tokens;
|
| 60 | u32 num_pds;
|
| 61 | };
|
| 62 |
|
| 63 | |
| 64 | * Flags to control the behaviour of a genpd.
|
| 65 | *
|
| 66 | * These flags may be set in the struct generic_pm_domain's flags field by a
|
| 67 | * genpd backend driver. The flags must be set before it calls pm_genpd_init(),
|
| 68 | * which initializes a genpd.
|
| 69 | *
|
| 70 | * GENPD_FLAG_PM_CLK: Instructs genpd to use the PM clk framework,
|
| 71 | * while powering on/off attached devices.
|
| 72 | *
|
| 73 | * GENPD_FLAG_IRQ_SAFE: This informs genpd that its backend callbacks,
|
| 74 | * ->power_on|off(), doesn't sleep. Hence, these
|
| 75 | * can be invoked from within atomic context, which
|
| 76 | * enables genpd to power on/off the PM domain,
|
| 77 | * even when pm_runtime_is_irq_safe() returns true,
|
| 78 | * for any of its attached devices. Note that, a
|
| 79 | * genpd having this flag set, requires its
|
| 80 | * masterdomains to also have it set.
|
| 81 | *
|
| 82 | * GENPD_FLAG_ALWAYS_ON: Instructs genpd to always keep the PM domain
|
| 83 | * powered on.
|
| 84 | *
|
| 85 | * GENPD_FLAG_ACTIVE_WAKEUP: Instructs genpd to keep the PM domain powered
|
| 86 | * on, in case any of its attached devices is used
|
| 87 | * in the wakeup path to serve system wakeups.
|
| 88 | *
|
| 89 | * GENPD_FLAG_CPU_DOMAIN: Instructs genpd that it should expect to get
|
| 90 | * devices attached, which may belong to CPUs or
|
| 91 | * possibly have subdomains with CPUs attached.
|
| 92 | * This flag enables the genpd backend driver to
|
| 93 | * deploy idle power management support for CPUs
|
| 94 | * and groups of CPUs. Note that, the backend
|
| 95 | * driver must then comply with the so called,
|
| 96 | * last-man-standing algorithm, for the CPUs in the
|
| 97 | * PM domain.
|
| 98 | *
|
| 99 | * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain
|
| 100 | * powered on except for system suspend.
|
| 101 | *
|
| 102 | * GENPD_FLAG_MIN_RESIDENCY: Enable the genpd governor to consider its
|
| 103 | * components' next wakeup when determining the
|
| 104 | * optimal idle state.
|
| 105 | *
|
| 106 | * GENPD_FLAG_OPP_TABLE_FW: The genpd provider supports performance states,
|
| 107 | * but its corresponding OPP tables are not
|
| 108 | * described in DT, but are given directly by FW.
|
| 109 | *
|
| 110 | * GENPD_FLAG_DEV_NAME_FW: Instructs genpd to generate an unique device name
|
| 111 | * using ida. It is used by genpd providers which
|
| 112 | * get their genpd-names directly from FW.
|
| 113 | *
|
| 114 | * GENPD_FLAG_NO_SYNC_STATE: The ->sync_state() support is implemented in a
|
| 115 | * genpd provider specific way, likely through a
|
| 116 | * parent device node. This flag makes genpd to
|
| 117 | * skip its internal support for this.
|
| 118 | *
|
| 119 | * GENPD_FLAG_NO_STAY_ON: For genpd OF providers a powered-on PM domain at
|
| 120 | * initialization is prevented from being
|
| 121 | * powered-off until the ->sync_state() callback is
|
| 122 | * invoked. This flag informs genpd to allow a
|
| 123 | * power-off without waiting for ->sync_state().
|
| 124 |
|
| 125 | #define GENPD_FLAG_PM_CLK (1U << 0)
|
| 126 | #define GENPD_FLAG_IRQ_SAFE (1U << 1)
|
| 127 | #define GENPD_FLAG_ALWAYS_ON (1U << 2)
|
| 128 | #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3)
|
| 129 | #define GENPD_FLAG_CPU_DOMAIN (1U << 4)
|
| 130 | #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
|
| 131 | #define GENPD_FLAG_MIN_RESIDENCY (1U << 6)
|
| 132 | #define GENPD_FLAG_OPP_TABLE_FW (1U << 7)
|
| 133 | #define GENPD_FLAG_DEV_NAME_FW (1U << 8)
|
| 134 | #define GENPD_FLAG_NO_SYNC_STATE (1U << 9)
|
| 135 | #define GENPD_FLAG_NO_STAY_ON (1U << 10)
|
| 136 |
|
| 137 | enum gpd_status {
|
| 138 | GENPD_STATE_ON = 0,
|
| 139 | GENPD_STATE_OFF,
|
| 140 | };
|
| 141 |
|
| 142 | enum genpd_notication {
|
| 143 | GENPD_NOTIFY_PRE_OFF = 0,
|
| 144 | GENPD_NOTIFY_OFF,
|
| 145 | GENPD_NOTIFY_PRE_ON,
|
| 146 | GENPD_NOTIFY_ON,
|
| 147 | };
|
| 148 |
|
| 149 | enum genpd_sync_state {
|
| 150 | GENPD_SYNC_STATE_OFF = 0,
|
| 151 | GENPD_SYNC_STATE_SIMPLE,
|
| 152 | GENPD_SYNC_STATE_ONECELL,
|
| 153 | };
|
| 154 |
|
| 155 | struct dev_power_governor {
|
| 156 | bool (*system_power_down_ok)(struct dev_pm_domain *domain);
|
| 157 | bool (*power_down_ok)(struct dev_pm_domain *domain);
|
| 158 | bool (*suspend_ok)(struct device *dev);
|
| 159 | };
|
| 160 |
|
| 161 | struct gpd_dev_ops {
|
| 162 | int (*start)(struct device *dev);
|
| 163 | int (*stop)(struct device *dev);
|
| 164 | };
|
| 165 |
|
| 166 | struct genpd_governor_data {
|
| 167 | s64 max_off_time_ns;
|
| 168 | bool max_off_time_changed;
|
| 169 | ktime_t next_wakeup;
|
| 170 | ktime_t next_hrtimer;
|
| 171 | ktime_t last_enter;
|
| 172 | bool reflect_residency;
|
| 173 | bool cached_power_down_ok;
|
| 174 | bool cached_power_down_state_idx;
|
| 175 | };
|
| 176 |
|
| 177 | struct genpd_power_state {
|
| 178 | const char *name;
|
| 179 | s64 power_off_latency_ns;
|
| 180 | s64 power_on_latency_ns;
|
| 181 | s64 residency_ns;
|
| 182 | u64 usage;
|
| 183 | u64 rejected;
|
| 184 | u64 above;
|
| 185 | u64 below;
|
| 186 | u64 usage_s2idle;
|
| 187 | struct fwnode_handle *fwnode;
|
| 188 | u64 idle_time;
|
| 189 | void *data;
|
| 190 | };
|
| 191 |
|
| 192 | struct genpd_lock_ops;
|
| 193 | struct opp_table;
|
| 194 |
|
| 195 | struct generic_pm_domain {
|
| 196 | struct device dev;
|
| 197 | struct dev_pm_domain domain;
|
| 198 | struct list_head gpd_list_node;
|
| 199 | struct list_head parent_links;
|
| 200 | struct list_head child_links;
|
| 201 | struct list_head dev_list;
|
| 202 | struct dev_power_governor *gov;
|
| 203 | struct genpd_governor_data *gd;
|
| 204 | struct work_struct power_off_work;
|
| 205 | struct fwnode_handle *provider;
|
| 206 | bool has_provider;
|
| 207 | const char *name;
|
| 208 | atomic_t sd_count;
|
| 209 | enum gpd_status status;
|
| 210 | unsigned int device_count;
|
| 211 | unsigned int device_id;
|
| 212 | unsigned int suspended_count;
|
| 213 | unsigned int prepared_count;
|
| 214 | unsigned int performance_state;
|
| 215 | cpumask_var_t cpus;
|
| 216 | bool synced_poweroff;
|
| 217 | bool stay_on;
|
| 218 | enum genpd_sync_state sync_state;
|
| 219 | int (*power_off)(struct generic_pm_domain *domain);
|
| 220 | int (*power_on)(struct generic_pm_domain *domain);
|
| 221 | struct raw_notifier_head power_notifiers;
|
| 222 | struct opp_table *opp_table;
|
| 223 | int (*set_performance_state)(struct generic_pm_domain *genpd,
|
| 224 | unsigned int state);
|
| 225 | struct gpd_dev_ops dev_ops;
|
| 226 | int (*set_hwmode_dev)(struct generic_pm_domain *domain,
|
| 227 | struct device *dev, bool enable);
|
| 228 | bool (*get_hwmode_dev)(struct generic_pm_domain *domain,
|
| 229 | struct device *dev);
|
| 230 | int (*attach_dev)(struct generic_pm_domain *domain,
|
| 231 | struct device *dev);
|
| 232 | void (*detach_dev)(struct generic_pm_domain *domain,
|
| 233 | struct device *dev);
|
| 234 | unsigned int flags;
|
| 235 | struct genpd_power_state *states;
|
| 236 | void (*free_states)(struct genpd_power_state *states,
|
| 237 | unsigned int state_count);
|
| 238 | unsigned int state_count;
|
| 239 | unsigned int state_idx;
|
| 240 | u64 on_time;
|
| 241 | u64 accounting_time;
|
| 242 | const struct genpd_lock_ops *lock_ops;
|
| 243 | union {
|
| 244 | struct mutex mlock;
|
| 245 | struct {
|
| 246 | spinlock_t slock;
|
| 247 | unsigned long lock_flags;
|
| 248 | };
|
| 249 | struct {
|
| 250 | raw_spinlock_t raw_slock;
|
| 251 | unsigned long raw_lock_flags;
|
| 252 | };
|
| 253 | };
|
| 254 | };
|
| 255 |
|
| 256 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
|
| 257 | {
|
| 258 | return container_of(pd, struct generic_pm_domain, domain);
|
| 259 | }
|
| 260 |
|
| 261 | struct gpd_link {
|
| 262 | struct generic_pm_domain *parent;
|
| 263 | struct list_head parent_node;
|
| 264 | struct generic_pm_domain *child;
|
| 265 | struct list_head child_node;
|
| 266 |
|
| 267 |
|
| 268 | unsigned int performance_state;
|
| 269 | unsigned int prev_performance_state;
|
| 270 | };
|
| 271 |
|
| 272 | struct gpd_timing_data {
|
| 273 | s64 suspend_latency_ns;
|
| 274 | s64 resume_latency_ns;
|
| 275 | s64 effective_constraint_ns;
|
| 276 | ktime_t next_wakeup;
|
| 277 | bool constraint_changed;
|
| 278 | bool cached_suspend_ok;
|
| 279 | };
|
| 280 |
|
| 281 | struct pm_domain_data {
|
| 282 | struct list_head list_node;
|
| 283 | struct device *dev;
|
| 284 | };
|
| 285 |
|
| 286 | struct generic_pm_domain_data {
|
| 287 | struct pm_domain_data base;
|
| 288 | struct gpd_timing_data *td;
|
| 289 | struct notifier_block nb;
|
| 290 | struct notifier_block *power_nb;
|
| 291 | int cpu;
|
| 292 | unsigned int performance_state;
|
| 293 | unsigned int default_pstate;
|
| 294 | unsigned int rpm_pstate;
|
| 295 | unsigned int opp_token;
|
| 296 | bool hw_mode;
|
| 297 | bool rpm_always_on;
|
| 298 | void *data;
|
| 299 | };
|
| 300 |
|
| 301 | #ifdef CONFIG_PM_GENERIC_DOMAINS
|
| 302 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
|
| 303 | {
|
| 304 | return container_of(pdd, struct generic_pm_domain_data, base);
|
| 305 | }
|
| 306 |
|
| 307 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
|
| 308 | {
|
| 309 | return to_gpd_data(dev->power.subsys_data->domain_data);
|
| 310 | }
|
| 311 |
|
| 312 | int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev);
|
| 313 | int pm_genpd_remove_device(struct device *dev);
|
| 314 | int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
|
| 315 | struct generic_pm_domain *subdomain);
|
| 316 | int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
|
| 317 | struct generic_pm_domain *subdomain);
|
| 318 | int pm_genpd_init(struct generic_pm_domain *genpd,
|
| 319 | struct dev_power_governor *gov, bool is_off);
|
| 320 | int pm_genpd_remove(struct generic_pm_domain *genpd);
|
| 321 | void pm_genpd_inc_rejected(struct generic_pm_domain *genpd,
|
| 322 | unsigned int state_idx);
|
| 323 | struct device *dev_to_genpd_dev(struct device *dev);
|
| 324 | int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state);
|
| 325 | int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb);
|
| 326 | int dev_pm_genpd_remove_notifier(struct device *dev);
|
| 327 | void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
|
| 328 | ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
|
| 329 | void dev_pm_genpd_synced_poweroff(struct device *dev);
|
| 330 | int dev_pm_genpd_set_hwmode(struct device *dev, bool enable);
|
| 331 | bool dev_pm_genpd_get_hwmode(struct device *dev);
|
| 332 | int dev_pm_genpd_rpm_always_on(struct device *dev, bool on);
|
| 333 | bool dev_pm_genpd_is_on(struct device *dev);
|
| 334 |
|
| 335 | extern struct dev_power_governor simple_qos_governor;
|
| 336 | extern struct dev_power_governor pm_domain_always_on_gov;
|
| 337 | #ifdef CONFIG_CPU_IDLE
|
| 338 | extern struct dev_power_governor pm_domain_cpu_gov;
|
| 339 | #endif
|
| 340 | #else
|
| 341 |
|
| 342 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
|
| 343 | {
|
| 344 | return ERR_PTR(-ENOSYS);
|
| 345 | }
|
| 346 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
|
| 347 | struct device *dev)
|
| 348 | {
|
| 349 | return -ENOSYS;
|
| 350 | }
|
| 351 | static inline int pm_genpd_remove_device(struct device *dev)
|
| 352 | {
|
| 353 | return -ENOSYS;
|
| 354 | }
|
| 355 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
|
| 356 | struct generic_pm_domain *subdomain)
|
| 357 | {
|
| 358 | return -ENOSYS;
|
| 359 | }
|
| 360 | static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
|
| 361 | struct generic_pm_domain *subdomain)
|
| 362 | {
|
| 363 | return -ENOSYS;
|
| 364 | }
|
| 365 | static inline int pm_genpd_init(struct generic_pm_domain *genpd,
|
| 366 | struct dev_power_governor *gov, bool is_off)
|
| 367 | {
|
| 368 | return -ENOSYS;
|
| 369 | }
|
| 370 | static inline int pm_genpd_remove(struct generic_pm_domain *genpd)
|
| 371 | {
|
| 372 | return -EOPNOTSUPP;
|
| 373 | }
|
| 374 |
|
| 375 | static inline void pm_genpd_inc_rejected(struct generic_pm_domain *genpd,
|
| 376 | unsigned int state_idx)
|
| 377 | { }
|
| 378 |
|
| 379 | static inline struct device *dev_to_genpd_dev(struct device *dev)
|
| 380 | {
|
| 381 | return ERR_PTR(-EOPNOTSUPP);
|
| 382 | }
|
| 383 |
|
| 384 | static inline int dev_pm_genpd_set_performance_state(struct device *dev,
|
| 385 | unsigned int state)
|
| 386 | {
|
| 387 | return -EOPNOTSUPP;
|
| 388 | }
|
| 389 |
|
| 390 | static inline int dev_pm_genpd_add_notifier(struct device *dev,
|
| 391 | struct notifier_block *nb)
|
| 392 | {
|
| 393 | return -EOPNOTSUPP;
|
| 394 | }
|
| 395 |
|
| 396 | static inline int dev_pm_genpd_remove_notifier(struct device *dev)
|
| 397 | {
|
| 398 | return -EOPNOTSUPP;
|
| 399 | }
|
| 400 |
|
| 401 | static inline void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next)
|
| 402 | { }
|
| 403 |
|
| 404 | static inline ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev)
|
| 405 | {
|
| 406 | return KTIME_MAX;
|
| 407 | }
|
| 408 | static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
|
| 409 | { }
|
| 410 |
|
| 411 | static inline int dev_pm_genpd_set_hwmode(struct device *dev, bool enable)
|
| 412 | {
|
| 413 | return -EOPNOTSUPP;
|
| 414 | }
|
| 415 |
|
| 416 | static inline bool dev_pm_genpd_get_hwmode(struct device *dev)
|
| 417 | {
|
| 418 | return false;
|
| 419 | }
|
| 420 |
|
| 421 | static inline int dev_pm_genpd_rpm_always_on(struct device *dev, bool on)
|
| 422 | {
|
| 423 | return -EOPNOTSUPP;
|
| 424 | }
|
| 425 |
|
| 426 | static inline bool dev_pm_genpd_is_on(struct device *dev)
|
| 427 | {
|
| 428 | return false;
|
| 429 | }
|
| 430 |
|
| 431 | #define simple_qos_governor (*(struct dev_power_governor *)(NULL))
|
| 432 | #define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL))
|
| 433 | #endif
|
| 434 |
|
| 435 | #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
|
| 436 | void dev_pm_genpd_suspend(struct device *dev);
|
| 437 | void dev_pm_genpd_resume(struct device *dev);
|
| 438 | #else
|
| 439 | static inline void dev_pm_genpd_suspend(struct device *dev) {}
|
| 440 | static inline void dev_pm_genpd_resume(struct device *dev) {}
|
| 441 | #endif
|
| 442 |
|
| 443 |
|
| 444 | struct of_device_id;
|
| 445 |
|
| 446 | typedef struct generic_pm_domain *(*genpd_xlate_t)(const struct of_phandle_args *args,
|
| 447 | void *data);
|
| 448 |
|
| 449 | struct genpd_onecell_data {
|
| 450 | struct generic_pm_domain **domains;
|
| 451 | unsigned int num_domains;
|
| 452 | genpd_xlate_t xlate;
|
| 453 | };
|
| 454 |
|
| 455 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF
|
| 456 | int of_genpd_add_provider_simple(struct device_node *np,
|
| 457 | struct generic_pm_domain *genpd);
|
| 458 | int of_genpd_add_provider_onecell(struct device_node *np,
|
| 459 | struct genpd_onecell_data *data);
|
| 460 | void of_genpd_del_provider(struct device_node *np);
|
| 461 | int of_genpd_add_device(const struct of_phandle_args *args, struct device *dev);
|
| 462 | int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
|
| 463 | const struct of_phandle_args *subdomain_spec);
|
| 464 | int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
|
| 465 | const struct of_phandle_args *subdomain_spec);
|
| 466 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
|
| 467 | int of_genpd_parse_idle_states(struct device_node *dn,
|
| 468 | struct genpd_power_state **states, int *n);
|
| 469 | void of_genpd_sync_state(struct device_node *np);
|
| 470 | int of_genpd_add_child_ids(struct device_node *np,
|
| 471 | struct genpd_onecell_data *data);
|
| 472 | int of_genpd_remove_child_ids(struct device_node *np,
|
| 473 | struct genpd_onecell_data *data);
|
| 474 |
|
| 475 | int genpd_dev_pm_attach(struct device *dev);
|
| 476 | struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
| 477 | unsigned int index);
|
| 478 | struct device *genpd_dev_pm_attach_by_name(struct device *dev,
|
| 479 | const char *name);
|
| 480 | #else
|
| 481 | static inline int of_genpd_add_provider_simple(struct device_node *np,
|
| 482 | struct generic_pm_domain *genpd)
|
| 483 | {
|
| 484 | return -EOPNOTSUPP;
|
| 485 | }
|
| 486 |
|
| 487 | static inline int of_genpd_add_provider_onecell(struct device_node *np,
|
| 488 | struct genpd_onecell_data *data)
|
| 489 | {
|
| 490 | return -EOPNOTSUPP;
|
| 491 | }
|
| 492 |
|
| 493 | static inline void of_genpd_del_provider(struct device_node *np) {}
|
| 494 |
|
| 495 | static inline int of_genpd_add_device(const struct of_phandle_args *args,
|
| 496 | struct device *dev)
|
| 497 | {
|
| 498 | return -ENODEV;
|
| 499 | }
|
| 500 |
|
| 501 | static inline int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
|
| 502 | const struct of_phandle_args *subdomain_spec)
|
| 503 | {
|
| 504 | return -ENODEV;
|
| 505 | }
|
| 506 |
|
| 507 | static inline int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
|
| 508 | const struct of_phandle_args *subdomain_spec)
|
| 509 | {
|
| 510 | return -ENODEV;
|
| 511 | }
|
| 512 |
|
| 513 | static inline int of_genpd_parse_idle_states(struct device_node *dn,
|
| 514 | struct genpd_power_state **states, int *n)
|
| 515 | {
|
| 516 | return -ENODEV;
|
| 517 | }
|
| 518 |
|
| 519 | static inline void of_genpd_sync_state(struct device_node *np) {}
|
| 520 |
|
| 521 | static inline int genpd_dev_pm_attach(struct device *dev)
|
| 522 | {
|
| 523 | return 0;
|
| 524 | }
|
| 525 |
|
| 526 | static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
| 527 | unsigned int index)
|
| 528 | {
|
| 529 | return NULL;
|
| 530 | }
|
| 531 |
|
| 532 | static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
|
| 533 | const char *name)
|
| 534 | {
|
| 535 | return NULL;
|
| 536 | }
|
| 537 |
|
| 538 | static inline
|
| 539 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
|
| 540 | {
|
| 541 | return ERR_PTR(-EOPNOTSUPP);
|
| 542 | }
|
| 543 |
|
| 544 | static inline int of_genpd_add_child_ids(struct device_node *np,
|
| 545 | struct genpd_onecell_data *data)
|
| 546 | {
|
| 547 | return -EOPNOTSUPP;
|
| 548 | }
|
| 549 |
|
| 550 | static inline int of_genpd_remove_child_ids(struct device_node *np,
|
| 551 | struct genpd_onecell_data *data)
|
| 552 | {
|
| 553 | return -EOPNOTSUPP;
|
| 554 | }
|
| 555 | #endif
|
| 556 |
|
| 557 | #ifdef CONFIG_PM
|
| 558 | int dev_pm_domain_attach(struct device *dev, u32 flags);
|
| 559 | struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
| 560 | unsigned int index);
|
| 561 | struct device *dev_pm_domain_attach_by_name(struct device *dev,
|
| 562 | const char *name);
|
| 563 | int dev_pm_domain_attach_list(struct device *dev,
|
| 564 | const struct dev_pm_domain_attach_data *data,
|
| 565 | struct dev_pm_domain_list **list);
|
| 566 | int devm_pm_domain_attach_list(struct device *dev,
|
| 567 | const struct dev_pm_domain_attach_data *data,
|
| 568 | struct dev_pm_domain_list **list);
|
| 569 | void dev_pm_domain_detach(struct device *dev, bool power_off);
|
| 570 | void dev_pm_domain_detach_list(struct dev_pm_domain_list *list);
|
| 571 | int dev_pm_domain_start(struct device *dev);
|
| 572 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
|
| 573 | int dev_pm_domain_set_performance_state(struct device *dev, unsigned int state);
|
| 574 | #else
|
| 575 | static inline int dev_pm_domain_attach(struct device *dev, u32 flags)
|
| 576 | {
|
| 577 | return 0;
|
| 578 | }
|
| 579 | static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
| 580 | unsigned int index)
|
| 581 | {
|
| 582 | return NULL;
|
| 583 | }
|
| 584 | static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
|
| 585 | const char *name)
|
| 586 | {
|
| 587 | return NULL;
|
| 588 | }
|
| 589 | static inline int dev_pm_domain_attach_list(struct device *dev,
|
| 590 | const struct dev_pm_domain_attach_data *data,
|
| 591 | struct dev_pm_domain_list **list)
|
| 592 | {
|
| 593 | return 0;
|
| 594 | }
|
| 595 |
|
| 596 | static inline int devm_pm_domain_attach_list(struct device *dev,
|
| 597 | const struct dev_pm_domain_attach_data *data,
|
| 598 | struct dev_pm_domain_list **list)
|
| 599 | {
|
| 600 | return 0;
|
| 601 | }
|
| 602 |
|
| 603 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
|
| 604 | static inline void dev_pm_domain_detach_list(struct dev_pm_domain_list *list) {}
|
| 605 | static inline int dev_pm_domain_start(struct device *dev)
|
| 606 | {
|
| 607 | return 0;
|
| 608 | }
|
| 609 | static inline void dev_pm_domain_set(struct device *dev,
|
| 610 | struct dev_pm_domain *pd) {}
|
| 611 | static inline int dev_pm_domain_set_performance_state(struct device *dev,
|
| 612 | unsigned int state)
|
| 613 | {
|
| 614 | return 0;
|
| 615 | }
|
| 616 | #endif
|
| 617 |
|
| 618 | #endif
|