| @@ -16,6 +16,7 @@ · 15 unmodified lines |
| 16 | 16 | #include <linux/of.h> |
| 17 | 17 | #include <linux/notifier.h> |
| 18 | 18 | #include <linux/spinlock.h> |
| 19 | +#include <linux/cpumask.h> |
| 19 | 20 | |
| 20 | 21 | /* |
| 21 | 22 | * Flags to control the behaviour of a genpd. |
| @@ -42,11 +43,22 @@ · 20 unmodified lines |
| 42 | 43 | * GENPD_FLAG_ACTIVE_WAKEUP: Instructs genpd to keep the PM domain powered |
| 43 | 44 | * on, in case any of its attached devices is used |
| 44 | 45 | * in the wakeup path to serve system wakeups. |
| 46 | + * |
| 47 | + * GENPD_FLAG_CPU_DOMAIN: Instructs genpd that it should expect to get |
| 48 | + * devices attached, which may belong to CPUs or |
| 49 | + * possibly have subdomains with CPUs attached. |
| 50 | + * This flag enables the genpd backend driver to |
| 51 | + * deploy idle power management support for CPUs |
| 52 | + * and groups of CPUs. Note that, the backend |
| 53 | + * driver must then comply with the so called, |
| 54 | + * last-man-standing algorithm, for the CPUs in the |
| 55 | + * PM domain. |
| 45 | 56 | */ |
| 46 | 57 | #define GENPD_FLAG_PM_CLK (1U << 0) |
| 47 | 58 | #define GENPD_FLAG_IRQ_SAFE (1U << 1) |
| 48 | 59 | #define GENPD_FLAG_ALWAYS_ON (1U << 2) |
| 49 | 60 | #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) |
| 61 | +#define GENPD_FLAG_CPU_DOMAIN (1U << 4) |
| 50 | 62 | |
| 51 | 63 | enum gpd_status { |
| 52 | 64 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ |
| @@ -69,6 +81,7 @@ struct genpd_power_state { · 16 unmodified lines |
| 69 | 81 | s64 residency_ns; |
| 70 | 82 | struct fwnode_handle *fwnode; |
| 71 | 83 | ktime_t idle_time; |
| 84 | + void *data; |
| 72 | 85 | }; |
| 73 | 86 | |
| 74 | 87 | struct genpd_lock_ops; |
| @@ -93,6 +106,7 @@ struct generic_pm_domain { · 18 unmodified lines |
| 93 | 106 | unsigned int suspended_count; /* System suspend device counter */ |
| 94 | 107 | unsigned int prepared_count; /* Suspend counter of prepared devices */ |
| 95 | 108 | unsigned int performance_state; /* Aggregated max performance state */ |
| 109 | + cpumask_var_t cpus; /* A cpumask of the attached CPUs */ |
| 96 | 110 | int (*power_off)(struct generic_pm_domain *domain); |
| 97 | 111 | int (*power_on)(struct generic_pm_domain *domain); |
| 98 | 112 | struct opp_table *opp_table; /* OPP table of the genpd */ |
| @@ -104,15 +118,17 @@ struct generic_pm_domain { · 5 unmodified lines |
| 104 | 118 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ |
| 105 | 119 | bool max_off_time_changed; |
| 106 | 120 | bool cached_power_down_ok; |
| 121 | + bool cached_power_down_state_idx; |
| 107 | 122 | int (*attach_dev)(struct generic_pm_domain *domain, |
| 108 | 123 | struct device *dev); |
| 109 | 124 | void (*detach_dev)(struct generic_pm_domain *domain, |
| 110 | 125 | struct device *dev); |
| 111 | 126 | unsigned int flags; /* Bit field of configs for genpd */ |
| 112 | 127 | struct genpd_power_state *states; |
| 128 | + void (*free_states)(struct genpd_power_state *states, |
| 129 | + unsigned int state_count); |
| 113 | 130 | unsigned int state_count; /* number of states */ |
| 114 | 131 | unsigned int state_idx; /* state that genpd will go to when off */ |
| 115 | | − void *free; /* Free the state that was allocated for default */ |
| 116 | 132 | ktime_t on_time; |
| 117 | 133 | ktime_t accounting_time; |
| 118 | 134 | const struct genpd_lock_ops *lock_ops; |
| @@ -187,6 +203,9 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state); · 68 unmodified lines |
| 187 | 203 | |
| 188 | 204 | extern struct dev_power_governor simple_qos_governor; |
| 189 | 205 | extern struct dev_power_governor pm_domain_always_on_gov; |
| 206 | +#ifdef CONFIG_CPU_IDLE |
| 207 | +extern struct dev_power_governor pm_domain_cpu_gov; |
| 208 | +#endif |
| 190 | 209 | #else |
| 191 | 210 | |
| 192 | 211 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |