1Feature details 2--------------- 3 4This feature is to track power consumption by NFCC at different states. 5Currently it will track STANDBY, ULPDET and ACTIVE state. It will count number 6of times in milliseconds spent in each of specified state and number of times 7each state is entered since boot. 8 9Feature enable 10-------------- 11This feature can be enabled by setting POWER_STATE_FEATURE to true. 12There are two ways we can set this variables. 13 - This can be integrated into build by adding below line to device-nfc.mk 14POWER_STATE_FEATURE ?= true 15 - We can set these variables during make command 16make -j8 POWER_STATE_FEATURE=true. 17 18Config file change 19------------------ 20We can specify refresh time for power data from config file /vendor/etc/libnfc-nxp.conf. 21Higher the value set for the config below, lesser would be the overhead of additional 22power consumption to collect the stats. 23 24NXP_SYSTEM_POWER_TRACE_POLL_DURATION_SEC=30 25 26Integration Guide 27------------------ 28Below code snippet shows how to integrate Nfc power stats with PowerStats HAL. 29 30Create PowerStats HAL instance 31'std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();' 32 33Create PixelStateResidencyDataProvider instance 34'auto pixelSdp = std::make_unique<PixelStateResidencyDataProvider>();' 35 36Add "Nfc" Entity with 3 states namely STANDBY, ULPDET, ACTIVE 37'pixelSdp->addEntity("Nfc", {{0, "STANDBY"}, {1, "ULPDET"}, {2, "ACTIVE"}});' 38 39Start PixelStateResidencyDataProvider. This will register binder to service manager. 40'pixelSdp->start();' 41 42Add PixelStateResidencyDataProvider to PowerStats HAL 43'p->addStateResidencyDataProvider(std::move(pixelSdp));' 44 45Register PowerStats HAL with service manager 46'const std::string instance = std::string() + PowerStats::descriptor + "/default";' 47'binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());' 48