powerstats: update NFC sysfs path for ZumaPro

Bug: 291862254
Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest
Change-Id: I12d3d5601776e0e130d55e3078d2024a363599d1
Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
Darren Hsu 2023-11-15 14:23:26 +08:00
parent a9b726427b
commit 033e0f615b

View file

@ -32,6 +32,7 @@
#include <android/binder_manager.h> #include <android/binder_manager.h>
#include <android/binder_process.h> #include <android/binder_process.h>
#include <log/log.h> #include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::AdaptiveDvfsStateResidencyDataProvider; using aidl::android::hardware::power::stats::AdaptiveDvfsStateResidencyDataProvider;
using aidl::android::hardware::power::stats::AocStateResidencyDataProvider; using aidl::android::hardware::power::stats::AocStateResidencyDataProvider;
@ -661,6 +662,7 @@ void addZumaProCommonDataProviders(std::shared_ptr<PowerStats> p) {
} }
void addNFC(std::shared_ptr<PowerStats> p) { void addNFC(std::shared_ptr<PowerStats> p) {
const int I2C_COUNT = 10;
const GenericStateResidencyDataProvider::StateResidencyConfig nfcStateConfig = { const GenericStateResidencyDataProvider::StateResidencyConfig nfcStateConfig = {
.entryCountSupported = true, .entryCountSupported = true,
.entryCountPrefix = "Cumulative count:", .entryCountPrefix = "Cumulative count:",
@ -679,6 +681,14 @@ void addNFC(std::shared_ptr<PowerStats> p) {
cfgs.emplace_back(generateGenericStateResidencyConfigs(nfcStateConfig, nfcStateHeaders), cfgs.emplace_back(generateGenericStateResidencyConfigs(nfcStateConfig, nfcStateHeaders),
"NFC", "NFC subsystem"); "NFC", "NFC subsystem");
std::string path;
struct stat buffer;
for (int i = 0; i < I2C_COUNT; i++) {
std::string idx = std::to_string(i);
path = "/sys/devices/platform/10c90000.hsi2c/i2c-" + idx + "/" + idx + "-0008/power_stats";
if (!stat(path.c_str(), &buffer))
break;
}
p->addStateResidencyDataProvider(std::make_unique<GenericStateResidencyDataProvider>( p->addStateResidencyDataProvider(std::make_unique<GenericStateResidencyDataProvider>(
"/sys/devices/platform/10c90000.hsi2c/i2c-9/9-0008/power_stats", cfgs)); path, cfgs));
} }