xref: /linux/tools/power/cpupower/utils/helpers/sysfs.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 #ifndef __CPUPOWER_HELPERS_SYSFS_H__
2 #define __CPUPOWER_HELPERS_SYSFS_H__
3 
4 #define PATH_TO_CPU "/sys/devices/system/cpu/"
5 #define MAX_LINE_LEN 255
6 #define SYSFS_PATH_MAX 255
7 
8 extern unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen);
9 
10 extern unsigned int sysfs_idlestate_file_exists(unsigned int cpu,
11 						unsigned int idlestate,
12 						const char *fname);
13 
14 extern int sysfs_is_cpu_online(unsigned int cpu);
15 
16 extern int sysfs_is_idlestate_disabled(unsigned int cpu,
17 				       unsigned int idlestate);
18 extern int sysfs_idlestate_disable(unsigned int cpu, unsigned int idlestate,
19 				   unsigned int disable);
20 extern unsigned long sysfs_get_idlestate_latency(unsigned int cpu,
21 						unsigned int idlestate);
22 extern unsigned long sysfs_get_idlestate_usage(unsigned int cpu,
23 					unsigned int idlestate);
24 extern unsigned long long sysfs_get_idlestate_time(unsigned int cpu,
25 						unsigned int idlestate);
26 extern char *sysfs_get_idlestate_name(unsigned int cpu,
27 				unsigned int idlestate);
28 extern char *sysfs_get_idlestate_desc(unsigned int cpu,
29 				unsigned int idlestate);
30 extern unsigned int sysfs_get_idlestate_count(unsigned int cpu);
31 
32 extern char *sysfs_get_cpuidle_governor(void);
33 extern char *sysfs_get_cpuidle_driver(void);
34 
35 extern int sysfs_get_sched(const char *smt_mc);
36 extern int sysfs_set_sched(const char *smt_mc, int val);
37 
38 #endif /* __CPUPOWER_HELPERS_SYSFS_H__ */
39