1/* 2 * Copyright (C) 2016 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@1.0; 18 19/** Device temperature types */ 20@export 21enum TemperatureType : int32_t { 22 UNKNOWN = -1, 23 CPU = 0, 24 GPU = 1, 25 BATTERY = 2, 26 SKIN = 3, 27}; 28 29enum CoolingType : uint32_t { 30 /** Fan cooling device speed in RPM. */ 31 FAN_RPM = 0, 32}; 33 34struct Temperature { 35 /** 36 * This temperature's type. 37 */ 38 TemperatureType type; 39 40 /** 41 * Name of this temperature. 42 * All temperatures of the same "type" must have a different "name", 43 * e.g., cpu0, battery. 44 */ 45 string name; 46 47 /** 48 * Current temperature in Celsius. If not available set by HAL to NAN. 49 * Current temperature can be in any units if type=UNKNOWN. 50 */ 51 float currentValue; 52 53 /** 54 * Throttling temperature constant for this temperature. 55 * If not available, set by HAL to NAN. 56 */ 57 float throttlingThreshold; 58 59 /** 60 * Shutdown temperature constant for this temperature. 61 * If not available, set by HAL to NAN. 62 */ 63 float shutdownThreshold; 64 65 /** 66 * Threshold temperature above which the VR mode clockrate minimums cannot 67 * be maintained for this device. 68 * If not available, set by HAL to NAN. 69 */ 70 float vrThrottlingThreshold; 71 72}; 73 74struct CoolingDevice { 75 /** 76 * This cooling device type. 77 */ 78 CoolingType type; 79 80 /** 81 * Name of this cooling device. 82 * All cooling devices of the same "type" must have a different "name". 83 */ 84 string name; 85 86 /** 87 * Current cooling device value. Units depend on cooling device "type". 88 */ 89 float currentValue; 90 91}; 92 93struct CpuUsage { 94 /** 95 * Name of this CPU. 96 * All CPUs must have a different "name". 97 */ 98 string name; 99 100 /** 101 * Active time since the last boot in ms. 102 */ 103 uint64_t active; 104 105 /** 106 * Total time since the last boot in ms. 107 */ 108 uint64_t total; 109 110 /** 111 * Is set to true when a core is online. 112 * If the core is offline, all other members except |name| should be ignored. 113 */ 114 bool isOnline; 115 116}; 117 118enum ThermalStatusCode : uint32_t { 119 /** No errors. */ 120 SUCCESS = 0, 121 /** Unknown failure occured. */ 122 FAILURE = 1 123}; 124 125/** 126 * Generic structure to return the status of any thermal operation. 127 */ 128struct ThermalStatus { 129 ThermalStatusCode code; 130 131 /** 132 * A specific error message to provide more information. 133 * This can be used for debugging purposes only. 134 */ 135 string debugMessage; 136}; 137