Skip to content

Commit fe03a75

Browse files
committed
Merge tag 'acpi-4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These are two watchdog-related fixes, fix for a backlight regression from the 4.16 cycle that unfortunately was propagated to -stable and a button module modification to prevent graphics driver modules from failing to load due to unmet dependencies if ACPI is disabled from the kernel command line. Specifics: - Change the ACPI subsystem initialization ordering to initialize the WDAT watchodg before reserving PNP motherboard resources so as to allow the watchdog to allocate its resources before the PNP code gets to them and prevents it from working correctly (Mika Westerberg). - Add a quirk for Lenovo Z50-70 to use the iTCO watchdog instead of the WDAT one which conflicts with the RTC on that platform (Mika Westerberg). - Avoid breaking backlight handling on Dell XPS 13 2013 model by allowing laptops to use the ACPI backlight by default even if they are Windows 8-ready in principle (Hans de Goede)" * tag 'acpi-4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / video: Only default only_lcd to true on Win8-ready _desktops_ ACPI / button: make module loadable when booted in non-ACPI mode ACPI / watchdog: Prefer iTCO_wdt on Lenovo Z50-70 ACPI / scan: Initialize watchdog before PNP
2 parents e58d911 + bd6dff5 commit fe03a75

4 files changed

Lines changed: 98 additions & 14 deletions

File tree

‎drivers/acpi/acpi_video.c‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,25 @@ static int __init intel_opregion_present(void)
21232123
return opregion;
21242124
}
21252125

2126+
static bool dmi_is_desktop(void)
2127+
{
2128+
const char *chassis_type;
2129+
2130+
chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
2131+
if (!chassis_type)
2132+
return false;
2133+
2134+
if (!strcmp(chassis_type, "3") || /* 3: Desktop */
2135+
!strcmp(chassis_type, "4") || /* 4: Low Profile Desktop */
2136+
!strcmp(chassis_type, "5") || /* 5: Pizza Box */
2137+
!strcmp(chassis_type, "6") || /* 6: Mini Tower */
2138+
!strcmp(chassis_type, "7") || /* 7: Tower */
2139+
!strcmp(chassis_type, "11")) /* 11: Main Server Chassis */
2140+
return true;
2141+
2142+
return false;
2143+
}
2144+
21262145
int acpi_video_register(void)
21272146
{
21282147
int ret = 0;
@@ -2143,8 +2162,12 @@ int acpi_video_register(void)
21432162
* win8 ready (where we also prefer the native backlight driver, so
21442163
* normally the acpi_video code should not register there anyways).
21452164
*/
2146-
if (only_lcd == -1)
2147-
only_lcd = acpi_osi_is_win8();
2165+
if (only_lcd == -1) {
2166+
if (dmi_is_desktop() && acpi_osi_is_win8())
2167+
only_lcd = true;
2168+
else
2169+
only_lcd = false;
2170+
}
21482171

21492172
dmi_check_system(video_dmi_table);
21502173

‎drivers/acpi/acpi_watchdog.c‎

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,64 @@
1212
#define pr_fmt(fmt) "ACPI: watchdog: " fmt
1313

1414
#include <linux/acpi.h>
15+
#include <linux/dmi.h>
1516
#include <linux/ioport.h>
1617
#include <linux/platform_device.h>
1718

1819
#include "internal.h"
1920

21+
static const struct dmi_system_id acpi_watchdog_skip[] = {
22+
{
23+
/*
24+
* On Lenovo Z50-70 there are two issues with the WDAT
25+
* table. First some of the instructions use RTC SRAM
26+
* to store persistent information. This does not work well
27+
* with Linux RTC driver. Second, more important thing is
28+
* that the instructions do not actually reset the system.
29+
*
30+
* On this particular system iTCO_wdt seems to work just
31+
* fine so we prefer that over WDAT for now.
32+
*
33+
* See also https://bugzilla.kernel.org/show_bug.cgi?id=199033.
34+
*/
35+
.ident = "Lenovo Z50-70",
36+
.matches = {
37+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
38+
DMI_MATCH(DMI_PRODUCT_NAME, "20354"),
39+
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"),
40+
},
41+
},
42+
{}
43+
};
44+
45+
static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
46+
{
47+
const struct acpi_table_wdat *wdat = NULL;
48+
acpi_status status;
49+
50+
if (acpi_disabled)
51+
return NULL;
52+
53+
if (dmi_check_system(acpi_watchdog_skip))
54+
return NULL;
55+
56+
status = acpi_get_table(ACPI_SIG_WDAT, 0,
57+
(struct acpi_table_header **)&wdat);
58+
if (ACPI_FAILURE(status)) {
59+
/* It is fine if there is no WDAT */
60+
return NULL;
61+
}
62+
63+
return wdat;
64+
}
65+
2066
/**
2167
* Returns true if this system should prefer ACPI based watchdog instead of
2268
* the native one (which are typically the same hardware).
2369
*/
2470
bool acpi_has_watchdog(void)
2571
{
26-
struct acpi_table_header hdr;
27-
28-
if (acpi_disabled)
29-
return false;
30-
31-
return ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_WDAT, 0, &hdr));
72+
return !!acpi_watchdog_get_wdat();
3273
}
3374
EXPORT_SYMBOL_GPL(acpi_has_watchdog);
3475

@@ -41,12 +82,10 @@ void __init acpi_watchdog_init(void)
4182
struct platform_device *pdev;
4283
struct resource *resources;
4384
size_t nresources = 0;
44-
acpi_status status;
4585
int i;
4686

47-
status = acpi_get_table(ACPI_SIG_WDAT, 0,
48-
(struct acpi_table_header **)&wdat);
49-
if (ACPI_FAILURE(status)) {
87+
wdat = acpi_watchdog_get_wdat();
88+
if (!wdat) {
5089
/* It is fine if there is no WDAT */
5190
return;
5291
}

‎drivers/acpi/button.c‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,26 @@ module_param_call(lid_init_state,
635635
NULL, 0644);
636636
MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state");
637637

638-
module_acpi_driver(acpi_button_driver);
638+
static int acpi_button_register_driver(struct acpi_driver *driver)
639+
{
640+
/*
641+
* Modules such as nouveau.ko and i915.ko have a link time dependency
642+
* on acpi_lid_open(), and would therefore not be loadable on ACPI
643+
* capable kernels booted in non-ACPI mode if the return value of
644+
* acpi_bus_register_driver() is returned from here with ACPI disabled
645+
* when this driver is built as a module.
646+
*/
647+
if (acpi_disabled)
648+
return 0;
649+
650+
return acpi_bus_register_driver(driver);
651+
}
652+
653+
static void acpi_button_unregister_driver(struct acpi_driver *driver)
654+
{
655+
if (!acpi_disabled)
656+
acpi_bus_unregister_driver(driver);
657+
}
658+
659+
module_driver(acpi_button_driver, acpi_button_register_driver,
660+
acpi_button_unregister_driver);

‎drivers/acpi/scan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,10 +2166,10 @@ int __init acpi_scan_init(void)
21662166
acpi_cmos_rtc_init();
21672167
acpi_container_init();
21682168
acpi_memory_hotplug_init();
2169+
acpi_watchdog_init();
21692170
acpi_pnp_init();
21702171
acpi_int340x_thermal_init();
21712172
acpi_amba_init();
2172-
acpi_watchdog_init();
21732173
acpi_init_lpit();
21742174

21752175
acpi_scan_add_handler(&generic_device_handler);

0 commit comments

Comments
 (0)