xref: /linux/drivers/acpi/fan.h (revision 9bbf8e17d8521211c5c5516ed5ec78d7581aacff)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * ACPI fan device IDs are shared between the fan driver and the device power
5  * management code.
6  *
7  * Add new device IDs before the generic ACPI fan one.
8  */
9 
10 #ifndef _ACPI_FAN_H_
11 #define _ACPI_FAN_H_
12 
13 #include <linux/kconfig.h>
14 
15 #define ACPI_FAN_DEVICE_IDS	\
16 	{"INT3404", }, /* Fan */ \
17 	{"INTC1044", }, /* Fan for Tiger Lake generation */ \
18 	{"INTC1048", }, /* Fan for Alder Lake generation */ \
19 	{"INTC1063", }, /* Fan for Meteor Lake generation */ \
20 	{"INTC106A", }, /* Fan for Lunar Lake generation */ \
21 	{"INTC10A2", }, /* Fan for Raptor Lake generation */ \
22 	{"INTC10D6", }, /* Fan for Panther Lake generation */ \
23 	{"INTC10FE", }, /* Fan for Wildcat Lake generation */ \
24 	{"PNP0C0B", } /* Generic ACPI fan */
25 
26 #define ACPI_FPS_NAME_LEN	20
27 
28 struct acpi_fan_fps {
29 	u64 control;
30 	u64 trip_point;
31 	u64 speed;
32 	u64 noise_level;
33 	u64 power;
34 	char name[ACPI_FPS_NAME_LEN];
35 	struct device_attribute dev_attr;
36 };
37 
38 struct acpi_fan_fif {
39 	u8 revision;
40 	u8 fine_grain_ctrl;
41 	u8 step_size;
42 	u8 low_speed_notification;
43 };
44 
45 struct acpi_fan_fst {
46 	u64 revision;
47 	u64 control;
48 	u64 speed;
49 };
50 
51 struct acpi_fan {
52 	bool acpi4;
53 	bool has_fst;
54 	struct acpi_fan_fif fif;
55 	struct acpi_fan_fps *fps;
56 	int fps_count;
57 	struct thermal_cooling_device *cdev;
58 	struct device_attribute fst_speed;
59 	struct device_attribute fine_grain_control;
60 };
61 
62 int acpi_fan_get_fst(struct acpi_device *device, struct acpi_fan_fst *fst);
63 int acpi_fan_create_attributes(struct acpi_device *device);
64 void acpi_fan_delete_attributes(struct acpi_device *device);
65 
66 #if IS_REACHABLE(CONFIG_HWMON)
67 int devm_acpi_fan_create_hwmon(struct acpi_device *device);
68 #else
devm_acpi_fan_create_hwmon(struct acpi_device * device)69 static inline int devm_acpi_fan_create_hwmon(struct acpi_device *device) { return 0; };
70 #endif
71 
72 #endif
73