summaryrefslogtreecommitdiff
path: root/thermal/2.0/types.hal
blob: 3fc3fdc1804e6875d396f26f7ff417b623a20347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.thermal@2.0;

import android.hardware.thermal@1.0::types;

/** Device temperature types */
enum TemperatureType : @1.0::TemperatureType {
    USB_PORT = 4,
    POWER_AMPLIFIER = 5,

    /** Battery Charge Limit - virtual thermal sensors */
    BCL_VOLTAGE = 6,
    BCL_CURRENT = 7,
    BCL_PERCENTAGE = 8,

    /**  Neural Processing Unit */
    NPU = 9,
};


/** Device cooling device types */
enum CoolingType : uint32_t {
    FAN,
    BATTERY,
    CPU,
    GPU,
    MODEM,
    NPU,
    COMPONENT, // for the rest of components
};

/** Device throttling severity */
enum ThrottlingSeverity : uint32_t {
    /**
     * Not under throttling.
     */
    NONE = 0,

    /**
     * Light throttling where UX is not impacted.
     */
    LIGHT,

    /**
     * Moderate throttling where UX is not largely impacted.
     */
    MODERATE,

    /**
     * Severe throttling where UX is largely impacted.
     * Similar to 1.0 throttlingThreshold.
     */
    SEVERE,

    /**
     * Platform has done everything to reduce power.
     */
    CRITICAL,

    /**
     * Key components in platform are shutting down due to thermal condition.
     * Device functionalities will be limited.
     */
    EMERGENCY,

    /**
     * Need shutdown immediately.
     */
    SHUTDOWN,
};

struct TemperatureThreshold {
    /**
     * This temperature's type.
     */
    TemperatureType type;

    /**
     * Name of this temperature matching the Temperature struct.
     * All temperatures of the same "type" must have a different "name",
     * e.g., cpu0, battery. Clients use it to match Temperature struct.
     */
    string name;

    /**
     * Hot throttling temperature constant for this temperature sensor in
     * level defined in ThrottlingSeverity including shutdown. Throttling
     * happens when temperature >= threshold. If not available, set to NAN.
     * Unit is same as Temperature's value.
     */
    float[ThrottlingSeverity#len] hotThrottlingThresholds;

    /**
     * Cold throttling temperature constant for this temperature sensor in
     * level defined in ThrottlingSeverity including shutdown. Throttling
     * happens when temperature <= threshold. If not available, set to NAN.
     * Unit is same as Temperature's value.
     */
    float[ThrottlingSeverity#len] coldThrottlingThresholds;

    /**
     * Threshold temperature above which the VR mode clockrate minimums cannot
     * be maintained for this device. If not available, set by HAL to NAN.
     * Unit is same as Temperature's value.
     */
    float vrThrottlingThreshold;
};

struct Temperature {
    /**
     * This temperature's type.
     */
    TemperatureType type;

    /**
     * Name of this temperature matching the TemperatureThreshold.
     * All temperatures of the same "type" must have a different "name",
     * e.g., cpu0, battery. Clients use it to match with TemperatureThreshold
     * struct.
     */
    string name;

    /**
     * For BCL, this is the current reading of the virtual sensor and the unit is
     * millivolt, milliamp, percentage for BCL_VOLTAGE, BCL_CURRENT and BCL_PERCENTAGE
     * respectively. For everything else, this is the current temperature in Celsius.
     * If not available set by HAL to NAN.
     */
    float value;

    /**
     * The current throttling level of the sensor.
     */
    ThrottlingSeverity throttlingStatus;
};

struct CoolingDevice {
    /**
     * This cooling device type, CPU, GPU, BATTERY, and etc.
     */
    CoolingType type;

    /**
     * Name of this cooling device.
     * All cooling devices of the same "type" must have a different "name".
     * The name is usually defined in kernel device tree, and this is for client
     * logging purpose.
     */
    string name;

    /**
     * Current throttle state of the cooling device. The value can any unsigned integer
     * numbers between 0 and max_state defined in its driver, usually representing the
     * associated device's power state. 0 means device is not in throttling, higher value
     * means deeper throttling.
     */
    uint64_t value;
};