sm6250-common: Update thermal HAL

* From hardware/google/pixel at d774cbb949e98627e4172bf8fc11e8d954599aa7.

Change-Id: I3a3a0c29575d0595e71a30f1e64e33ca34d2eb27
This commit is contained in:
Alexander Winkowski
2021-10-12 13:00:29 +02:00
parent 27f575c973
commit 7f99605ccc
19 changed files with 2884 additions and 252 deletions

View File

@ -19,6 +19,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include "thermal_files.h"
@ -45,6 +46,7 @@ bool ThermalFiles::readThermalFile(std::string_view thermal_name, std::string *d
std::string file_path = getThermalFilePath(std::string_view(thermal_name));
*data = "";
if (file_path.empty()) {
PLOG(WARNING) << "Failed to find " << thermal_name << "'s path";
return false;
}
@ -58,6 +60,18 @@ bool ThermalFiles::readThermalFile(std::string_view thermal_name, std::string *d
return true;
}
bool ThermalFiles::writeCdevFile(std::string_view cdev_name, std::string_view data) {
std::string file_path =
getThermalFilePath(android::base::StringPrintf("%s_%s", cdev_name.data(), "w"));
if (!android::base::WriteStringToFile(data.data(), file_path)) {
PLOG(WARNING) << "Failed to write cdev: " << cdev_name << " to " << data.data();
return false;
}
return true;
}
} // namespace implementation
} // namespace V2_0
} // namespace thermal