diff options
author | Wei Wang <wvw@google.com> | 2018-10-25 19:22:25 -0700 |
---|---|---|
committer | Wei Wang <wvw@google.com> | 2018-10-26 11:01:23 -0700 |
commit | c4c2559e9aea3ca72f1bdc1ce6c22ea28630871f (patch) | |
tree | ee171f9b4ee8136f8dc0f5ff5ea81babc08a28c0 /thermal | |
parent | 2399c3054470e673712343d0fb0d6df44ffb2e9e (diff) |
ThermalHAL: add BCL to temperature type
Bug: 116540200
Test: VTS test passed
Change-Id: I7cdf64a8ee55a9e14a9df673edaf25a5cd3a90d2
Diffstat (limited to 'thermal')
-rw-r--r-- | thermal/2.0/IThermal.hal | 8 | ||||
-rw-r--r-- | thermal/2.0/default/android.hardware.thermal@2.0-service.xml | 1 | ||||
-rw-r--r-- | thermal/2.0/types.hal | 17 | ||||
-rw-r--r-- | thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp | 6 |
4 files changed, 24 insertions, 8 deletions
diff --git a/thermal/2.0/IThermal.hal b/thermal/2.0/IThermal.hal index 548ac9dfe1..f890694d2c 100644 --- a/thermal/2.0/IThermal.hal +++ b/thermal/2.0/IThermal.hal @@ -42,7 +42,7 @@ interface IThermal extends @1.0::IThermal { generates (ThermalStatus status, vec<Temperature> temperatures); /** - * Retrieves temperature thresholds in Celsius. + * Retrieves static temperature thresholds in Celsius. * * @param filterType whether to filter the result for a given type. * @param type the TemperatureType such as battery or skin. @@ -54,7 +54,11 @@ interface IThermal extends @1.0::IThermal { * devices (such as CPUs, GPUs and etc.) in the list must be kept * the same regardless of the number of calls to this method even if * they go offline, if these devices exist on boot. The method - * always returns and never removes such temperatures. + * always returns and never removes such temperatures. The thresholds + * are returned as static values and must not change across calls. The actual + * throttling state is determined in driver and HAL and must not be simply + * compared with these thresholds. To get accurate throttling status, use + * getCurrentTemperatures or registerThermalChangedCallback and listen. */ getTemperatureThresholds(bool filterType, TemperatureType type) generates (ThermalStatus status, vec<TemperatureThreshold> temperatureThresholds); diff --git a/thermal/2.0/default/android.hardware.thermal@2.0-service.xml b/thermal/2.0/default/android.hardware.thermal@2.0-service.xml index c4c7d4d6e4..bcd6344bc4 100644 --- a/thermal/2.0/default/android.hardware.thermal@2.0-service.xml +++ b/thermal/2.0/default/android.hardware.thermal@2.0-service.xml @@ -2,6 +2,7 @@ <hal format="hidl"> <name>android.hardware.thermal</name> <transport>hwbinder</transport> + <version>1.0</version> <version>2.0</version> <interface> <name>IThermal</name> diff --git a/thermal/2.0/types.hal b/thermal/2.0/types.hal index 7b60d00743..4929e44ce8 100644 --- a/thermal/2.0/types.hal +++ b/thermal/2.0/types.hal @@ -22,6 +22,12 @@ import android.hardware.thermal@1.0::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, }; @@ -88,6 +94,7 @@ struct TemperatureThreshold { * 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[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] hotThrottlingThresholds; @@ -95,13 +102,14 @@ struct TemperatureThreshold { * 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[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] coldThrottlingThresholds; /** * Threshold temperature above which the VR mode clockrate minimums cannot - * be maintained for this device. - * If not available, set by HAL to NAN. + * be maintained for this device. If not available, set by HAL to NAN. + * Unit is same as Temperature's value. */ float vrThrottlingThreshold; }; @@ -121,7 +129,10 @@ struct Temperature { string name; /** - * Current temperature in Celsius. If not available set by HAL to NAN. + * 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; diff --git a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp index 535f618d8c..cf1956dab3 100644 --- a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp +++ b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp @@ -23,6 +23,7 @@ #include <VtsHalHidlTargetTestEnvBase.h> using ::android::sp; +using ::android::hardware::hidl_enum_range; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; @@ -183,9 +184,8 @@ TEST_F(ThermalHidlTest, TemperatureTest) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); } }); - for (int i = static_cast<int>(TemperatureType::UNKNOWN); - i <= static_cast<int>(TemperatureType::POWER_AMPLIFIER); ++i) { - auto type = static_cast<TemperatureType>(i); + auto types = hidl_enum_range<TemperatureType>(); + for (const auto& type : types) { mThermal->getCurrentTemperatures( true, type, [&type](ThermalStatus status, hidl_vec<Temperature> temperatures) { if (temperatures.size()) { |