A10 LIME: running on battery and other power management?

Started by kalin, April 17, 2014, 05:57:14 PM

Previous topic - Next topic

kalin

I just started playing with my 2nd LIME board (I couldn't resist getting another one :P)...

Plugged a charged battery, then unplugged the DC from a running board and it kept running as expected ;-)

However there was no dmesg or other event that I found.

How can one detect from software power events like this (e.g. running on battery)?
What about battery voltage and/or remaining time?
Power usage?

I am coming from amd64 linux land and there tools like acpi, powertop show such data. I guess that is too high level?

Is there a proper battery under-voltage/cutoff circuit? I see the PMU chip there...
In other words, is it safe to let it run until battery is dead?

I am new to this kind of boards, so any pointers are appreciated!

dave-at-axon

Have a look in /sys/class/power_supply/battery

You should be able to find what you need in there. :)

kalin

Thanks a lot! Everything is there ;-)

Poking more in Debian (haven't used Debian for 10+ years), there is upower:
# upower -i /org/freedesktop/UPower/devices/battery_battery
  native-path:          /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/battery
  model:                battery
  power supply:         yes
  updated:              Fri Apr 18 01:12:13 2014 (22 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    energy:              0 Wh
    energy-empty:        0 Wh
    energy-full:         0 Wh
    energy-full-design:  0 Wh
    energy-rate:         0 W
    voltage:             3.787 V
    percentage:          0%
    capacity:            100%
    technology:          lithium-ion


Now how do I tell the board that my LiPo is 2600mAh?

Kreega

I don't know. But my guess it to echo the value into the capacity file.  Only a guess, YMMV.

kalin


Found it, kind of:

http://linux-sunxi.org/Fex_Guide#pmu_configuration

pmu_battery_cap

but it doesn't seem to be dynamic...

I'll play with it later.