Red LED shining up even though there's plenty of battery charge available
u-boot tries to check the battery voltage and shines the red LED when it thinks it's below a level that would allow Linux to successfully boot (2.8V):
/* check VBAT */
val = dm_i2c_reg_read(udev, 0x0e);
vbat = (val & 0x7f) * 20 + 2304;
printf("VBAT mV %d\n", vbat);
if ((vbat < 2800) && (iinlim <= 500)) {
/* battery voltage too low and
* insufficient current to boot linux.
*/
gpio_direction_output(LED_R, 1);
printf("%s: voltage and current too low linux probably won't boot\n", __func__);
However, in practice, the red LED shines when the battery has still a lot of charge left. On my Dogwood, it seems to start shining red at around 60%.
Example reading done from Linux right after booting with the red LED on in u-boot:
bq25895:
POWER_SUPPLY_VOLTAGE_NOW=3604000
max17055:
POWER_SUPPLY_VOLTAGE_NOW=3613125
POWER_SUPPLY_VOLTAGE_AVG=3661640
POWER_SUPPLY_VOLTAGE_OCV=3874375
POWER_SUPPLY_CAPACITY=62
Edited by Sebastian Krzyszkowiak