powerstats: set AoC clock for timestamp calculations am: 7dfafc70a0 am: f2ab4a72d9

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

Change-Id: If50d83b0a421321380a345d48356521d55a93ae2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Darren Hsu 2022-06-21 04:26:44 +00:00 committed by Automerger Merge Worker
commit 1ab531d5eb

View file

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