edison-fw / meta-intel-edison

Here is the meta-intel-edison that builds, tries to stay up to date. Master is based on Yocto Poky Gatesgarth LTS 5.10.yy vanilla kernels. It builds a 32bit kernel (Gatesgarth branch 64bit) with ACPI enabled and corresponding rootfs. Telegram group: https://t.me/IntelEdison Web-site:
https://edison-fw.github.io/meta-intel-edison/
MIT License
60 stars 38 forks source link

edison-image.bb - disable battery-voltage.service #90

Closed mwallnoefer closed 4 years ago

mwallnoefer commented 4 years ago

May only be re-enabled if the pmic_ccsm service gets restored (consider battery-voltage/battery-voltage/battery-voltage.c).

andy-shev commented 4 years ago

pmic_ccsm driver will never be upstreamed, So, if battery service at some point will be revived, it will be (completely?) different approach. So, I would go further and remove this from distribution for time being.

htot commented 4 years ago

afaikt all this service does is get the battery voltage and print it. So now, from bcove_adc we get cat /sys/bus/platform/drivers/mrfld_bcove_adc/mrfld_bcove_adc/iio:device0/in_voltage0_raw returns 988, which probably corresponds to 988 / 1024 * 4.5 = 4.34V.

So, what does pmic_ccsm do extra?

andy-shev commented 4 years ago

afaikt all this service does is get the battery voltage and print it. So now, from bcove_adc we get cat /sys/bus/platform/drivers/mrfld_bcove_adc/mrfld_bcove_adc/iio:device0/in_voltage0_raw returns 988, which probably corresponds to 988 / 1024 * 4.5 = 4.34V.

Yes, monitoring (PMIC ADC) works...

So, what does pmic_ccsm do extra?

...charging is not.

Sorry for the confusion, because I didn't quite get what is that service for.

htot commented 4 years ago

Sorry for the confusion, because I didn't quite get what is that service for.

Neither do I. It seems to print battery status to syslog? But why?

htot commented 4 years ago

Anyway I fixed it, useless as it seems. Will appear initially in https://github.com/htot/meta-intel-edison/tree/zeus

xlla commented 4 years ago

I saw this in every boot log.

[FAILED] Failed to start Battery Voltage daemon.
See 'systemctl status battery-voltage.service' for details.

root@edison:~# systemctl status battery-voltage.service
● battery-voltage.service - Battery Voltage daemon
   Loaded: loaded (/lib/systemd/system/battery-voltage.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-02-15 17:20:10 UTC; 8min ago
  Process: 639 ExecStart=/usr/bin/battery-voltage (code=exited, status=255/EXCEPTION)
 Main PID: 639 (code=exited, status=255/EXCEPTION)

Feb 15 17:20:10 edison systemd[1]: battery-voltage.service: Service RestartSec=100ms expired, scheduling restart.
Feb 15 17:20:10 edison systemd[1]: battery-voltage.service: Scheduled restart job, restart counter is at 5.
Feb 15 17:20:10 edison systemd[1]: Stopped Battery Voltage daemon.
Feb 15 17:20:10 edison systemd[1]: battery-voltage.service: Start request repeated too quickly.
Feb 15 17:20:10 edison systemd[1]: battery-voltage.service: Failed with result 'exit-code'.
Feb 15 17:20:10 edison systemd[1]: Failed to start Battery Voltage daemon.

andy-shev commented 4 years ago

So, charging actually works on Sparkfun Battery block and on Edison/Arduino according to the data sheets of certain discrete components. The idea behind the service is probably to shutdown correctly the machine, or do something else.

andy-shev commented 4 years ago

Okay, I investigated battery level mechanism. It seems that the above service just prints it in human readable format, while the formula is indeed (x) * 450 / 1024 = Battery Level in centivolts (pmic_get_battery_voltage() in the stock kernel sources), where (x) is the 16-bit value from Channel 0, i.e. VBATRSLT. So, this service is doubtfully needed.

Thus, I think removal is the best option to avoid user confusion.

htot commented 4 years ago

I created a branch zeus and created a patch to fix battery-voltage.service as suggested here. Thanks.