Skip to content

Commit 0ce2f38

Browse files
committed
Merge tag 'acpi-4.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These are two fixups for the suspend-to-idle handling in the ACPI subsystem after recent changes in that area and two simple fixes of the ACPI NUMA code. Specifics: - Add an ACPI module parameter to allow users to override the new default behavior on some systems where the EC GPE is not disabled during suspend-to-idle in case the EC on their systems generates excessive wakeup events and they want to sacrifice some functionality (like power button wakeups) for extra battery life while suspended (Rafael Wysocki). - Fix flushing of the outstanding EC work in the ACPI core suspend-to-idle code (Rafael Wysocki). - Add a missing include and fix a messed-up comment in the ACPI NUMA code (Ross Zwisler)" * tag 'acpi-4.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: NUMA: Fix typo in the full name of SRAT ACPI: NUMA: add missing include in acpi_numa.h ACPI / PM / EC: Flush all EC work in acpi_freeze_sync() ACPI / EC: Add parameter to force disable the GPE on suspend
2 parents 36cb531 + f6248dd commit 0ce2f38

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

drivers/acpi/ec.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ static bool ec_freeze_events __read_mostly = false;
151151
module_param(ec_freeze_events, bool, 0644);
152152
MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume");
153153

154+
static bool ec_no_wakeup __read_mostly;
155+
module_param(ec_no_wakeup, bool, 0644);
156+
MODULE_PARM_DESC(ec_no_wakeup, "Do not wake up from suspend-to-idle");
157+
154158
struct acpi_ec_query_handler {
155159
struct list_head node;
156160
acpi_ec_query_func func;
@@ -535,6 +539,14 @@ static void acpi_ec_disable_event(struct acpi_ec *ec)
535539
spin_unlock_irqrestore(&ec->lock, flags);
536540
__acpi_ec_flush_event(ec);
537541
}
542+
543+
void acpi_ec_flush_work(void)
544+
{
545+
if (first_ec)
546+
__acpi_ec_flush_event(first_ec);
547+
548+
flush_scheduled_work();
549+
}
538550
#endif /* CONFIG_PM_SLEEP */
539551

540552
static bool acpi_ec_guard_event(struct acpi_ec *ec)
@@ -1880,6 +1892,32 @@ static int acpi_ec_suspend(struct device *dev)
18801892
return 0;
18811893
}
18821894

1895+
static int acpi_ec_suspend_noirq(struct device *dev)
1896+
{
1897+
struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev));
1898+
1899+
/*
1900+
* The SCI handler doesn't run at this point, so the GPE can be
1901+
* masked at the low level without side effects.
1902+
*/
1903+
if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) &&
1904+
ec->reference_count >= 1)
1905+
acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
1906+
1907+
return 0;
1908+
}
1909+
1910+
static int acpi_ec_resume_noirq(struct device *dev)
1911+
{
1912+
struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev));
1913+
1914+
if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) &&
1915+
ec->reference_count >= 1)
1916+
acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
1917+
1918+
return 0;
1919+
}
1920+
18831921
static int acpi_ec_resume(struct device *dev)
18841922
{
18851923
struct acpi_ec *ec =
@@ -1891,6 +1929,7 @@ static int acpi_ec_resume(struct device *dev)
18911929
#endif
18921930

18931931
static const struct dev_pm_ops acpi_ec_pm = {
1932+
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(acpi_ec_suspend_noirq, acpi_ec_resume_noirq)
18941933
SET_SYSTEM_SLEEP_PM_OPS(acpi_ec_suspend, acpi_ec_resume)
18951934
};
18961935

drivers/acpi/internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
193193
void *data);
194194
void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
195195

196+
#ifdef CONFIG_PM_SLEEP
197+
void acpi_ec_flush_work(void);
198+
#endif
199+
196200

197201
/*--------------------------------------------------------------------------
198202
Suspend/Resume

drivers/acpi/numa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ int __init acpi_numa_init(void)
443443
* So go over all cpu entries in SRAT to get apicid to node mapping.
444444
*/
445445

446-
/* SRAT: Static Resource Affinity Table */
446+
/* SRAT: System Resource Affinity Table */
447447
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
448448
struct acpi_subtable_proc srat_proc[3];
449449

drivers/acpi/sleep.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,11 +777,11 @@ static void acpi_freeze_sync(void)
777777
/*
778778
* Process all pending events in case there are any wakeup ones.
779779
*
780-
* The EC driver uses the system workqueue, so that one needs to be
781-
* flushed too.
780+
* The EC driver uses the system workqueue and an additional special
781+
* one, so those need to be flushed too.
782782
*/
783+
acpi_ec_flush_work();
783784
acpi_os_wait_events_complete();
784-
flush_scheduled_work();
785785
s2idle_wakeup = false;
786786
}
787787

include/acpi/acpi_numa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#ifdef CONFIG_ACPI_NUMA
55
#include <linux/kernel.h>
6+
#include <linux/numa.h>
67

78
/* Proximity bitmap length */
89
#if MAX_NUMNODES > 256

0 commit comments

Comments
 (0)