• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _MSM_THERMAL_IOCTL_H
2 #define _MSM_THERMAL_IOCTL_H
3 
4 #include <linux/ioctl.h>
5 
6 #define MSM_THERMAL_IOCTL_NAME "msm_thermal_query"
7 #define MSM_IOCTL_FREQ_SIZE 16
8 
9 struct __attribute__((__packed__)) cpu_freq_arg {
10 	uint32_t cpu_num;
11 	uint32_t freq_req;
12 };
13 
14 struct __attribute__((__packed__)) clock_plan_arg {
15 	uint32_t cluster_num;
16 	/*
17 	** A value of zero for freq_table_len, will fetch the length of the
18 	** cluster frequency table. A non-zero value will fetch the frequency
19 	** table contents.
20 	*/
21 	uint32_t freq_table_len;
22 	/*
23 	** For clusters with frequency table length greater than
24 	** MSM_IOCTL_FREQ_SIZE, the frequency table is fetched from kernel
25 	** in multiple sets or iterations. The set_idx variable,
26 	** indicates, which set/part of frequency table the user is requesting.
27 	** The set index value starts from zero. A set index value of 'Z',
28 	** will fetch MSM_IOCTL_FREQ_SIZE or maximum available number of
29 	** frequency values (if it is less than MSM_IOCTL_FREQ_SIZE)
30 	** from the frequency table, starting from the index
31 	** (Z * MSM_IOCTL_FREQ_SIZE).
32 	** For example, in a device supporting 19 different frequencies, a set
33 	** index value of 0 will fetch the first 16 (MSM_IOCTL_FREQ_SIZE)
34 	** frequencies starting from the index 0 and a set value of 1 will fetch
35 	** the remaining 3 frequencies starting from the index 16.
36 	** A successful get, will populate the freq_table_len with the
37 	** number of frequency table entries fetched.
38 	*/
39 	uint32_t set_idx;
40 	unsigned int freq_table[MSM_IOCTL_FREQ_SIZE];
41 };
42 
43 struct __attribute__((__packed__)) voltage_plan_arg {
44 	uint32_t cluster_num;
45 	uint32_t voltage_table_len;
46 	uint32_t set_idx;
47 	uint32_t voltage_table[MSM_IOCTL_FREQ_SIZE];
48 };
49 
50 struct __attribute__((__packed__)) msm_thermal_ioctl {
51 	uint32_t size;
52 	union {
53 		struct cpu_freq_arg cpu_freq;
54 		struct clock_plan_arg clock_freq;
55 		struct voltage_plan_arg voltage;
56 	};
57 };
58 
59 enum {
60 	/*Set CPU Frequency*/
61 	MSM_SET_CPU_MAX_FREQ = 0x00,
62 	MSM_SET_CPU_MIN_FREQ = 0x01,
63 	/*Set cluster frequency*/
64 	MSM_SET_CLUSTER_MAX_FREQ = 0x02,
65 	MSM_SET_CLUSTER_MIN_FREQ = 0x03,
66 	/*Get cluster frequency plan*/
67 	MSM_GET_CLUSTER_FREQ_PLAN = 0x04,
68 	/*Get cluster voltage plan */
69 	MSM_GET_CLUSTER_VOLTAGE_PLAN = 0x05,
70 	MSM_CMD_MAX_NR,
71 };
72 
73 #define MSM_THERMAL_MAGIC_NUM 0xCA /*Unique magic number*/
74 
75 #define MSM_THERMAL_SET_CPU_MAX_FREQUENCY _IOW(MSM_THERMAL_MAGIC_NUM,\
76 		MSM_SET_CPU_MAX_FREQ, struct msm_thermal_ioctl)
77 
78 #define MSM_THERMAL_SET_CPU_MIN_FREQUENCY _IOW(MSM_THERMAL_MAGIC_NUM,\
79 		MSM_SET_CPU_MIN_FREQ, struct msm_thermal_ioctl)
80 
81 #define MSM_THERMAL_SET_CLUSTER_MAX_FREQUENCY _IOW(MSM_THERMAL_MAGIC_NUM,\
82 		MSM_SET_CLUSTER_MAX_FREQ, struct msm_thermal_ioctl)
83 
84 #define MSM_THERMAL_SET_CLUSTER_MIN_FREQUENCY _IOW(MSM_THERMAL_MAGIC_NUM,\
85 		MSM_SET_CLUSTER_MIN_FREQ, struct msm_thermal_ioctl)
86 
87 #define MSM_THERMAL_GET_CLUSTER_FREQUENCY_PLAN _IOR(MSM_THERMAL_MAGIC_NUM,\
88 		MSM_GET_CLUSTER_FREQ_PLAN, struct msm_thermal_ioctl)
89 
90 #define MSM_THERMAL_GET_CLUSTER_VOLTAGE_PLAN _IOR(MSM_THERMAL_MAGIC_NUM,\
91 		MSM_GET_CLUSTER_VOLTAGE_PLAN, struct msm_thermal_ioctl)
92 #ifdef __KERNEL__
93 extern int msm_thermal_ioctl_init(void);
94 extern void msm_thermal_ioctl_cleanup(void);
95 #endif
96 
97 #endif
98