
pon., 16 gru 2024 o 14:40 Andre Przywara andre.przywara@arm.com napisał(a):
On Wed, 27 Nov 2024 13:04:19 +0000 "Marcin Ślusarz" marcin.slusarz@gmail.com wrote:
Hi Marcin,
thanks for taking care of sending a mainline patch!
Allows decreasing initial charge current, e.g. when power supply is too weak to support both charging and other operations.
Can you explain a bit more why and where you actually need that?
One of the boards I worked on had a design flaw where the power supply was incorrectly sized. Booting that device on AC with an almost empty battery led to weird behavior of some connected devices because the board was starved by battery charging. The design bug was fixed, but old boards exist and need to work...
The problem I have with the code is that it's doing it in the SPL, where I actually want to decrease any PMIC usage. We really only need the PMIC that early to set the DRAM and CPU core voltage, everything else should be done in either U-Boot proper or the kernel.
The problem with disabling (or decreasing) charging later is that it might be too late. While I never tracked booting failures to that problem, it's theoretically possible.
So how did this work before, and why it is a problem now? AXP221 points to some older SoC, I guess?
It's an older SoC, but it's still used to develop new products :/.
Is it that you find yourself with a somewhat weak power supply, and if the battery is discharged, there won't be enough power left for the system to boot reliably?
Do you know of any existing DT property for instance that could limit the charge current? Or is there a sysfs property only?
It's possible to limit charging via DT and tweak it after booting with sysfs, but in the kernel version I had to deal with, it was not possible to disable charging completely. And as I said, I fear it might be too late to do it after bootup.
With all that said, there's no big need to merge this patch upstream. It would lower the effort to update to a newer UBoot, and I thought it's generic enough that someone else could use it.
Cheers, Marcin