History

Merge tag 'pm-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management updates from Rafael Wysocki: "These add support for 'artificial' Energy Models in which power numbers for different entities may be in different scales, add support for some new hardware, fix bugs and clean up code in multiple places. Specifics: - Update the Energy Model support code to allow the Energy Model to be artificial, which means that the power values may not be on a uniform scale with other devices providing power information, and update the cpufreq_cooling and devfreq_cooling thermal drivers to support artificial Energy Models (Lukasz Luba). - Make DTPM check the Energy Model type (Lukasz Luba). - Fix policy counter decrementation in cpufreq if Energy Model is in use (Pierre Gondois). - Add CPU-based scaling support to passive devfreq governor (Saravana Kannan, Chanwoo Choi). - Update the rk3399_dmc devfreq driver (Brian Norris). - Export dev_pm_ops instead of suspend() and resume() in the IIO chemical scd30 driver (Jonathan Cameron). - Add namespace variants of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and PM-runtime counterparts (Jonathan Cameron). - Move symbol exports in the IIO chemical scd30 driver into the IIO_SCD30 namespace (Jonathan Cameron). - Avoid device PM-runtime usage count underflows (Rafael Wysocki). - Allow dynamic debug to control printing of PM messages (David Cohen). - Fix some kernel-doc comments in hibernation code (Yang Li, Haowen Bai). - Preserve ACPI-table override during hibernation (Amadeusz Sławiński). - Improve support for suspend-to-RAM for PSCI OSI mode (Ulf Hansson). - Make Intel RAPL power capping driver support the RaptorLake and AlderLake N processors (Zhang Rui, Sumeet Pawnikar). - Remove redundant store to value after multiply in the RAPL power capping driver (Colin Ian King). - Add AlderLake processor support to the intel_idle driver (Zhang Rui). - Fix regression leading to no genpd governor in the PSCI cpuidle driver and fix the riscv-sbi cpuidle driver to allow a genpd governor to be used (Ulf Hansson). - Fix cpufreq governor clean up code to avoid using kfree() directly to free kobject-based items (Kevin Hao). - Prepare cpufreq for powerpc's asm/prom.h cleanup (Christophe Leroy). - Make intel_pstate notify frequency invariance code when no_turbo is turned on and off (Chen Yu). - Add Sapphire Rapids OOB mode support to intel_pstate (Srinivas Pandruvada). - Make cpufreq avoid unnecessary frequency updates due to mismatch between hardware and the frequency table (Viresh Kumar). - Make remove_cpu_dev_symlink() clear the real_cpus mask to simplify code (Viresh Kumar). - Rearrange cpufreq_offline() and cpufreq_remove_dev() to make the calling convention for some driver callbacks consistent (Rafael Wysocki). - Avoid accessing half-initialized cpufreq policies from the show() and store() sysfs functions (Schspa Shi). - Rearrange cpufreq_offline() to make the calling convention for some driver callbacks consistent (Schspa Shi). - Update CPPC handling in cpufreq (Pierre Gondois). - Extend dev_pm_domain_detach() doc (Krzysztof Kozlowski). - Move genpd's time-accounting to ktime_get_mono_fast_ns() (Ulf Hansson). - Improve the way genpd deals with its governors (Ulf Hansson). - Update the turbostat utility to version 2022.04.16 (Len Brown, Dan Merillat, Sumeet Pawnikar, Zephaniah E. Loss-Cutler-Hull, Chen Yu)" * tag 'pm-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (94 commits) PM: domains: Trust domain-idle-states from DT to be correct by genpd PM: domains: Measure power-on/off latencies in genpd based on a governor PM: domains: Allocate governor data dynamically based on a genpd governor PM: domains: Clean up some code in pm_genpd_init() and genpd_remove() PM: domains: Fix initialization of genpd's next_wakeup PM: domains: Fixup QoS latency measurements for IRQ safe devices in genpd PM: domains: Measure suspend/resume latencies in genpd based on governor PM: domains: Move the next_wakeup variable into the struct gpd_timing_data PM: domains: Allocate gpd_timing_data dynamically based on governor PM: domains: Skip another warning in irq_safe_dev_in_sleep_domain() PM: domains: Rename irq_safe_dev_in_no_sleep_domain() in genpd PM: domains: Don't check PM_QOS_FLAG_NO_POWER_OFF in genpd PM: domains: Drop redundant code for genpd always-on governor PM: domains: Add GENPD_FLAG_RPM_ALWAYS_ON for the always-on governor powercap: intel_rapl: remove redundant store to value after multiply cpufreq: CPPC: Enable dvfs_possible_from_any_cpu cpufreq: CPPC: Enable fast_switch ACPI: CPPC: Assume no transition latency if no PCCT ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported ACPI: CPPC: Check _OSC for flexible address space ...

