1
0
mirror of https://xff.cz/git/u-boot/ synced 2026-04-10 12:00:04 +02:00
Files
u-boot-megous/board
Ondrej Jirman 459f15465c board: pinephone-pro: Handle low battery during boot, increase current limit
The limit needs to be raised as soon as possible to prevent boot loops
on empty or removed battery. The default 450mA limit is crossed when
eMMC or SD card starts seeing reads in SPL after DRAM was already
enabled in TPL.

But this fix is good enough to prevent boot loops when the phone can still
get ~100mA from the battery to cover the difference between 450 mA current
limit and ~550 mA needed to load main U-Boot from eMMC while the DRAM
is already initialized by TPL.

Detect low battery voltage and prevent boot, set current limit to
something even USB 3.0 port can handle, and charge the battery
until at least 3.5V is reached. Typically the charging power will
be ~2W in this mode, which will reach the target voltage within 15
minutes or so and the phone will then boot.

If the USB power is not available, just blink the red led quickly
and power off. If USB power is available, indicate progress of charging:

- dead battery: 100ms green LED flash each second
- trickle charging: 200ms green LED flash each second
- cc-cv: duty cycle indicates charging current (5-95% of 2A)
  with period of 2s
- various failures while USB power is connected, blink red LED
  5 times quickly, wait 1s, and repeat until the failure clears

TODO:

- allow volume key input (raise / lower input current limit)
- power button, skip the algorithm and continue boot at user's
  own risk

Signed-off-by: Ondrej Jirman <megi@xff.cz>
2024-04-13 01:20:30 +02:00
..
2023-08-17 12:29:21 -04:00
2023-12-21 08:54:37 -05:00
2023-12-19 21:24:30 +02:00
2024-01-29 22:35:02 -05:00
2024-01-29 22:35:02 -05:00
2024-01-29 22:35:02 -05:00
2023-12-21 08:54:37 -05:00