diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-07-31 05:05:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-08-08 05:25:22 -0400 |
commit | 068b47d0984b8756ae71702a1a87aa226cb72fe8 (patch) | |
tree | 9b7d5c11019fa81a10659e69320db131c4cb288c /drivers/acpi/sleep.c | |
parent | 2e2c2fdc53437beffd2cf26aaf6187e602d565bc (diff) |
ACPI: PM: s2idle: Add acpi.sleep_no_lps0 module parameter
Add a module parameter to prevent the ACPI LPS0 _DSM functions
from being invoked (if need be) and rework the suspend-to-idle
blacklist entries in acpisleep_dmi_table[] to make them simply
prevent suspend-to-idle from being used by default on the systems
in question (which really is the original purpose of those entries).
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r-- | drivers/acpi/sleep.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3d706938980a..4a94600fea39 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -89,6 +89,10 @@ bool acpi_sleep_state_supported(u8 sleep_state) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | #ifdef CONFIG_ACPI_SLEEP | 91 | #ifdef CONFIG_ACPI_SLEEP |
92 | static bool sleep_no_lps0 __read_mostly; | ||
93 | module_param(sleep_no_lps0, bool, 0644); | ||
94 | MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface"); | ||
95 | |||
92 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | 96 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; |
93 | 97 | ||
94 | u32 acpi_target_system_state(void) | 98 | u32 acpi_target_system_state(void) |
@@ -158,11 +162,11 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) | |||
158 | return 0; | 162 | return 0; |
159 | } | 163 | } |
160 | 164 | ||
161 | static bool acpi_sleep_no_lps0; | 165 | static bool acpi_sleep_default_s3; |
162 | 166 | ||
163 | static int __init init_no_lps0(const struct dmi_system_id *d) | 167 | static int __init init_default_s3(const struct dmi_system_id *d) |
164 | { | 168 | { |
165 | acpi_sleep_no_lps0 = true; | 169 | acpi_sleep_default_s3 = true; |
166 | return 0; | 170 | return 0; |
167 | } | 171 | } |
168 | 172 | ||
@@ -363,7 +367,7 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { | |||
363 | * S0 Idle firmware interface. | 367 | * S0 Idle firmware interface. |
364 | */ | 368 | */ |
365 | { | 369 | { |
366 | .callback = init_no_lps0, | 370 | .callback = init_default_s3, |
367 | .ident = "Dell XPS13 9360", | 371 | .ident = "Dell XPS13 9360", |
368 | .matches = { | 372 | .matches = { |
369 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | 373 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
@@ -376,7 +380,7 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { | |||
376 | * https://bugzilla.kernel.org/show_bug.cgi?id=199057). | 380 | * https://bugzilla.kernel.org/show_bug.cgi?id=199057). |
377 | */ | 381 | */ |
378 | { | 382 | { |
379 | .callback = init_no_lps0, | 383 | .callback = init_default_s3, |
380 | .ident = "ThinkPad X1 Tablet(2016)", | 384 | .ident = "ThinkPad X1 Tablet(2016)", |
381 | .matches = { | 385 | .matches = { |
382 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 386 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
@@ -524,8 +528,9 @@ static void acpi_pm_end(void) | |||
524 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 528 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
525 | } | 529 | } |
526 | #else /* !CONFIG_ACPI_SLEEP */ | 530 | #else /* !CONFIG_ACPI_SLEEP */ |
531 | #define sleep_no_lps0 (1) | ||
527 | #define acpi_target_sleep_state ACPI_STATE_S0 | 532 | #define acpi_target_sleep_state ACPI_STATE_S0 |
528 | #define acpi_sleep_no_lps0 (false) | 533 | #define acpi_sleep_default_s3 (1) |
529 | static inline void acpi_sleep_dmi_check(void) {} | 534 | static inline void acpi_sleep_dmi_check(void) {} |
530 | #endif /* CONFIG_ACPI_SLEEP */ | 535 | #endif /* CONFIG_ACPI_SLEEP */ |
531 | 536 | ||
@@ -904,12 +909,6 @@ static int lps0_device_attach(struct acpi_device *adev, | |||
904 | if (lps0_device_handle) | 909 | if (lps0_device_handle) |
905 | return 0; | 910 | return 0; |
906 | 911 | ||
907 | if (acpi_sleep_no_lps0) { | ||
908 | acpi_handle_info(adev->handle, | ||
909 | "Low Power S0 Idle interface disabled\n"); | ||
910 | return 0; | ||
911 | } | ||
912 | |||
913 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) | 912 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) |
914 | return 0; | 913 | return 0; |
915 | 914 | ||
@@ -937,7 +936,7 @@ static int lps0_device_attach(struct acpi_device *adev, | |||
937 | * Use suspend-to-idle by default if the default suspend mode was not | 936 | * Use suspend-to-idle by default if the default suspend mode was not |
938 | * set from the command line. | 937 | * set from the command line. |
939 | */ | 938 | */ |
940 | if (mem_sleep_default > PM_SUSPEND_MEM) | 939 | if (mem_sleep_default > PM_SUSPEND_MEM && !acpi_sleep_default_s3) |
941 | mem_sleep_current = PM_SUSPEND_TO_IDLE; | 940 | mem_sleep_current = PM_SUSPEND_TO_IDLE; |
942 | 941 | ||
943 | return 0; | 942 | return 0; |
@@ -957,7 +956,7 @@ static int acpi_s2idle_begin(void) | |||
957 | 956 | ||
958 | static int acpi_s2idle_prepare(void) | 957 | static int acpi_s2idle_prepare(void) |
959 | { | 958 | { |
960 | if (lps0_device_handle) { | 959 | if (lps0_device_handle && !sleep_no_lps0) { |
961 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF); | 960 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF); |
962 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY); | 961 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY); |
963 | } | 962 | } |
@@ -977,7 +976,7 @@ static int acpi_s2idle_prepare(void) | |||
977 | 976 | ||
978 | static void acpi_s2idle_wake(void) | 977 | static void acpi_s2idle_wake(void) |
979 | { | 978 | { |
980 | if (lps0_device_handle && pm_debug_messages_on) | 979 | if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on) |
981 | lpi_check_constraints(); | 980 | lpi_check_constraints(); |
982 | 981 | ||
983 | /* | 982 | /* |
@@ -1025,7 +1024,7 @@ static void acpi_s2idle_restore(void) | |||
1025 | if (acpi_sci_irq_valid()) | 1024 | if (acpi_sci_irq_valid()) |
1026 | disable_irq_wake(acpi_sci_irq); | 1025 | disable_irq_wake(acpi_sci_irq); |
1027 | 1026 | ||
1028 | if (lps0_device_handle) { | 1027 | if (lps0_device_handle && !sleep_no_lps0) { |
1029 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT); | 1028 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT); |
1030 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON); | 1029 | acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON); |
1031 | } | 1030 | } |