Skip to content

Commit e543b10

Browse files
committed
Merge branches 'acpi-pm' and 'acpi-docs'
* acpi-pm: ACPI: PM: s2idle: Run both AMD and Microsoft methods if both are supported * acpi-docs: Documentation: ACPI: Align the SSDT overlays file with the code
3 parents 59dc332 + fa20964 + 17b121a commit e543b10

File tree

2 files changed

+64
-52
lines changed

2 files changed

+64
-52
lines changed

Documentation/admin-guide/acpi/ssdt-overlays.rst

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,21 @@ following ASL code can be used::
3030
{
3131
Device (STAC)
3232
{
33-
Name (_ADR, Zero)
3433
Name (_HID, "BMA222E")
34+
Name (RBUF, ResourceTemplate ()
35+
{
36+
I2cSerialBus (0x0018, ControllerInitiated, 0x00061A80,
37+
AddressingMode7Bit, "\\_SB.I2C6", 0x00,
38+
ResourceConsumer, ,)
39+
GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
40+
"\\_SB.GPO2", 0x00, ResourceConsumer, , )
41+
{ // Pin list
42+
0
43+
}
44+
})
3545

3646
Method (_CRS, 0, Serialized)
3747
{
38-
Name (RBUF, ResourceTemplate ()
39-
{
40-
I2cSerialBus (0x0018, ControllerInitiated, 0x00061A80,
41-
AddressingMode7Bit, "\\_SB.I2C6", 0x00,
42-
ResourceConsumer, ,)
43-
GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
44-
"\\_SB.GPO2", 0x00, ResourceConsumer, , )
45-
{ // Pin list
46-
0
47-
}
48-
})
4948
Return (RBUF)
5049
}
5150
}
@@ -75,7 +74,7 @@ This option allows loading of user defined SSDTs from initrd and it is useful
7574
when the system does not support EFI or when there is not enough EFI storage.
7675

7776
It works in a similar way with initrd based ACPI tables override/upgrade: SSDT
78-
aml code must be placed in the first, uncompressed, initrd under the
77+
AML code must be placed in the first, uncompressed, initrd under the
7978
"kernel/firmware/acpi" path. Multiple files can be used and this will translate
8079
in loading multiple tables. Only SSDT and OEM tables are allowed. See
8180
initrd_table_override.txt for more details.
@@ -103,12 +102,14 @@ This is the preferred method, when EFI is supported on the platform, because it
103102
allows a persistent, OS independent way of storing the user defined SSDTs. There
104103
is also work underway to implement EFI support for loading user defined SSDTs
105104
and using this method will make it easier to convert to the EFI loading
106-
mechanism when that will arrive.
105+
mechanism when that will arrive. To enable it, the
106+
CONFIG_EFI_CUSTOM_SSDT_OVERLAYS shoyld be chosen to y.
107107

108-
In order to load SSDTs from an EFI variable the efivar_ssdt kernel command line
109-
parameter can be used. The argument for the option is the variable name to
110-
use. If there are multiple variables with the same name but with different
111-
vendor GUIDs, all of them will be loaded.
108+
In order to load SSDTs from an EFI variable the ``"efivar_ssdt=..."`` kernel
109+
command line parameter can be used (the name has a limitation of 16 characters).
110+
The argument for the option is the variable name to use. If there are multiple
111+
variables with the same name but with different vendor GUIDs, all of them will
112+
be loaded.
112113

113114
In order to store the AML code in an EFI variable the efivarfs filesystem can be
114115
used. It is enabled and mounted by default in /sys/firmware/efi/efivars in all
@@ -127,7 +128,7 @@ variable with the content from a given file::
127128

128129
#!/bin/sh -e
129130

130-
while ! [ -z "$1" ]; do
131+
while [ -n "$1" ]; do
131132
case "$1" in
132133
"-f") filename="$2"; shift;;
133134
"-g") guid="$2"; shift;;
@@ -167,14 +168,14 @@ variable with the content from a given file::
167168
Loading ACPI SSDTs from configfs
168169
================================
169170

