blob: 5f3ba4775c5cdd49945bf006b05cdb263d2cc4ac [file] [log] [blame]
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -08001/*
2 * int340x_thermal_zone.h
3 * Copyright (c) 2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __INT340X_THERMAL_ZONE_H__
17#define __INT340X_THERMAL_ZONE_H__
18
Srinivas Pandruvada317d9dd2015-01-28 11:56:48 -080019#include <acpi/acpi_lpat.h>
20
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080021#define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
22
23struct active_trip {
Sascha Hauer17e83512015-07-24 08:12:54 +020024 int temp;
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080025 int id;
26 bool valid;
27};
28
29struct int34x_thermal_zone {
30 struct acpi_device *adev;
31 struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
32 unsigned long *aux_trips;
33 int aux_trip_nr;
Sascha Hauer17e83512015-07-24 08:12:54 +020034 int psv_temp;
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080035 int psv_trip_id;
Sascha Hauer17e83512015-07-24 08:12:54 +020036 int crt_temp;
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080037 int crt_trip_id;
Sascha Hauer17e83512015-07-24 08:12:54 +020038 int hot_temp;
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080039 int hot_trip_id;
40 struct thermal_zone_device *zone;
41 struct thermal_zone_device_ops *override_ops;
42 void *priv_data;
Srinivas Pandruvada317d9dd2015-01-28 11:56:48 -080043 struct acpi_lpat_conversion_table *lpat_table;
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080044};
45
46struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
47 struct thermal_zone_device_ops *override_ops);
48void int340x_thermal_zone_remove(struct int34x_thermal_zone *);
Srinivas Pandruvada9176ae82016-08-26 16:21:18 -070049int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone);
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080050
51static inline void int340x_thermal_zone_set_priv_data(
52 struct int34x_thermal_zone *tzone, void *priv_data)
53{
54 tzone->priv_data = priv_data;
55}
56
57static inline void *int340x_thermal_zone_get_priv_data(
58 struct int34x_thermal_zone *tzone)
59{
60 return tzone->priv_data;
61}
62
63static inline void int340x_thermal_zone_device_update(
Srinivas Pandruvada9176ae82016-08-26 16:21:18 -070064 struct int34x_thermal_zone *tzone,
65 enum thermal_notify_event event)
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080066{
Srinivas Pandruvada9176ae82016-08-26 16:21:18 -070067 thermal_zone_device_update(tzone->zone, event);
Srinivas Pandruvada5fbf7f22015-01-16 15:59:03 -080068}
69
70#endif