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 
14 struct active_trip {
15 	int temp;
16 	int id;
17 	bool valid;
18 };
19 
20 struct int34x_thermal_zone {
21 	struct acpi_device *adev;
22 	struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
23 	unsigned long *aux_trips;
24 	int aux_trip_nr;
25 	int psv_temp;
26 	int psv_trip_id;
27 	int crt_temp;
28 	int crt_trip_id;
29 	int hot_temp;
30 	int hot_trip_id;
31 	struct thermal_zone_device *zone;
32 	struct thermal_zone_device_ops *override_ops;
33 	void *priv_data;
34 	struct acpi_lpat_conversion_table *lpat_table;
35 };
36 
37 struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
38 				struct thermal_zone_device_ops *override_ops);
39 void int340x_thermal_zone_remove(struct int34x_thermal_zone *);
40 int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone);
41 
42 static inline void int340x_thermal_zone_set_priv_data(
43 			struct int34x_thermal_zone *tzone, void *priv_data)
44 {
45 	tzone->priv_data = priv_data;
46 }
47 
48 static inline void *int340x_thermal_zone_get_priv_data(
49 			struct int34x_thermal_zone *tzone)
50 {
51 	return tzone->priv_data;
52 }
53 
54 static inline void int340x_thermal_zone_device_update(
55 					struct int34x_thermal_zone *tzone,
56 					enum thermal_notify_event event)
57 {
58 	thermal_zone_device_update(tzone->zone, event);
59 }
60 
61 #endif
62