blob: d6613101af9246ee112df42c36a5abd2d63ceb56 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Len Brown4f86d3a2007-10-03 18:58:00 -04002/*
3 * cpuidle.h - The internal header file
4 */
5
6#ifndef __DRIVER_CPUIDLE_H
7#define __DRIVER_CPUIDLE_H
8
Len Brown4f86d3a2007-10-03 18:58:00 -04009/* For internal use only */
Rafael J. Wysocki61cb5752018-12-05 23:45:34 +010010extern char param_governor[];
Len Brown4f86d3a2007-10-03 18:58:00 -040011extern struct cpuidle_governor *cpuidle_curr_governor;
Len Brown4f86d3a2007-10-03 18:58:00 -040012extern struct list_head cpuidle_governors;
13extern struct list_head cpuidle_detected_devices;
14extern struct mutex cpuidle_lock;
15extern spinlock_t cpuidle_driver_lock;
Len Brown62027ae2011-04-01 18:13:10 -040016extern int cpuidle_disabled(void);
Colin Cross56cfbf72012-05-07 17:57:39 -070017extern int cpuidle_enter_state(struct cpuidle_device *dev,
18 struct cpuidle_driver *drv, int next_state);
Len Brown4f86d3a2007-10-03 18:58:00 -040019
20/* idle loop */
21extern void cpuidle_install_idle_handler(void);
22extern void cpuidle_uninstall_idle_handler(void);
23
24/* governors */
25extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
26
27/* sysfs */
Daniel Lezcano8f3e9952012-10-31 01:09:02 +010028
29struct device;
30
Kay Sievers8a25a2f2011-12-21 14:29:42 -080031extern int cpuidle_add_interface(struct device *dev);
32extern void cpuidle_remove_interface(struct device *dev);
Daniel Lezcanobf4d1b52012-10-31 16:44:48 +000033extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
34extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
Daniel Lezcano1aef40e2012-10-26 12:26:24 +020035extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
36extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
Len Brown4f86d3a2007-10-03 18:58:00 -040037
Colin Cross4126c012012-05-07 17:57:41 -070038#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
Xunlei Pang4c1ed5a2015-08-04 13:48:56 +080039bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
Xunlei Pangabceaa92015-08-31 11:34:05 +080040int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
Colin Cross4126c012012-05-07 17:57:41 -070041int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
42 struct cpuidle_driver *drv, int next_state);
43int cpuidle_coupled_register_device(struct cpuidle_device *dev);
44void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
45#else
Xunlei Pang4c1ed5a2015-08-04 13:48:56 +080046static inline
47bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
Colin Cross4126c012012-05-07 17:57:41 -070048{
49 return false;
50}
51
Xunlei Pangabceaa92015-08-31 11:34:05 +080052static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
53{
54 return 0;
55}
56
Colin Cross4126c012012-05-07 17:57:41 -070057static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
58 struct cpuidle_driver *drv, int next_state)
59{
60 return -1;
61}
62
63static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
64{
65 return 0;
66}
67
68static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
69{
70}
71#endif
72
Len Brown4f86d3a2007-10-03 18:58:00 -040073#endif /* __DRIVER_CPUIDLE_H */