View | Details | Raw Unified | Return to bug 44161 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/acpi/ec.c (-1 / +53 lines)
Lines 194-199 static struct workqueue_struct *ec_query_wq; Link Here
194
static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
194
static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
195
static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */
195
static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */
196
static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setting */
196
static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setting */
197
static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */
197
198
198
/* --------------------------------------------------------------------------
199
/* --------------------------------------------------------------------------
199
 *                           Logging/Debugging
200
 *                           Logging/Debugging
Lines 499-504 static inline void __acpi_ec_disable_event(struct acpi_ec *ec) Link Here
499
		ec_log_drv("event blocked");
500
		ec_log_drv("event blocked");
500
}
501
}
501
502
503
/*
504
 * Process _Q events that might have accumulated in the EC.
505
 * Run with locked ec mutex.
506
 */
507
static void acpi_ec_clear(struct acpi_ec *ec)
508
{
509
	int i, status;
510
	u8 value = 0;
511
512
	for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
513
		status = acpi_ec_query(ec, &value);
514
		if (status || !value)
515
			break;
516
	}
517
	if (unlikely(i == ACPI_EC_CLEAR_MAX))
518
		pr_warn("Warning: Maximum of %d stale EC events cleared\n", i);
519
	else
520
		pr_info("%d stale EC events cleared\n", i);
521
}
522
502
static void acpi_ec_enable_event(struct acpi_ec *ec)
523
static void acpi_ec_enable_event(struct acpi_ec *ec)
503
{
524
{
504
	unsigned long flags;
525
	unsigned long flags;
Lines 507-512 static void acpi_ec_enable_event(struct acpi_ec *ec) Link Here
507
	if (acpi_ec_started(ec))
528
	if (acpi_ec_started(ec))
508
		__acpi_ec_enable_event(ec);
529
		__acpi_ec_enable_event(ec);
509
	spin_unlock_irqrestore(&ec->lock, flags);
530
	spin_unlock_irqrestore(&ec->lock, flags);
531
532
	/* Drain additional events if hardware requires that */
533
	if (EC_FLAGS_CLEAR_ON_RESUME)
534
		acpi_ec_clear(ec);
510
}
535
}
511
536
512
#ifdef CONFIG_PM_SLEEP
537
#ifdef CONFIG_PM_SLEEP
Lines 1803-1808 static int ec_flag_query_handshake(const struct dmi_system_id *id) Link Here
1803
#endif
1828
#endif
1804
1829
1805
/*
1830
/*
1831
 * On some hardware it is necessary to clear events accumulated by the EC during
1832
 * sleep. These ECs stop reporting GPEs until they are manually polled, if too
1833
 * many events are accumulated. (e.g. Samsung Series 5/9 notebooks)
1834
 *
1835
 * https://bugzilla.kernel.org/show_bug.cgi?id=44161
1836
 *
1837
 * Ideally, the EC should also be instructed NOT to accumulate events during
1838
 * sleep (which Windows seems to do somehow), but the interface to control this
1839
 * behaviour is not known at this time.
1840
 *
1841
 * Models known to be affected are Samsung 530Uxx/535Uxx/540Uxx/550Pxx/900Xxx,
1842
 * however it is very likely that other Samsung models are affected.
1843
 *
1844
 * On systems which don't accumulate _Q events during sleep, this extra check
1845
 * should be harmless.
1846
 */
1847
static int ec_clear_on_resume(const struct dmi_system_id *id)
1848
{
1849
	pr_debug("Detected system needing EC poll on resume.\n");
1850
	EC_FLAGS_CLEAR_ON_RESUME = 1;
1851
	ec_event_clearing = ACPI_EC_EVT_TIMING_STATUS;
1852
	return 0;
1853
}
1854
1855
/*
1806
 * Some ECDTs contain wrong register addresses.
1856
 * Some ECDTs contain wrong register addresses.
1807
 * MSI MS-171F
1857
 * MSI MS-171F
1808
 * https://bugzilla.kernel.org/show_bug.cgi?id=12461
1858
 * https://bugzilla.kernel.org/show_bug.cgi?id=12461
Lines 1851-1856 static const struct dmi_system_id ec_dmi_table[] __initconst = { Link Here
1851
	ec_honor_ecdt_gpe, "ASUS X580VD", {
1901
	ec_honor_ecdt_gpe, "ASUS X580VD", {
1852
	DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1902
	DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1853
	DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL},
1903
	DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL},
1904
	{
1905
	ec_clear_on_resume, "Samsung hardware", {
1906
	DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL},
1854
	{},
1907
	{},
1855
};
1908
};
1856
1909
1857
- 

Return to bug 44161