xref: /linux/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * int340x_thermal_zone.h
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __INT340X_THERMAL_ZONE_H__
8 #define __INT340X_THERMAL_ZONE_H__
9 
10 #include <acpi/acpi_lpat.h>
11 
12 #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT	10
13 #define INT340X_THERMAL_MAX_TRIP_COUNT INT340X_THERMAL_MAX_ACT_TRIP_COUNT + 3
14 
15 struct active_trip {
16 	int temp;
17 	int id;
18 	bool valid;
19 };
20 
21 struct int34x_thermal_zone {
22 	struct acpi_device *adev;
23 	int aux_trip_nr;
24 	struct thermal_zone_device *zone;
25 	void *priv_data;
26 	struct acpi_lpat_conversion_table *lpat_table;
27 };
28 
29 struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
30 				int (*get_temp) (struct thermal_zone_device *, int *));
31 void int340x_thermal_zone_remove(struct int34x_thermal_zone *);
32 void int340x_thermal_update_trips(struct int34x_thermal_zone *int34x_zone);
33 
34 static inline void int340x_thermal_zone_set_priv_data(
35 			struct int34x_thermal_zone *tzone, void *priv_data)
36 {
37 	tzone->priv_data = priv_data;
38 }
39 
40 static inline void *int340x_thermal_zone_get_priv_data(
41 			struct int34x_thermal_zone *tzone)
42 {
43 	return tzone->priv_data;
44 }
45 
46 static inline void int340x_thermal_zone_device_update(
47 					struct int34x_thermal_zone *tzone,
48 					enum thermal_notify_event event)
49 {
50 	thermal_zone_device_update(tzone->zone, event);
51 }
52 
53 #endif
54