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 	struct thermal_trip *trips;
24 	int aux_trip_nr;
25 	struct thermal_zone_device *zone;
26 	struct thermal_zone_device_ops *ops;
27 	void *priv_data;
28 	struct acpi_lpat_conversion_table *lpat_table;
29 };
30 
31 struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
32 				int (*get_temp) (struct thermal_zone_device *, int *));
33 void int340x_thermal_zone_remove(struct int34x_thermal_zone *);
34 void int340x_thermal_update_trips(struct int34x_thermal_zone *int34x_zone);
35 
int340x_thermal_zone_set_priv_data(struct int34x_thermal_zone * tzone,void * priv_data)36 static inline void int340x_thermal_zone_set_priv_data(
37 			struct int34x_thermal_zone *tzone, void *priv_data)
38 {
39 	tzone->priv_data = priv_data;
40 }
41 
int340x_thermal_zone_get_priv_data(struct int34x_thermal_zone * tzone)42 static inline void *int340x_thermal_zone_get_priv_data(
43 			struct int34x_thermal_zone *tzone)
44 {
45 	return tzone->priv_data;
46 }
47 
int340x_thermal_zone_device_update(struct int34x_thermal_zone * tzone,enum thermal_notify_event event)48 static inline void int340x_thermal_zone_device_update(
49 					struct int34x_thermal_zone *tzone,
50 					enum thermal_notify_event event)
51 {
52 	thermal_zone_device_update(tzone->zone, event);
53 }
54 
55 #endif
56