summaryrefslogtreecommitdiff
path: root/thermalCommon.h
diff options
context:
space:
mode:
authorRam Chandrasekar <rkumbako@codeaurora.org>2020-11-17 13:57:40 -0800
committerRam Chandrasekar <rkumbako@codeaurora.org>2020-11-18 16:32:02 -0800
commitdbc52fc76e6a41e75fa7ad49b5343e855ea8a821 (patch)
treeb7f3b8b38801ba5c3fac1d31c15a5f5cd29c1677 /thermalCommon.h
parent7273761a6e729d63b8983adee08cac52c8adb3ba (diff)
thermal-hal: Update the common data object with the status
thermal-hal has a hash map storing all the sensor instances. Use the same instance to read and update the temperature, update the severity and determine the next threshold based on severity. Not using the same instance can lead to a situation where the information is updated in the local copy rather than in the global copy in the hash map. Also change the return signature of the estimateseverity function to return the new severity value if it is changed. Otherwise it will return -1. This provided a mechanism for the caller's to know if there is any change in severity for that sensor. Change-Id: I34c2a271b505fea969db6f4a04321e63c0181ea7
Diffstat (limited to 'thermalCommon.h')
-rw-r--r--thermalCommon.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/thermalCommon.h b/thermalCommon.h
index 4375e1e..6a1b348 100644
--- a/thermalCommon.h
+++ b/thermalCommon.h
@@ -44,14 +44,14 @@ class ThermalCommon {
ThermalCommon();
~ThermalCommon() = default;
- int readFromFile(std::string_view path, std::string *out);
- int initThermalZones(std::vector<struct target_therm_cfg> cfg);
- void initThreshold(struct therm_sensor sens);
+ int readFromFile(std::string_view path, std::string& out);
+ int initThermalZones(std::vector<struct target_therm_cfg>& cfg);
+ void initThreshold(struct therm_sensor& sens);
int initCdev();
- int read_cdev_state(struct therm_cdev *cdev);
- int read_temperature(struct therm_sensor *sensor);
- int estimateSeverity(struct therm_sensor *sensor);
+ int read_cdev_state(struct therm_cdev& cdev);
+ int read_temperature(struct therm_sensor& sensor);
+ int estimateSeverity(struct therm_sensor& sensor);
int get_cpu_usages(hidl_vec<CpuUsage>& list);
std::vector<struct therm_sensor> fetch_sensor_list()
@@ -69,8 +69,8 @@ class ThermalCommon {
std::vector<struct therm_sensor> sens;
std::vector<struct therm_cdev> cdev;
- int initializeCpuSensor(struct target_therm_cfg cpu_cfg);
- int initialize_sensor(struct target_therm_cfg cfg,
+ int initializeCpuSensor(struct target_therm_cfg& cpu_cfg);
+ int initialize_sensor(struct target_therm_cfg& cfg,
int sens_idx);
};