Page MenuHomeFreeBSD

acpi: Call SPMC suspend/resume hooks
ClosedPublic

Authored by obiwac on Jan 30 2025, 7:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Feb 3, 6:19 AM
Unknown Object (File)
Tue, Feb 3, 4:04 AM
Unknown Object (File)
Tue, Feb 3, 3:16 AM
Unknown Object (File)
Tue, Feb 3, 2:52 AM
Unknown Object (File)
Tue, Feb 3, 2:13 AM
Unknown Object (File)
Tue, Feb 3, 2:12 AM
Unknown Object (File)
Mon, Feb 2, 8:49 PM
Unknown Object (File)
Mon, Feb 2, 6:18 PM

Details

Summary

Calls SPMC suspend method if an acpi_spmc device exists before going to sleep but after having already suspended all devices, and call the SPMC resume method after we've woken up but before resuming all devices.

This adds a new ACPI_PMC interface, which can be used by PMCs (power management controllers) for late suspend or early resume.

See D48387.

Test Plan

Framework 13 AMD Ryzen 7040 series enters a standby mode (power button led fades in and out slowly).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

obiwac created this revision.

Suspend works on my Lenovo notebook. After resume there is no response to pressing keyboard keys in the console, but switching between terminals works.

Awesome! I'll start work on reading residency counters on Intel (though the LPIT) soon, so we can check if the CPU is actually entering S0i3 on Intel :)

As per your keyboard issue, since switching between terminals works, I'm assuming this is not per se a driver issue - I guess this needs more work to debug. Does the keyboard still work after resuming in an X or Wayland session?

In D48735#1120542, @obiwac_gmail.com wrote:

Does the keyboard still work after resuming in an X or Wayland session?

I tested it without X session and i915kms loaded because screen remains black in an X session after resume.

After resume there is no response to pressing keyboard keys in the console, but switching between terminals works.

Not sure if it will be related but I have seen issues with modifier key status becoming incorrect. When the keyboard is not functional can you try pressing and releasing each of the Shift, Ctrl, and Alt keys in turn, and see if it works after that?

See changes/comments in D48387, but will add an interface for PMC suspend and resume which this will use.

Add acpi_pmc interface, which acpi_EnterSleepState() calls the suspend and resume methods of during late suspend and early resume.

obiwac retitled this revision from acpi: Call SPMC entry/exit hooks if SPMC device is set to acpi: Call SPMC suspend/resume hooks.Sat, Jan 24, 8:16 PM
obiwac edited the summary of this revision. (Show Details)
obiwac added a reviewer: olce.

Use eventhandler hooks instead of new acpi_pmc interface

Remove dev/acpica/acpi_pmc_if.m from sys/conf/files

Rename acpi_pmc_suspend/acpi_pmc_resume to acpi_late_suspend/acpi_early_resume respectively (at request of olce@).

sys/dev/acpica/acpi_spmc.c
231–238 ↗(On Diff #170853)

No need to test if NULL, event handler registration never fails (allocates memory with M_WAITOK, and the rest can never fail).

248–251 ↗(On Diff #170853)

Same here, no need to test for NULL.

sys/dev/acpica/acpivar.h
490–493

I'd rename these new handlers so they look more generic. They might serve other purposes than just signal SPMC.

Rename hooks again + don't check EVENTHANDLER_REGISTER

Don't need to check for NULL if EVENTHANDLER_REGISTER never returns it anyway.

This revision is now accepted and ready to land.Mon, Feb 2, 3:54 PM