1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ACPI_ACPI_THERMAL_H
3 #define __ACPI_ACPI_THERMAL_H
4 
5 #include <asm/ioctl.h>
6 
7 #define ACPI_THERMAL_MAGIC 's'
8 
9 #define ACPI_THERMAL_GET_TRT_LEN _IOR(ACPI_THERMAL_MAGIC, 1, unsigned long)
10 #define ACPI_THERMAL_GET_ART_LEN _IOR(ACPI_THERMAL_MAGIC, 2, unsigned long)
11 #define ACPI_THERMAL_GET_TRT_COUNT _IOR(ACPI_THERMAL_MAGIC, 3, unsigned long)
12 #define ACPI_THERMAL_GET_ART_COUNT _IOR(ACPI_THERMAL_MAGIC, 4, unsigned long)
13 
14 #define ACPI_THERMAL_GET_TRT	_IOR(ACPI_THERMAL_MAGIC, 5, unsigned long)
15 #define ACPI_THERMAL_GET_ART	_IOR(ACPI_THERMAL_MAGIC, 6, unsigned long)
16 
17 struct art {
18 	acpi_handle source;
19 	acpi_handle target;
20 	struct_group(data,
21 		u64 weight;
22 		u64 ac0_max;
23 		u64 ac1_max;
24 		u64 ac2_max;
25 		u64 ac3_max;
26 		u64 ac4_max;
27 		u64 ac5_max;
28 		u64 ac6_max;
29 		u64 ac7_max;
30 		u64 ac8_max;
31 		u64 ac9_max;
32 	);
33 } __packed;
34 
35 struct trt {
36 	acpi_handle source;
37 	acpi_handle target;
38 	u64 influence;
39 	u64 sample_period;
40 	u64 reserved1;
41 	u64 reserved2;
42 	u64 reserved3;
43 	u64 reserved4;
44 } __packed;
45 
46 #define ACPI_NR_ART_ELEMENTS 13
47 /* for usrspace */
48 union art_object {
49 	struct {
50 		char source_device[8]; /* ACPI single name */
51 		char target_device[8]; /* ACPI single name */
52 		struct_group(data,
53 			u64 weight;
54 			u64 ac0_max_level;
55 			u64 ac1_max_level;
56 			u64 ac2_max_level;
57 			u64 ac3_max_level;
58 			u64 ac4_max_level;
59 			u64 ac5_max_level;
60 			u64 ac6_max_level;
61 			u64 ac7_max_level;
62 			u64 ac8_max_level;
63 			u64 ac9_max_level;
64 		);
65 	};
66 	u64 __data[ACPI_NR_ART_ELEMENTS];
67 };
68 
69 union trt_object {
70 	struct {
71 		char source_device[8]; /* ACPI single name */
72 		char target_device[8]; /* ACPI single name */
73 		u64 influence;
74 		u64 sample_period;
75 		u64 reserved[4];
76 	};
77 	u64 __data[8];
78 };
79 
80 #ifdef __KERNEL__
81 int acpi_thermal_rel_misc_device_add(acpi_handle handle);
82 int acpi_thermal_rel_misc_device_remove(acpi_handle handle);
83 int acpi_parse_art(acpi_handle handle, int *art_count, struct art **arts,
84 		bool create_dev);
85 int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trts,
86 		bool create_dev);
87 #endif
88 
89 #endif /* __ACPI_ACPI_THERMAL_H */
90