diff options
author | Ram Chandrasekar <rkumbako@codeaurora.org> | 2020-08-25 14:25:14 -0700 |
---|---|---|
committer | Ram Chandrasekar <rkumbako@codeaurora.org> | 2020-08-27 17:33:34 -0700 |
commit | f020a1da7e6c51ba4e6b68c3577876bdd8b0a1a0 (patch) | |
tree | 6adf7e42252cf60d20deb01f18183beee95df46e /thermalCommon.cpp | |
parent | 1003d3731b5b37e509a0886b73b9a895c2e05864 (diff) |
thermal-hal: Return empty vector when a sensor is not supported
Right now the thermal HAL will return a temperature, temperature
threshold and cooling device entry with a NAN value for a sensor that is
not supported. This will break the VTS test case, which expects an empty
vector in that case.
Change the thermal HAL to return empty vector in case the sensor is not
supported.
Also populate the thresholds value for CPU, GPU, Battery and skin
sensors for the V1.0 getTemperature API. Make sure that the threshold
values are also read in degree celsius.
Change-Id: I82ab1e9dd9672f1b93760e93b55e8943fc5acce0
Diffstat (limited to 'thermalCommon.cpp')
-rw-r--r-- | thermalCommon.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/thermalCommon.cpp b/thermalCommon.cpp index 308086c..2e981dd 100644 --- a/thermalCommon.cpp +++ b/thermalCommon.cpp @@ -249,21 +249,21 @@ int ThermalCommon::initialize_sensor(struct target_therm_cfg cfg, int sens_idx) if (cfg.throt_thresh != 0 && cfg.positive_thresh_ramp) sensor.thresh.hotThrottlingThresholds[(size_t)ThrottlingSeverity::SEVERE - 1] = - cfg.throt_thresh; + cfg.throt_thresh / (float)sensor.mulFactor; else if (cfg.throt_thresh != 0 && !cfg.positive_thresh_ramp) sensor.thresh.coldThrottlingThresholds[(size_t)ThrottlingSeverity::SEVERE - 1] = - cfg.throt_thresh; + cfg.throt_thresh / (float)sensor.mulFactor; if (cfg.shutdwn_thresh != 0 && cfg.positive_thresh_ramp) sensor.thresh.hotThrottlingThresholds[(size_t)ThrottlingSeverity::SHUTDOWN - 1] = - cfg.shutdwn_thresh; + cfg.shutdwn_thresh / (float)sensor.mulFactor; else if (cfg.shutdwn_thresh != 0 && !cfg.positive_thresh_ramp) sensor.thresh.coldThrottlingThresholds[(size_t)ThrottlingSeverity::SHUTDOWN - 1] = - cfg.shutdwn_thresh; + cfg.shutdwn_thresh / (float)sensor.mulFactor; if (cfg.vr_thresh != 0) sensor.thresh.vrThrottlingThreshold = - cfg.vr_thresh; + cfg.vr_thresh / (float)sensor.mulFactor; sens.push_back(sensor); //read_temperature((struct therm_sensor *)sensor); @@ -394,7 +394,7 @@ int ThermalCommon::estimateSeverity(struct therm_sensor *sensor) { int idx = 0; ThrottlingSeverity severity = ThrottlingSeverity::NONE; - float temp = sensor->t.value * sensor->mulFactor; + float temp = sensor->t.value; for (idx = (int)ThrottlingSeverity::SHUTDOWN - 1; idx >= 0; idx--) { if ((sensor->positiveThresh && @@ -477,7 +477,8 @@ void ThermalCommon::initThreshold(struct therm_sensor sensor) || idx <= ((int)sensor.t.throttlingStatus) - 1) continue; - next_trip = sensor.thresh.hotThrottlingThresholds[idx]; + next_trip = sensor.thresh.hotThrottlingThresholds[idx] * + sensor.mulFactor; break; } @@ -490,7 +491,8 @@ void ThermalCommon::initThreshold(struct therm_sensor sensor) } if (sensor.t.throttlingStatus != ThrottlingSeverity::NONE) { curr_trip = sensor.thresh.hotThrottlingThresholds[ - (int)sensor.t.throttlingStatus - 1]; + (int)sensor.t.throttlingStatus - 1] + * sensor.mulFactor; if (!isnan(next_trip)) hyst_temp = (next_trip - curr_trip) + DEFAULT_HYSTERESIS; else |