Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * cpuidle.h - The internal header file
0004  */
0005 
0006 #ifndef __DRIVER_CPUIDLE_H
0007 #define __DRIVER_CPUIDLE_H
0008 
0009 /* For internal use only */
0010 extern char param_governor[];
0011 extern struct cpuidle_governor *cpuidle_curr_governor;
0012 extern struct cpuidle_governor *cpuidle_prev_governor;
0013 extern struct list_head cpuidle_governors;
0014 extern struct list_head cpuidle_detected_devices;
0015 extern struct mutex cpuidle_lock;
0016 extern spinlock_t cpuidle_driver_lock;
0017 extern int cpuidle_disabled(void);
0018 extern int cpuidle_enter_state(struct cpuidle_device *dev,
0019         struct cpuidle_driver *drv, int next_state);
0020 
0021 /* idle loop */
0022 extern void cpuidle_install_idle_handler(void);
0023 extern void cpuidle_uninstall_idle_handler(void);
0024 
0025 /* governors */
0026 extern struct cpuidle_governor *cpuidle_find_governor(const char *str);
0027 extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
0028 
0029 /* sysfs */
0030 
0031 struct device;
0032 
0033 extern int cpuidle_add_interface(struct device *dev);
0034 extern void cpuidle_remove_interface(struct device *dev);
0035 extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
0036 extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
0037 extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
0038 extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
0039 
0040 #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
0041 bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
0042 int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
0043 int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
0044         struct cpuidle_driver *drv, int next_state);
0045 int cpuidle_coupled_register_device(struct cpuidle_device *dev);
0046 void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
0047 #else
0048 static inline
0049 bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
0050 {
0051     return false;
0052 }
0053 
0054 static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
0055 {
0056     return 0;
0057 }
0058 
0059 static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
0060         struct cpuidle_driver *drv, int next_state)
0061 {
0062     return -1;
0063 }
0064 
0065 static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
0066 {
0067     return 0;
0068 }
0069 
0070 static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
0071 {
0072 }
0073 #endif
0074 
0075 #endif /* __DRIVER_CPUIDLE_H */