-
-
Notifications
You must be signed in to change notification settings - Fork 18
Suspend to RAM with mainline #3
Comments
Might be related: rockchip-linux/kernel@3cc3b03 EDIT: FYI, the files added in that commit are not present in tsys' kernel. |
Entirely plausible. Good find! I wonder if that driver has a mainline patch open. Otherwise it looks relatively self-contained, wondering how hard it is to forward prat. |
I'm testing the blunt forward port right now. It did not apply cleanly, so I'm going to have to do something about that. |
Working (EDIT: as in "i'm working on it in this branch", not "this branch works") branch: https://github.com/theotherjimmy/wip-pinebook-pro/tree/sleep |
I got suspend to ram working! I had no measurable charge loss over 4 hours of suspend. Logs to show that it happened (note the "deep"):
|
Now, I impatiently wait for the changes :). |
Seems that my branch was old, and I have amended the series yet again. I'm going to push to a different branch, after rebasing with the latest master. |
From what I hear one must use the BSP, rather than mainline, u-boot for this to work. Manjaro has got it working that way. |
Long time no progress. I finally have an automated reproducer for the suspend issues, using levinboot. This makes testing any fixes a much quicker process. I've now confirmed that TF-A enters the suspend state correctly (as far as I can tell) and that no external input can wake it. I have to track down how to enable a method for an external wake event (including at least the power button, as I can't easily test the lid switch with the back of my pbp) and confirm wakeup after that. |
I suppose I should update this. Note that I have not worked on this in about 2 months (maybe more). I have managed to configure a wakeup source in TF-A, and, with much help from crystalgamma, was able to get LPDDR4 resume on the right track. However, the current issues is that returning from the enable-mmu code in TF-A raises an unhandled exception by returning to an unmapped address. I recently had my first child, so I may not be returning to this for a bit 😅 If someone wants to take up the torch, I can provide my patch series, but I'm hesitant to post it publicly. |
Is this issue referring to the battery drain I get when shutting "suspending" the laptop? Usually it never seems to powersave |
@tgunnoe, Yes. the drain at the moment goes from 100% (ish) to 0% in < 36 hours. With suspend support in upstream TF-A, the power drain could be minimized to allow up to 20 days of suspend, or something like that. |
Any updates on this? I'm looking to get a Pinebook Pro this month or so, and was wondering if I could help in any way! |
Right, so I finally got around to hooking up a debugger to my PBP this past week. 🤞 I'll be able to push the patch upstream soon. |
@theotherjimmy Wait; so how do we use this, again...? Sorry, a bit new to this! |
(Assuming NixOS), you would apply the patch to the TF-A for RK3399. For example, you could add it to the override used here: wip-pinebook-pro/u-boot/default.nix Lines 18 to 26 in 497b7f7
Not sure if there is a minimum version of TF-A that needs to be used. This, in turn, will be used by U-Boot. So you'll need to build and update U-Boot accordingly for your setup. |
I developed the patch based on a branch off of pre-2.3. It should apply cleanly to anything starting 2.3 onward. |
@samueldr So override U-Boot with the patch, set it up, and build? |
@shadowrylander This is a patch for TF-A, not uboot. |
So where would I apply the patch in the link provided here...? |
Or wait; was the comment by @samueldr not for me originally? |
@shadowrylander It was probably meant for all of us. |
Do we need #7's changes for this to work? Namely (I still haven't taken the time to actively test...) |
I can verify that, with the default Tow-Boot build for the Pinebook Pro, which at the time includes the patch this works for me on 5.11. |
@samueldr Thanks for being one of the first tester's that's not me! I feel a lot better knowing that my results have been reproduced. |
@theotherjimmy not knowing much about all this, I still feel the comments about how it may or may not actually work depending on the conditions it resumes from, from the reviews, are probably valid. But at least in a limited testing it seems to work. One time the PBP panic'd, it had slept for a short while, but it panic'd long after resuming. |
Oh, dang. That's probably related to not restoring the lower frequency as the reviewer suggested might be the case. That being said, without debugging, I have no idea. |
Exactly, and I tried reproducing, left the pinebook pro under similar conditions, booted, slept not too long after for not long (not even a minute I think). Then left the pinebook pro on, without display suspend. While the time it panic'd it was I think under 12 hours, leaving it ~36 hours on didn't seem to reproduce the issue. This is going to be a hard one to reproduce, if indeed it is related to the suspend/resume cycle and that suggestion. |
Honestly, if it's panicing, RAM is working. Unless we're seeing corruption. |
I wouldn't know enough to confirm or deny :) |
Tried out the patch with an NVMe drive, and the drive is frozen upon wake up. It still shows up in
|
Yes, I think that's expected behavior ATM. I'd love to fix it, as I now have a NVMe in my PBP, but it's extremely low on my priority list. |
What's the current status of suspend to RAM? |
Hey guys, I'm trying to bring s2ram to mainline for DevTerm A06 (rk3399). My "working branch" is here :) I've marked and aligned some routines from the rkbin bl31.elf but there're still missing pieces: the way ATF accepts aux parameters, the mysterious PMUGRF_OS_REG2, the way PSCI is called (not returning from WFI, but jumping into the suspend_finish routine -- the DevTerm never reaches suspend_finish) I'm wondering if you have suggestions and tips? Currently it goes into deep sleep but it's not coming back. I'm fairly new to all this but gradually finding my way around... It'd be also cool to be able to set up debug uart or debugger, as currently all I have is to output debug bits with the onboard FAN spinning/not spinning...... |
(Tracking issue...)
The text was updated successfully, but these errors were encountered: