02-14-2021, 02:51 AM
(02-14-2021, 12:50 AM)bokomaru Wrote:(02-13-2021, 08:03 PM)dsimic Wrote: Thus, the pogo pin #5 (USB-5V) provides stabilised 5 V on USB-5V, up to 1.5 A, which can also be switched on and off using a GPIO line on the SoC. I do not see the use of that GPIO line in the PinePhone DTS file.
Yes it _can_ be, but also, to be clear, pogo pin #5 is not _always_ a stabilised 5 V. We've confirmed that by measuring with a multimeter. Like you said, the LP6226 can be enabled/disabled. If a power source is not plugged into the USB C port, nor attached to pogo pin #1, and if the LP6226 is disabled (which apparently it was when I tested), then pogo pin #5 will basically be equal to PS, which is basically battery voltage in this case. (Probably why the wiki is confused)
This is somewhat strange... When the LP6266 is disabled (and the LPW5206 is also disabled, but may also be enabled), there should be no power supply going out of the pogo pin #5 (USB-5V). However, let me reiterate on some of your earlier measurements (the following quotation is from one of your earlier posts):
(01-06-2021, 11:33 PM)bokomaru Wrote: Some investigation with a multimeter:
With a powered down PinePhone, I get 0 V from PIN5 and 4.0 V (battery voltage, unloaded) from PIN1.
Power up the PinePhone with no charger in the USB C port. I get 0 V from PIN5 and 3.9 V (battery voltage, loaded, modem is off) from PIN1.
PinePhone still powered on, now I plug in a USB C charger. I get 5.0 V from PIN5 and 4.8 V from PIN1.
As I understand it, 4.8 V is the voltage of my external AC to DC power brick in the wall under whatever load. I don't _think_ that's the voltage at which the battery gets charged. I think the max allowed for charging a Li battery is around 4.2 or 4.3 V, and anyways, since this battery is almost full, it's probably in the constant-voltage phase of charging. Maybe I'll hook up to a variable power supply to investigate more.
To me, it is expected that 0 V is observed on the pogo pin #5 (USB-5V) while the phone is powered down. In that case, there's no DCIN so there's no voltage on the PMIC's PS output, and the LP6226 produces no output.
On the other hand, how is it possible that the pogo pin #1 (DCIN) provides VBAT while the phone is powered down? According to the phone schematic, the battery is connected to the PMIC, the LED flash, the modem and the WiFi, but not to any of the power patths to any of the pogo pins. Perhaps we should try to figure that out first.
When the phone is powered up and no charger is connected, there should be 5 V on the pogo pin #5 (USB-5V), unless the LP6266 is disabled through software. As you've pointed out, the SoC GPIO line that controls the LP6226 is present in the DTS file in Ondrej's kernel source, so it must be used by something. I cannot figure out what is the actual purpose of having it disabled, unless the purpose is to "emulate" the presence of the charger through the voltage present on the pogo pin #5 (USB-5V).
Again, I really have no clue where from the pogo pin #1 (DCIN) gets the battery voltage when the phone is powered up and no charger is connected. We should investigate that, if you agree.
With the phone powered up and a charger connected, it is expected to have 5 V on the pogo pin #5 (USB-5V) and around 5 V on the pogo pin #1 (DCIN). The pogo pin #5 (USB-5V) gets stabilised 5 V from the LP6226, while the pogo pin #1 (DCIN) gets aronund 5 V from the charger (which is probably going to be slightly below 5 V). However, the above-stated questions still remain.
(02-14-2021, 12:50 AM)bokomaru Wrote:(02-13-2021, 08:03 PM)dsimic Wrote: Thus, the pogo pin #5 (USB-5V) can also be used as a USB power source, depending on the OTG state of the phone's USB port.
This is very strange. I really don't know whether this is me misreading the schematic, or a bug in the schematic, but I cannot figure out why should the pogo pin #5 behave differently depending on the mode of the phone's USB port (current sink or source)?
Interesting! Are you saying that when the LPW5206 is enabled, you could actually provide 5 V as a power input to the Pinephone at pogo pin #5? I'm definitely scared to try that without understanding better :-)
Exactly, although it is very strange. When the LPW5206 is enabled, the pogo pin #5 (USB-5V) turns into a power input for the phone, or at least that's what we can see on page 13 of the phone schematic. While the LPW5206 is enabled, the LP6226 must be disabled, or otherwise there would exist a power loop inside the phone. Quite frankly, I really don't get it.
Of course, providing a power input that way should not happen when a charger is connected, as that would allow the power source from USB-5V to be fed to a charger; there's no isolation of power sources. By the way, the whole thing wouldn't make much more sense even if the input and output of the LPW5206 were switched by mistake in the phone schematic. Really weird, IMHO.
(02-14-2021, 12:50 AM)bokomaru Wrote: I made the assumption that, since USB-5V comes from PS, it's an output only, and providing your own 5V there would be a bad idea because you'd be connecting two power sources together (the Pinephone's PS, plus your external supply at pogo pin #5). However, now I'm also noticing the diode D600, which I suppose could actually protect PS from USB-5V.
Quite frankly, no assumptions should be made when it comes to the PinePhone schematic. You're right, a charger shouldn't be connected in case power is provided through the pogo pin #5 (USB-5V), but I don't think that the purpose of the D600 diode is to create some sort of power inputs separation. That diode is a part of the LP6226 reference design.
As a note, any power provided to the phone through the pogo pin #5 would be limited to 500 mA or 1 A, depending on the type of LPW5206 used in the phone (there are two types of the LPW5206 IC). That makes the whole design even more weird; why would anyone make the power input limit that low?
(02-14-2021, 12:50 AM)bokomaru Wrote: Anway, I do think that the LPW5206's intended purpose is only for the Pinephone to provide 5V to the USB C port when it's acting as the USB host. Like you're saying, depending on the OTG state.
That would make perfect sense, but unfortunately that is not what the schematic tells us.
(02-14-2021, 12:50 AM)bokomaru Wrote: Also note that USB-5V definitely isn't _only_ controlled by the state of the USB port. I've already showed (by actually measuring) that if you only apply 5 V at DCIN, without touching any other USB pins (e.g. D+/-), the voltage of USB-5V will follow PS as it increases from battery voltage to 5 V. We also assume that you could otherwise enable the LP6226 (via the Allwinner A64's PD8 GPIO) to boost from PS from battery voltage to 5 V.
We should investigate that first, if you agree. Your measurements are hard facts, but the schematic, as already described, provides a lot of conflicting information.
(02-14-2021, 12:50 AM)bokomaru Wrote: Of course the funny thing is, we don't always actually supply 5 V there. It's funny to imagine designing a "pogo pins expansion board", where you'll have a regulated 5 V sometimes, but you can't count on it. Sometimes, when the battery is under load and almost dead and the LP6226 is off, you'll only have 3 V :-)
My guess is that the intention of the DCIN pogo pin is to connect an external battery. If the DCIN (or VBAT on the wiki page) went straght to the phone battery, an external batttery could be simply connected in parallel, at least in theory, leaving the charging to the PMIC with no need for additional charging logic, etc. By the way, I've completely ignored the need to monitor the internal temperature of the external battery, which migh render the reuse of PMIC-based charging impossible.
(02-14-2021, 12:50 AM)bokomaru Wrote: I'm definitely scared of what happens when you attach power supplies to both the USB C port and to pogo pin #1... that's just shorting together two power supplies. I've pointed this out already.
Nothing good can happen, as we've already pointed out. Hopefully the charger would be smart enough to give up without leaking the magic smoke.
(02-14-2021, 12:50 AM)bokomaru Wrote: The inefficiency thing in converting voltages, I'm not so worried about. Nobody besides the PMIC's battery charger should be able to directly charge the battery at battery voltage. Otherwise, it'd be unsafe, and there would be no way to control which source is charging.
Please, keep in mind that the external batttery would be pretty much unreachable and uknown to the PMIC. Thus, additional logic for battery charging (and more, as already described) would be required in the keyboard case.
(02-14-2021, 12:50 AM)bokomaru Wrote: Actually, I wonder if the ACIN and VBUS power input pins on the PMIC should just be isolated from each other. In other words, pogo pin #1 should go to one of those, and the USB C port should go to the other. The PMIC is supposed to seamlessly switch between one or the other (and the battery) as a power input.
That might actually be the right solution, but the problem of charging the external battery would still remain, requiring separate charging circuitry.
(02-14-2021, 12:50 AM)bokomaru Wrote: By extension, I guess I would hope that it's safe to draw 1.5 A from USB-5V. If not, then it seems like nothing else prevents us from drawing too much current via the pogo pin or USB port and heating/damaging something.
Maybe the PMIC also monitors current and is able to turn off PS. Otherwise, after the LP6226 "turns off" due to overcurrent, I suppose you could actually still draw more even more current than 1.5 A. It just wouldn't be boosted, so it would be at battery voltage instead of 5 V. Maybe then, the LPW5206 would turn off. I don't know.
The LPW5206 would prevent only more than 500 mA (or 1 A) from flowing into the phone, not out. Furthermore, I really don't see in the schematic how would it be possible to draw current from both the LP6226 and the battery though the pogo pin.