Auto-wake behavior when external power is connected
#1
I've noticed that my Pinebook Pro immediately wakes up from a suspend-to-RAM state whenever external power is connected or disconnected. I find this concerning, because this is approximately the last time I would ever want it to wake from sleep mode automatically - particularly since it does this even if the lid is closed at the time, and it's very hard to tell from the outside if the device is asleep or awake with the lid down.

What will it take to change this? I'm bracing myself for the worst, because I can't imagine the OS is involved at all in wake conditions - hence my posting in the hardware section. Is this something that could be fixed in the firmware with a straightforward method, or is it going to require attaching debugging clips to an IC in there somewhere, or what?

It's puzzling to me how this behavior was established in the first place. Is it affecting other units as well, or is ours somehow a fluke?
#2
Just confirmed that our pinebook pro exhibits the same behavior running ayufan's bionic lxde image 0.9.16 using the barrel connector for power.

Also agree that this is sub-optimal.
A64, SOPINE, Rock64, RockPro64, Pinebook1080p, Pinebook Pro, Pinephone, Pinewatch dev kit, Pinetab, Pinecil, Pinenut, Quartz64, Pinephone Pro, and PineNote (so far)
#3
After having dealt with it for a couple days, this behavior is driving me mad. I can't close the lid and then put it on its charger, because connecting the charger immediately wakes it up. I can't unplug it and stuff it into a backpack, either, because that wakes it up too. If the power flickers in the night, it wakes up. If I jostle the cord by accident and it momentarily loses contact, it wakes up. It's kind of absurd.

Can anyone familiar with the hardware tell us more about why this happens, and perhaps how it might be fixed? Keeping my computers asleep until I purposefully wake them is a rather important part of my use of them.
#4
If I had to guess, I would say it's the PMIC interrupt from the RK808 that notifies the OS of a power management event:

15.2.5.4 INT_STS_MSK_REG2 : Interrupt Status Register #2
Bit 1 PLUG_OUT_INT_IM: Charger plug out event interrupt mask.
1: Mask the interrupt
0: Do not mask the interrupt
Bit 0 PLUG_IN_INT_IM: Charger plug in event interrupt mask
1: Mask the interrupt
0: Do not mask the interruptk

In normal operation you want to handle those to know that a charger is present, in suspend probably those and other PMIC IRQs should be masked.
The question is, where in the software stack is this handled exactly, ATF or Linux?
Come have a chat in the Pine IRC channel >>
#5
(11-08-2019, 12:02 PM)xalius Wrote: If I had to guess, I would say it's the PMIC interrupt from the RK808 that notifies the OS of a power management event:

15.2.5.4 INT_STS_MSK_REG2 : Interrupt Status Register #2
Bit 1 PLUG_OUT_INT_IM: Charger plug out event interrupt mask.
1: Mask the interrupt
0: Do not mask the interrupt
Bit 0 PLUG_IN_INT_IM: Charger plug in event interrupt mask
1: Mask the interrupt
0: Do not mask the interruptk

In normal operation you want to handle those to know that a charger is present, in suspend probably those and other PMIC IRQs should be masked.
The question is, where in the software stack is this handled exactly, ATF or Linux?

Did you ever find a solution here? I'm having the same issue with a really vanilla Manjaro Sway install.  I was hoping it was something in systemd or something?
#6
(11-08-2019, 12:02 PM)xalius Wrote: If I had to guess, I would say it's the PMIC interrupt from the RK808 that notifies the OS of a power management event:

15.2.5.4 INT_STS_MSK_REG2 : Interrupt Status Register #2
Bit 1 PLUG_OUT_INT_IM: Charger plug out event interrupt mask.
1: Mask the interrupt
0: Do not mask the interrupt
Bit 0 PLUG_IN_INT_IM: Charger plug in event interrupt mask
1: Mask the interrupt
0: Do not mask the interruptk

In normal operation you want to handle those to know that a charger is present, in suspend probably those and other PMIC IRQs should be masked.
The question is, where in the software stack is this handled exactly, ATF or Linux?

As far as I can see, it should be done in the RK808 Linux kernel driver.  Haven't had the time to check in detail, but it should be performed in the rk8xx_suspend() and rk8xx_resume() functions.
#7
Good news!  I'll implement the required changes to the RK808 driver, so the respective wakeup events (i.e., interrupts) are ignored, and provide a patched kernel package for testing.  After the issue is confirmed to be resolved, I'll submit the patch for upstreaming into the Linux kernel mainline.
#8
Even better news! Smile

No changes to the RK808 kernel driver are required, simply do the following as root and (un)plugging the charger will no longer wake up a suspended PineBook Pro:

Code:
echo disabled > /sys/devices/platform/dc-charger/power/wakeup

You may also create a sysctl rule and place it in /etc/sysctl.d, to have this configured automatically upon every boot.

Here are more details about the whole ordeal with charger (un)plugging detection.  As already described earlier in this thread, the RK808 PMIC has a very nice built-in feature that senses the charger voltage and generates interrupts upon the charger plug in and plug out events.  However, as visible on page 12 in the PineBook Pro schematicc, there's pretty much no way that anything reaches the RK808's pin #34 (VDC input).  Why would anyone connect capacitors in series with a stabilized DC input?

The ugly fix we're dealing with is that one of the RK3399's GPIO inputs is used for sensing the presence of charger, which makes no sense whatsoever.  That's the "dc-charger" device/node from above, which is just a charger present/absent flag.  This is clearly a bug in the PineBook Pro schematic, and I suppose that it could (and should) be fixed by using a pair of isolation diodes instead of the capacitors.

The proper way, however, is to use the RK808's functionality, instead of abusing a RK3399's GPIO line.  Furthermore, should we start a list of bugs to be fixed in the next PineBook Pro PCB revision?


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinebook Pro on Debian 12 Power Issue u974615 1 853 03-13-2024, 10:46 AM
Last Post: u974615
  Increasing the maximum power draw dsimic 15 22,318 11-21-2022, 03:36 AM
Last Post: bircoph
  Alternative Power supply options gallomimia 13 20,097 11-13-2022, 06:10 PM
Last Post: pineymousepad
  PBP booting but stops at flashing power led jonasd 13 7,172 09-26-2022, 12:17 AM
Last Post: jonasd
  Blinking red light for charger, no power-on bifo 11 16,663 11-30-2021, 01:37 PM
Last Post: wdt
  power on PBP if your keyboard is dead? stozi 0 1,565 11-29-2021, 01:55 PM
Last Post: stozi
  Motherboard malfunction - a possible warning about power supplies mjc 8 8,600 07-28-2021, 01:04 PM
Last Post: mjc
Question External Monitor not Working sciolus 5 6,006 05-05-2021, 02:05 AM
Last Post: aurora.borealis
Question UK Power Supply User 11436 11 19,708 02-09-2021, 12:30 PM
Last Post: dieselnutjob
  Pinebook Pro Dock Power Requirements calinb 9 13,823 12-16-2020, 09:24 AM
Last Post: dsimic

Forum Jump:


Users browsing this thread: 2 Guest(s)