• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.thermal@2.0;
18
19import android.hardware.thermal@1.0::types;
20
21/** Device temperature types */
22enum TemperatureType : @1.0::TemperatureType {
23    USB_PORT = 4,
24    POWER_AMPLIFIER = 5,
25
26    /** Battery Charge Limit - virtual thermal sensors */
27    BCL_VOLTAGE = 6,
28    BCL_CURRENT = 7,
29    BCL_PERCENTAGE = 8,
30
31    /**  Neural Processing Unit */
32    NPU = 9,
33};
34
35
36/** Device cooling device types */
37enum CoolingType : uint32_t {
38    FAN,
39    BATTERY,
40    CPU,
41    GPU,
42    MODEM,
43    NPU,
44    COMPONENT, // for the rest of components
45};
46
47/** Device throttling severity */
48enum ThrottlingSeverity : uint32_t {
49    /**
50     * Not under throttling.
51     */
52    NONE = 0,
53
54    /**
55     * Light throttling where UX is not impacted.
56     */
57    LIGHT,
58
59    /**
60     * Moderate throttling where UX is not largely impacted.
61     */
62    MODERATE,
63
64    /**
65     * Severe throttling where UX is largely impacted.
66     * Similar to 1.0 throttlingThreshold.
67     */
68    SEVERE,
69
70    /**
71     * Platform has done everything to reduce power.
72     */
73    CRITICAL,
74
75    /**
76     * Key components in platform are shutting down due to thermal condition.
77     * Device functionalities will be limited.
78     */
79    EMERGENCY,
80
81    /**
82     * Need shutdown immediately.
83     */
84    SHUTDOWN,
85};
86
87struct TemperatureThreshold {
88    /**
89     * This temperature's type.
90     */
91    TemperatureType type;
92
93    /**
94     * Name of this temperature matching the Temperature struct.
95     * All temperatures of the same "type" must have a different "name",
96     * e.g., cpu0, battery. Clients use it to match Temperature struct.
97     */
98    string name;
99
100    /**
101     * Hot throttling temperature constant for this temperature sensor in
102     * level defined in ThrottlingSeverity including shutdown. Throttling
103     * happens when temperature >= threshold. If not available, set to NAN.
104     * Unit is same as Temperature's value.
105     */
106    float[ThrottlingSeverity#len] hotThrottlingThresholds;
107
108    /**
109     * Cold throttling temperature constant for this temperature sensor in
110     * level defined in ThrottlingSeverity including shutdown. Throttling
111     * happens when temperature <= threshold. If not available, set to NAN.
112     * Unit is same as Temperature's value.
113     */
114    float[ThrottlingSeverity#len] coldThrottlingThresholds;
115
116    /**
117     * Threshold temperature above which the VR mode clockrate minimums cannot
118     * be maintained for this device. If not available, set by HAL to NAN.
119     * Unit is same as Temperature's value.
120     */
121    float vrThrottlingThreshold;
122};
123
124struct Temperature {
125    /**
126     * This temperature's type.
127     */
128    TemperatureType type;
129
130    /**
131     * Name of this temperature matching the TemperatureThreshold.
132     * All temperatures of the same "type" must have a different "name",
133     * e.g., cpu0, battery. Clients use it to match with TemperatureThreshold
134     * struct.
135     */
136    string name;
137
138    /**
139     * For BCL, this is the current reading of the virtual sensor and the unit is
140     * millivolt, milliamp, percentage for BCL_VOLTAGE, BCL_CURRENT and BCL_PERCENTAGE
141     * respectively. For everything else, this is the current temperature in Celsius.
142     * If not available set by HAL to NAN.
143     */
144    float value;
145
146    /**
147     * The current throttling level of the sensor.
148     */
149    ThrottlingSeverity throttlingStatus;
150};
151
152struct CoolingDevice {
153    /**
154     * This cooling device type, CPU, GPU, BATTERY, and etc.
155     */
156    CoolingType type;
157
158    /**
159     * Name of this cooling device.
160     * All cooling devices of the same "type" must have a different "name".
161     * The name is usually defined in kernel device tree, and this is for client
162     * logging purpose.
163     */
164    string name;
165
166    /**
167     * Current throttle state of the cooling device. The value can any unsigned integer
168     * numbers between 0 and max_state defined in its driver, usually representing the
169     * associated device's power state. 0 means device is not in throttling, higher value
170     * means deeper throttling.
171     */
172    uint64_t value;
173};
174