blob: 3fc3fdc1804e6875d396f26f7ff417b623a20347 [file] [log] [blame]
/*
* 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;
};