1

I need to monitor some applications power consumption of my Samsung A8, programmatically. I'm doing this by accessing the files:

/sys/class/power_supply/battery/current_now
/sys/class/power_supply/battery/voltage_now

The problem is that the kernel update those files every 10 seconds, so it does not produce sufficient power samples measurement to my experiment. I want to reduce the update time produced by the kernel driver to increase the sample rate. Ideally the kernel would update the values every half second.

From this post: How does the Android estimate the battery level without a current sensor? I understood that I might find the name of the chip that measures the battery information by looking into a defconfig file. After searching for a while on the defconfigs from my kernel, I believe that the Fuel Gauge used is S2MU004 as specified in this file: https://github.com/prashantpaddune/universal7885/blob/e5ffd23305f0b09fe2bef3f8580df046dab232cc/arch/arm64/configs/exynos7885-jackpotlte_defconfig#L4415

But I'm still not sure about it. Would be the s2mu004-fuelgauge the name of the chip? If so, where can I find the driver? And then, someone can enlighten me on how to modify the driver to increase the sample rate?

Device Information
Model: Samsung Galaxy A8 (SM-A530F)
Android Version: Android Pie (9)
Kernel: Quantum Kernel V4
Kernel version: 4.4.111-Quantum_pie.V4.0-A530F
Processor: Samsung Exynos Octa 7885
Magisk version: (used for root) 19.3

  • The question is more related to kernel development. Power related configurations are under drivers/power in kernel tree. – Irfan Latif Nov 20 '19 at 14:46
  • Is the question off-topic? Should I remove it then? I already looked at the drivers in the power directory, the problem is that I don't know which one of them is being used. But I'll try to use grep to look for keywords in the files. – Eduardo macedo Nov 20 '19 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.