Linus Torvalds committed 4 years ago

Commit 09583df2 parents 1961b06 0d6448260 files · +2463 −1005Browse files

Showing the changes to include (9 of 60 files). Show all

Unified · Split

9 files
  1. include/acpi/cppc_acpi.h +5 −0
  2. include/linux/acpi.h +2 −0
  3. include/linux/devfreq.h +15 −2
  4. include/linux/energy_model.h +31 −4
  5. include/linux/pm.h +9 −5
  6. include/linux/pm_domain.h +14 −10
  7. include/linux/pm_runtime.h +8 −2
  8. include/linux/suspend.h +39 −5
  9. include/soc/rockchip/pm_domains.h +25 −0
include/acpi/cppc_acpi.h+5−0
@@ -141,6 +141,7 @@ extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); · 140 unmodified lines
141extern int cppc_set_enable(int cpu, bool enable);141extern int cppc_set_enable(int cpu, bool enable);
142extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);142extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
143extern bool acpi_cpc_valid(void);143extern bool acpi_cpc_valid(void);
144extern bool cppc_allow_fast_switch(void);
144extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);145extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);
145extern unsigned int cppc_get_transition_latency(int cpu);146extern unsigned int cppc_get_transition_latency(int cpu);
146extern bool cpc_ffh_supported(void);147extern bool cpc_ffh_supported(void);
@@ -175,6 +176,10 @@ static inline bool acpi_cpc_valid(void) · 28 unmodified lines
175{176{
176 return false;177 return false;
177}178}
179static inline bool cppc_allow_fast_switch(void)
180{
181 return false;
182}
178static inline unsigned int cppc_get_transition_latency(int cpu)183static inline unsigned int cppc_get_transition_latency(int cpu)
179{184{
180 return CPUFREQ_ETERNAL;185 return CPUFREQ_ETERNAL;
include/linux/acpi.h+2−0
@@ -574,6 +574,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); · 573 unmodified lines
574#define OSC_SB_OSLPI_SUPPORT 0x00000100574#define OSC_SB_OSLPI_SUPPORT 0x00000100
575#define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000575#define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000
576#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000576#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000
577#define OSC_SB_CPC_FLEXIBLE_ADR_SPACE 0x00004000
577#define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000578#define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000
578#define OSC_SB_PRM_SUPPORT 0x00200000579#define OSC_SB_PRM_SUPPORT 0x00200000
579 580
@@ -581,6 +582,7 @@ extern bool osc_sb_apei_support_acked; · 1 unmodified line
581extern bool osc_pc_lpi_support_confirmed;582extern bool osc_pc_lpi_support_confirmed;
582extern bool osc_sb_native_usb4_support_confirmed;583extern bool osc_sb_native_usb4_support_confirmed;
583extern bool osc_sb_cppc_not_supported;584extern bool osc_sb_cppc_not_supported;
585extern bool osc_cpc_flexible_adr_space_confirmed;
584 586
585/* USB4 Capabilities */587/* USB4 Capabilities */
586#define OSC_USB_USB3_TUNNELING 0x00000001588#define OSC_USB_USB3_TUNNELING 0x00000001
include/linux/devfreq.h+15−2
@@ -38,6 +38,7 @@ enum devfreq_timer { · 37 unmodified lines
38 38
39struct devfreq;39struct devfreq;
40struct devfreq_governor;40struct devfreq_governor;
41struct devfreq_cpu_data;
41struct thermal_cooling_device;42struct thermal_cooling_device;
42 43
43/**44/**
@@ -288,6 +289,11 @@ struct devfreq_simple_ondemand_data { · 244 unmodified lines
288#endif289#endif
289 290
290#if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)291#if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)
292enum devfreq_parent_dev_type {
293 DEVFREQ_PARENT_DEV,
294 CPUFREQ_PARENT_DEV,
295};
296
291/**297/**
292 * struct devfreq_passive_data - ``void *data`` fed to struct devfreq298 * struct devfreq_passive_data - ``void *data`` fed to struct devfreq
293 * and devfreq_add_device299 * and devfreq_add_device
@@ -299,8 +305,11 @@ struct devfreq_simple_ondemand_data { · 5 unmodified lines
299 * using governors except for passive governor.305 * using governors except for passive governor.
300 * If the devfreq device has the specific method to decide306 * If the devfreq device has the specific method to decide
301 * the next frequency, should use this callback.307 * the next frequency, should use this callback.
302 * @this: the devfreq instance of own device.308 * @parent_type: the parent type of the device.
303 * @nb: the notifier block for DEVFREQ_TRANSITION_NOTIFIER list309 * @this: the devfreq instance of own device.
310 * @nb: the notifier block for DEVFREQ_TRANSITION_NOTIFIER or
311 * CPUFREQ_TRANSITION_NOTIFIER list.
312 * @cpu_data_list: the list of cpu frequency data for all cpufreq_policy.
304 *313 *
305 * The devfreq_passive_data have to set the devfreq instance of parent314 * The devfreq_passive_data have to set the devfreq instance of parent
306 * device with governors except for the passive governor. But, don't need to315 * device with governors except for the passive governor. But, don't need to
@@ -314,9 +323,13 @@ struct devfreq_passive_data { · 7 unmodified lines
314 /* Optional callback to decide the next frequency of passvice device */323 /* Optional callback to decide the next frequency of passvice device */
315 int (*get_target_freq)(struct devfreq *this, unsigned long *freq);324 int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
316 325
326 /* Should set the type of parent device */
327 enum devfreq_parent_dev_type parent_type;
328
317 /* For passive governor's internal use. Don't need to set them */329 /* For passive governor's internal use. Don't need to set them */
318 struct devfreq *this;330 struct devfreq *this;
319 struct notifier_block nb;331 struct notifier_block nb;
332 struct list_head cpu_data_list;
320};333};
321#endif334#endif
322 335
include/linux/energy_model.h+31−4
@@ -67,11 +67,16 @@ struct em_perf_domain { · 66 unmodified lines
67 *67 *
68 * EM_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip inefficient states when estimating68 * EM_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip inefficient states when estimating
69 * energy consumption.69 * energy consumption.
70 *
71 * EM_PERF_DOMAIN_ARTIFICIAL: The power values are artificial and might be
72 * created by platform missing real power information
70 */73 */
71#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)74#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)
72#define EM_PERF_DOMAIN_SKIP_INEFFICIENCIES BIT(1)75#define EM_PERF_DOMAIN_SKIP_INEFFICIENCIES BIT(1)
76#define EM_PERF_DOMAIN_ARTIFICIAL BIT(2)
73 77
74#define em_span_cpus(em) (to_cpumask((em)->cpus))78#define em_span_cpus(em) (to_cpumask((em)->cpus))
79#define em_is_artificial(em) ((em)->flags & EM_PERF_DOMAIN_ARTIFICIAL)
75 80
76#ifdef CONFIG_ENERGY_MODEL81#ifdef CONFIG_ENERGY_MODEL
77#define EM_MAX_POWER 0xFFFF82#define EM_MAX_POWER 0xFFFF
@@ -96,11 +101,11 @@ struct em_data_callback { · 18 unmodified lines
96 /**101 /**
97 * active_power() - Provide power at the next performance state of102 * active_power() - Provide power at the next performance state of
98 * a device103 * a device
104 * @dev : Device for which we do this operation (can be a CPU)
99 * @power : Active power at the performance state105 * @power : Active power at the performance state
100 * (modified)106 * (modified)
101 * @freq : Frequency at the performance state in kHz107 * @freq : Frequency at the performance state in kHz
102 * (modified)108 * (modified)
103 * @dev : Device for which we do this operation (can be a CPU)
104 *109 *
105 * active_power() must find the lowest performance state of 'dev' above110 * active_power() must find the lowest performance state of 'dev' above
106 * 'freq' and update 'power' and 'freq' to the matching active power111 * 'freq' and update 'power' and 'freq' to the matching active power
@@ -112,11 +117,32 @@ struct em_data_callback { · 5 unmodified lines
112 *117 *
113 * Return 0 on success.118 * Return 0 on success.
114 */119 */
115 int (*active_power)(unsigned long *power, unsigned long *freq,120 int (*active_power)(struct device *dev, unsigned long *power,
116 struct device *dev);121 unsigned long *freq);
122
123 /**
124 * get_cost() - Provide the cost at the given performance state of
125 * a device
126 * @dev : Device for which we do this operation (can be a CPU)
127 * @freq : Frequency at the performance state in kHz
128 * @cost : The cost value for the performance state
129 * (modified)
130 *
131 * In case of CPUs, the cost is the one of a single CPU in the domain.
132 * It is expected to fit in the [0, EM_MAX_POWER] range due to internal
133 * usage in EAS calculation.
134 *
135 * Return 0 on success, or appropriate error value in case of failure.
136 */
137 int (*get_cost)(struct device *dev, unsigned long freq,
138 unsigned long *cost);
117};139};
118#define EM_DATA_CB(_active_power_cb) { .active_power = &_active_power_cb }
119#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) ((em_cb).active_power = cb)140#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) ((em_cb).active_power = cb)
141#define EM_ADV_DATA_CB(_active_power_cb, _cost_cb) \
142 { .active_power = _active_power_cb, \
143 .get_cost = _cost_cb }
144#define EM_DATA_CB(_active_power_cb) \
145 EM_ADV_DATA_CB(_active_power_cb, NULL)
120 146
121struct em_perf_domain *em_cpu_get(int cpu);147struct em_perf_domain *em_cpu_get(int cpu);
122struct em_perf_domain *em_pd_get(struct device *dev);148struct em_perf_domain *em_pd_get(struct device *dev);
@@ -264,6 +290,7 @@ static inline int em_pd_nr_perf_states(struct em_perf_domain *pd) · 141 unmodified lines
264 290
265#else291#else
266struct em_data_callback {};292struct em_data_callback {};
293#define EM_ADV_DATA_CB(_active_power_cb, _cost_cb) { }
267#define EM_DATA_CB(_active_power_cb) { }294#define EM_DATA_CB(_active_power_cb) { }
268#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) do { } while (0)295#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) do { } while (0)
269 296
include/linux/pm.h+9−5
@@ -368,13 +368,13 @@ const struct dev_pm_ops name = { \ · 367 unmodified lines
368 368
369#ifdef CONFIG_PM369#ifdef CONFIG_PM
370#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \370#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
371 runtime_resume_fn, idle_fn, sec) \371 runtime_resume_fn, idle_fn, sec, ns) \
372 _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \372 _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
373 runtime_resume_fn, idle_fn); \373 runtime_resume_fn, idle_fn); \
374 _EXPORT_SYMBOL(name, sec)374 __EXPORT_SYMBOL(name, sec, ns)
375#else375#else
376#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \376#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
377 runtime_resume_fn, idle_fn, sec) \377 runtime_resume_fn, idle_fn, sec, ns) \
378static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \378static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
379 resume_fn, runtime_suspend_fn, \379 resume_fn, runtime_suspend_fn, \
380 runtime_resume_fn, idle_fn)380 runtime_resume_fn, idle_fn)
@@ -391,9 +391,13 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \ · 10 unmodified lines
391 _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)391 _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
392 392
393#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \393#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
394 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "")394 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "")
395#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \395#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
396 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl")396 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
397#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
398 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns)
399#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
400 _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns)
397 401
398/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */402/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
399#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \403#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
include/linux/pm_domain.h+14−10
@@ -91,6 +91,14 @@ struct gpd_dev_ops { · 90 unmodified lines
91 int (*stop)(struct device *dev);91 int (*stop)(struct device *dev);
92};92};
93 93
94struct genpd_governor_data {
95 s64 max_off_time_ns;
96 bool max_off_time_changed;
97 ktime_t next_wakeup;
98 bool cached_power_down_ok;
99 bool cached_power_down_state_idx;
100};
101
94struct genpd_power_state {102struct genpd_power_state {
95 s64 power_off_latency_ns;103 s64 power_off_latency_ns;
96 s64 power_on_latency_ns;104 s64 power_on_latency_ns;
@@ -98,7 +106,7 @@ struct genpd_power_state { · 1 unmodified line
98 u64 usage;106 u64 usage;
99 u64 rejected;107 u64 rejected;
100 struct fwnode_handle *fwnode;108 struct fwnode_handle *fwnode;
101 ktime_t idle_time;109 u64 idle_time;
102 void *data;110 void *data;
103};111};
104 112
@@ -114,6 +122,7 @@ struct generic_pm_domain { · 9 unmodified lines
114 struct list_head child_links; /* Links with PM domain as a child */122 struct list_head child_links; /* Links with PM domain as a child */
115 struct list_head dev_list; /* List of devices */123 struct list_head dev_list; /* List of devices */
116 struct dev_power_governor *gov;124 struct dev_power_governor *gov;
125 struct genpd_governor_data *gd; /* Data used by a genpd governor. */
117 struct work_struct power_off_work;126 struct work_struct power_off_work;
118 struct fwnode_handle *provider; /* Identity of the domain provider */127 struct fwnode_handle *provider; /* Identity of the domain provider */
119 bool has_provider;128 bool has_provider;
@@ -134,11 +143,6 @@ struct generic_pm_domain { · 14 unmodified lines
134 int (*set_performance_state)(struct generic_pm_domain *genpd,143 int (*set_performance_state)(struct generic_pm_domain *genpd,
135 unsigned int state);144 unsigned int state);
136 struct gpd_dev_ops dev_ops;145 struct gpd_dev_ops dev_ops;
137 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
138 ktime_t next_wakeup; /* Maintained by the domain governor */
139 bool max_off_time_changed;
140 bool cached_power_down_ok;
141 bool cached_power_down_state_idx;
142 int (*attach_dev)(struct generic_pm_domain *domain,146 int (*attach_dev)(struct generic_pm_domain *domain,
143 struct device *dev);147 struct device *dev);
144 void (*detach_dev)(struct generic_pm_domain *domain,148 void (*detach_dev)(struct generic_pm_domain *domain,
@@ -149,8 +153,8 @@ struct generic_pm_domain { · 4 unmodified lines
149 unsigned int state_count);153 unsigned int state_count);
150 unsigned int state_count; /* number of states */154 unsigned int state_count; /* number of states */
151 unsigned int state_idx; /* state that genpd will go to when off */155 unsigned int state_idx; /* state that genpd will go to when off */
152 ktime_t on_time;156 u64 on_time;
153 ktime_t accounting_time;157 u64 accounting_time;
154 const struct genpd_lock_ops *lock_ops;158 const struct genpd_lock_ops *lock_ops;
155 union {159 union {
156 struct mutex mlock;160 struct mutex mlock;
@@ -182,6 +186,7 @@ struct gpd_timing_data { · 25 unmodified lines
182 s64 suspend_latency_ns;186 s64 suspend_latency_ns;
183 s64 resume_latency_ns;187 s64 resume_latency_ns;
184 s64 effective_constraint_ns;188 s64 effective_constraint_ns;
189 ktime_t next_wakeup;
185 bool constraint_changed;190 bool constraint_changed;
186 bool cached_suspend_ok;191 bool cached_suspend_ok;
187};192};
@@ -193,14 +198,13 @@ struct pm_domain_data { · 5 unmodified lines
193 198
194struct generic_pm_domain_data {199struct generic_pm_domain_data {
195 struct pm_domain_data base;200 struct pm_domain_data base;
196 struct gpd_timing_data td;201 struct gpd_timing_data *td;
197 struct notifier_block nb;202 struct notifier_block nb;
198 struct notifier_block *power_nb;203 struct notifier_block *power_nb;
199 int cpu;204 int cpu;
200 unsigned int performance_state;205 unsigned int performance_state;
201 unsigned int default_pstate;206 unsigned int default_pstate;
202 unsigned int rpm_pstate;207 unsigned int rpm_pstate;
203 ktime_t next_wakeup;
204 void *data;208 void *data;
205};209};
206 210
include/linux/pm_runtime.h+8−2
@@ -41,10 +41,16 @@ · 40 unmodified lines
41 41
42#define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \42#define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
43 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \43 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
44 suspend_fn, resume_fn, idle_fn, "")44 suspend_fn, resume_fn, idle_fn, "", "")
45#define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \45#define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
46 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \46 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
47 suspend_fn, resume_fn, idle_fn, "_gpl")47 suspend_fn, resume_fn, idle_fn, "_gpl", "")
48#define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
49 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
50 suspend_fn, resume_fn, idle_fn, "", #ns)
51#define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
52 _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
53 suspend_fn, resume_fn, idle_fn, "_gpl", #ns)
48 54
49#ifdef CONFIG_PM55#ifdef CONFIG_PM
50extern struct workqueue_struct *pm_wq;56extern struct workqueue_struct *pm_wq;
include/linux/suspend.h+39−5
@@ -542,22 +542,56 @@ static inline void unlock_system_sleep(void) {} · 541 unmodified lines
542#ifdef CONFIG_PM_SLEEP_DEBUG542#ifdef CONFIG_PM_SLEEP_DEBUG
543extern bool pm_print_times_enabled;543extern bool pm_print_times_enabled;
544extern bool pm_debug_messages_on;544extern bool pm_debug_messages_on;
545extern __printf(2, 3) void __pm_pr_dbg(bool defer, const char *fmt, ...);545static inline int pm_dyn_debug_messages_on(void)
546{
547#ifdef CONFIG_DYNAMIC_DEBUG
548 return 1;
549#else
550 return 0;
551#endif
552}
553#ifndef pr_fmt
554#define pr_fmt(fmt) "PM: " fmt
555#endif
556#define __pm_pr_dbg(fmt, ...) \
557 do { \
558 if (pm_debug_messages_on) \
559 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
560 else if (pm_dyn_debug_messages_on()) \
561 pr_debug(fmt, ##__VA_ARGS__); \
562 } while (0)
563#define __pm_deferred_pr_dbg(fmt, ...) \
564 do { \
565 if (pm_debug_messages_on) \
566 printk_deferred(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
567 } while (0)
546#else568#else
547#define pm_print_times_enabled (false)569#define pm_print_times_enabled (false)
548#define pm_debug_messages_on (false)570#define pm_debug_messages_on (false)
549 571
550#include <linux/printk.h>572#include <linux/printk.h>
551 573
552#define __pm_pr_dbg(defer, fmt, ...) \574#define __pm_pr_dbg(fmt, ...) \
553 no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)575 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
576#define __pm_deferred_pr_dbg(fmt, ...) \
577 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
554#endif578#endif
555 579
580/**
581 * pm_pr_dbg - print pm sleep debug messages
582 *
583 * If pm_debug_messages_on is enabled, print message.
584 * If pm_debug_messages_on is disabled and CONFIG_DYNAMIC_DEBUG is enabled,
585 * print message only from instances explicitly enabled on dynamic debug's
586 * control.
587 * If pm_debug_messages_on is disabled and CONFIG_DYNAMIC_DEBUG is disabled,
588 * don't print message.
589 */
556#define pm_pr_dbg(fmt, ...) \590#define pm_pr_dbg(fmt, ...) \
557 __pm_pr_dbg(false, fmt, ##__VA_ARGS__)591 __pm_pr_dbg(fmt, ##__VA_ARGS__)
558 592
559#define pm_deferred_pr_dbg(fmt, ...) \593#define pm_deferred_pr_dbg(fmt, ...) \
560 __pm_pr_dbg(true, fmt, ##__VA_ARGS__)594 __pm_deferred_pr_dbg(fmt, ##__VA_ARGS__)
561 595
562#ifdef CONFIG_PM_AUTOSLEEP596#ifdef CONFIG_PM_AUTOSLEEP
563 597
include/soc/rockchip/pm_domains.h+25−0
@@ -0,0 +1,25 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2022, The Chromium OS Authors. All rights reserved.
4 */
5
6#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H__
7#define __SOC_ROCKCHIP_PM_DOMAINS_H__
8
9#ifdef CONFIG_ROCKCHIP_PM_DOMAINS
10
11int rockchip_pmu_block(void);
12void rockchip_pmu_unblock(void);
13
14#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
15
16static inline int rockchip_pmu_block(void)
17{
18 return 0;
19}
20
21static inline void rockchip_pmu_unblock(void) { }
22
23#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
24
25#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */