blob: 93eb5cc4d3e44acf09cf6b617e766de0d3a0bf3b [file] [log] [blame]
Ram Chandrasekardac8f7d2020-06-10 12:23:28 -07001/*
2 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 * * Neither the name of The Linux Foundation nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 *
18 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef THERMAL_THERMAL_DATA_H__
32#define THERMAL_THERMAL_DATA_H__
33
34#include <vector>
35#include <string>
36#include <mutex>
37#include <cmath>
38
39#include <android/hardware/thermal/2.0/IThermal.h>
40
41#define UNKNOWN_TEMPERATURE (NAN)
42
43namespace android {
44namespace hardware {
45namespace thermal {
46namespace V2_0 {
47namespace implementation {
48
49using ::android::hardware::hidl_vec;
50using ::android::hardware::thermal::V1_0::CpuUsage;
51using CoolingDevice_1_0 = ::android::hardware::thermal::V1_0::CoolingDevice;
52using Temperature_1_0 = ::android::hardware::thermal::V1_0::Temperature;
53using TemperatureType_1_0 = ::android::hardware::thermal::V1_0::TemperatureType;
54using ::android::hardware::thermal::V1_0::ThermalStatus;
55using ::android::hardware::thermal::V1_0::ThermalStatusCode;
56
57using cdevType = ::android::hardware::thermal::V2_0::CoolingType;
58using CoolingDevice = ::android::hardware::thermal::V2_0::CoolingDevice;
59using Temperature = ::android::hardware::thermal::V2_0::Temperature;
60using TemperatureType = ::android::hardware::thermal::V2_0::TemperatureType;
61using TemperatureThreshold =
62 ::android::hardware::thermal::V2_0::TemperatureThreshold;
63using ::android::hardware::thermal::V2_0::ThrottlingSeverity;
64
65 struct target_therm_cfg {
66 TemperatureType type;
67 std::vector<std::string> sensor_list;
68 std::string label;
69 int throt_thresh;
70 int shutdwn_thresh;
71 int vr_thresh;
72 bool positive_thresh_ramp;
73 };
74
75 struct therm_sensor {
76 int tzn;
77 int mulFactor;
78 bool positiveThresh;
79 std::string sensor_name;
80 ThrottlingSeverity lastThrottleStatus;
81 Temperature t;
82 TemperatureThreshold thresh;
83 };
84
85 struct therm_cdev {
86 int cdevn;
87 CoolingDevice c;
88 };
89
90} // namespace implementation
91} // namespace V2_0
92} // namespace thermal
93} // namespace hardware
94} // namespace android
95
96#endif // THERMAL_THERMAL_DATA_H__