To get the battery voltage, do
int f = open ("/dev/atmg", O_RDONLY); int l, percent; ioctl(f, 0x03, &l);
l is set to the battery voltage in millivolts. The nominal battery voltage is 4.2V, but it's unusual to see such a high level except on AC power. I am taking 4100mV as full charge. When on charge the battery voltage is still available, but it isn't particularly meaningful. AVOS does not display charge level on external power, and there's probably a good reason for that.
AVOS takes the minimum working voltage to be 3.5V. I believe that the hardware shuts down automatically when it gets to 3.25V. I am taking 3.25V as `empty'. In practice, the readings fluctuate widely and, because it's a raw voltage reading, they are affected by current drawn. It does not appear to be possible to measure the current, so I've not found an easy solution to this variability other than to average readings over a minute or so. When averaged, the battery voltage does appear to fall more-or-less linearly with time, so it's relatively straightforward to work out the remaining percentage charge as
percent = 100 * (l - 3250) / (4100 - 3250)
The presence of external power can be detected by reading
The value will be 0 (battery), 1 (usb), or 2 (mains).
The OMAP kernel provides neither APM nor ACPI support so, as far as I know, the methods described here are the only way to get power status information.
.Backlight and display
Both backlight and LCD can be shut down to conserve power (LCD management).
In the SDE Angstrom distribution, the disk motor won't spin down -- not for long, anyway. This uses a lot of battery power, and makes the unit run hot. A partial solution is to mount the root filesystem with the `noatime' attribute. This can be done by editing /etc/fstab, and adding the noatime' attribute to the rootfs' entry.
rootfs / auto defaults,noatime 1 1
Kernel and CPU power management
For reasons that I don't fully understand, the standard AVOS firmware does this at boot for power management purposes:
Smartreflex is a technique to minimize powerconsumption by adjusting the voltage according to frequency. If only the cpu_freq is lowered without lowering the voltage, the leakage current will remain high. Further information at: http://focus.ti.com/pdfs/wtbu/smartreflex_whitepaper.pdf
insmod /lib/modules/smartreflex.ko echo 1 > /sys/power/sr_vdd1_autocomp echo 1 > /sys/power/vdd1_opp_value echo 10 > /proc/sys/vm/laptop_mode
I guess it's worth including this in other implementations.
It won't improve power management, but changing the cpufreq governor from userspace' (which defaults to minimum CPU speed) to ondemand' allows the kernel to speed up the CPU when a burst of speed is needed.
See attached file and:
13:50:17< johnsq> dm8tbr: this value should be written to echo 4100 > /sys/devices/platform/battery/voltage_avg 13:51:11< johnsq> and capacity to /sys/devices/platform/battery/capacity than normal linux tool should handle battery state.
Fast-Charge with micro-USB Cable
Tested on Archos5IT with 8GB SSD Slim-Version.
You need a high current USB-Port, or Y-Cable to get around 1000mA out of two USB-ports or other 5V- 1A power source.
To put the A5IT into fast charge mode a code like this (more detailed info look at attachment by johnsq):
int f = open ("/dev/atmg", O_WRONLY); ioctl(f, 18, 0x300);
A press on the power button or a disconnect of USB and reconnect will reset the A5IT to low-charge mode. I tested with 5V and get around 950mA into the A5IT with 5,5V it was 1000mA.
- archos_battery.c (1.3 KB) - added by dm8tbr 4 years ago.
contributed by johnsq