170-
This option allows loading of user defined SSDTs from userspace via the configfs
171+
This option allows loading of user defined SSDTs from user space via the configfs
171172
interface. The CONFIG_ACPI_CONFIGFS option must be select and configfs must be
172173
mounted. In the following examples, we assume that configfs has been mounted in
173-
/config.
174+
/sys/kernel/config.
174175

175-
New tables can be loading by creating new directories in /config/acpi/table/ and
176-
writing the SSDT aml code in the aml attribute::
176+
New tables can be loading by creating new directories in /sys/kernel/config/acpi/table
177+
and writing the SSDT AML code in the aml attribute::
177178

178-
cd /config/acpi/table
179+
cd /sys/kernel/config/acpi/table
179180
mkdir my_ssdt
180181
cat ~/ssdt.aml > my_ssdt/aml

drivers/acpi/x86/s2idle.c

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -449,25 +449,30 @@ int acpi_s2idle_prepare_late(void)
449449
if (pm_debug_messages_on)
450450
lpi_check_constraints();
451451

452-
if (lps0_dsm_func_mask_microsoft > 0) {
452+
/* Screen off */
453+
if (lps0_dsm_func_mask > 0)
454+
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
455+
ACPI_LPS0_SCREEN_OFF_AMD :
456+
ACPI_LPS0_SCREEN_OFF,
457+
lps0_dsm_func_mask, lps0_dsm_guid);
458+
459+
if (lps0_dsm_func_mask_microsoft > 0)
453460
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
454461
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
455-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
456-
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
462+
463+
/* LPS0 entry */
464+
if (lps0_dsm_func_mask > 0)
465+
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
466+
ACPI_LPS0_ENTRY_AMD :
467+
ACPI_LPS0_ENTRY,
468+
lps0_dsm_func_mask, lps0_dsm_guid);
469+
if (lps0_dsm_func_mask_microsoft > 0) {
457470
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
458471
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
459-
} else if (acpi_s2idle_vendor_amd()) {
460-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF_AMD,
461-
lps0_dsm_func_mask, lps0_dsm_guid);
462-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
463-
lps0_dsm_func_mask, lps0_dsm_guid);
464-
} else {
465-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
466-
lps0_dsm_func_mask, lps0_dsm_guid);
467-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
468-
lps0_dsm_func_mask, lps0_dsm_guid);
472+
/* modern standby entry */
473+
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
474+
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
469475
}
470-
471476
return 0;
472477
}
473478

@@ -476,24 +481,30 @@ void acpi_s2idle_restore_early(void)
476481
if (!lps0_device_handle || sleep_no_lps0)
477482
return;
478483

479-
if (lps0_dsm_func_mask_microsoft > 0) {
480-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
481-
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
484+
/* Modern standby exit */
485+
if (lps0_dsm_func_mask_microsoft > 0)
482486
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
483487
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
484-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
485-
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
486-
} else if (acpi_s2idle_vendor_amd()) {
487-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_AMD,
488-
lps0_dsm_func_mask, lps0_dsm_guid);
489-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON_AMD,
490-
lps0_dsm_func_mask, lps0_dsm_guid);
491-
} else {
488+
489+
/* LPS0 exit */
490+
if (lps0_dsm_func_mask > 0)
491+
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
492+
ACPI_LPS0_EXIT_AMD :
493+
ACPI_LPS0_EXIT,
494+
lps0_dsm_func_mask, lps0_dsm_guid);
495+
if (lps0_dsm_func_mask_microsoft > 0)
492496
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
493-
lps0_dsm_func_mask, lps0_dsm_guid);
497+
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
498+
499+
/* Screen on */
500+
if (lps0_dsm_func_mask_microsoft > 0)
494501
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
495-
lps0_dsm_func_mask, lps0_dsm_guid);
496-
}
502+
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
503+
if (lps0_dsm_func_mask > 0)
504+
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
505+
ACPI_LPS0_SCREEN_ON_AMD :
506+
ACPI_LPS0_SCREEN_ON,
507+
lps0_dsm_func_mask, lps0_dsm_guid);
497508
}
498509

499510
static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {

0 commit comments

Comments
 (0)