powerstats: set time limit as timeout for AoC am: 334bd6d2ec am: 358498697c

Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs101/+/17799890

Change-Id: I7d7e8790f13418c60eca709ecf12720dc4c991aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Darren Hsu 2022-04-21 04:57:55 +00:00 committed by Automerger Merge Worker
commit fcd6f954aa

View file

@ -45,6 +45,7 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
constexpr char kBootHwSoCRev[] = "ro.boot.hw.soc.rev";
void addAoC(std::shared_ptr<PowerStats> p) {
static const uint64_t TIMEOUT_MILLIS = 120;
std::string prefix = "/sys/devices/platform/19000000.aoc/control/";
// Add AoC cores (a32, ff1, hf0, and hf1)
@ -57,7 +58,7 @@ void addAoC(std::shared_ptr<PowerStats> p) {
std::vector<std::pair<std::string, std::string>> coreStates = {
{"DWN", "off"}, {"RET", "retention"}, {"WFI", "wfi"}};
p->addStateResidencyDataProvider(std::make_unique<AocStateResidencyDataProvider>(coreIds,
coreStates));
coreStates, TIMEOUT_MILLIS));
// Add AoC voltage stats
std::vector<std::pair<std::string, std::string>> voltageIds = {
@ -68,7 +69,8 @@ void addAoC(std::shared_ptr<PowerStats> p) {
{"UUD", "ultra_underdrive"},
{"UD", "underdrive"}};
p->addStateResidencyDataProvider(
std::make_unique<AocStateResidencyDataProvider>(voltageIds, voltageStates));
std::make_unique<AocStateResidencyDataProvider>(voltageIds, voltageStates,
TIMEOUT_MILLIS));
// Add AoC monitor mode
std::vector<std::pair<std::string, std::string>> monitorIds = {
@ -78,7 +80,8 @@ void addAoC(std::shared_ptr<PowerStats> p) {
{"MON", "mode"},
};
p->addStateResidencyDataProvider(
std::make_unique<AocStateResidencyDataProvider>(monitorIds, monitorStates));
std::make_unique<AocStateResidencyDataProvider>(monitorIds, monitorStates,
TIMEOUT_MILLIS));
// Add AoC restart count
const GenericStateResidencyDataProvider::StateResidencyConfig restartCountConfig = {