ACPI fixes for 4.18-rc2

- Fix a suspend/resume regression in the ACPI driver for Intel SoCs
    (LPSS) to make it work on systems where some power management
    quirks should only be applied for runtime PM and suspend-to-idle
    and not for suspend-to-RAM (Rafael Wysocki).
 
  - Add a system wakeup quirk for Thinkpad X1 Carbon 6th to the ACPI
    EC driver to avoid drainig battery too fast while suspended to
    idle on those systems (Mika Westerberg).
 
  - Fix an inline stub of acpi_processor_ppc_has_changed() to match
    the original function definition (Brian Norris).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJbK6CTAAoJEILEb/54YlRxAZgQAKHfEJqpM0ElU+gtgxVpwTNb
 nl0j9FvJ0BKmXRirrIgPhoqEqw3uqgDh43H3qsWLioh6DebJSnKN0VBHo3As0dZZ
 WnIRcmrJxpjwP601+4R+rbx2LeKljL42+HGRK0FpWA5QsBGRAazsraOJkYup1M0p
 FB+F7XlvNDD/Yk7VkDPvn2/OZLeuucUkyoNzNruemERDzKenGhpwv4cwMGIOQdqT
 VTyPycV+H6A6Oasu3K8x0BtvUI2C3tmSymfyXs6yOKfnFYfJNyUoevoXZ8OOwW+J
 Vw0CwTLYH+uJcht8DJLOqlfmmdRtQsTZ+yz5HROrJyFEqt2zSx2WHfapN/5At/vJ
 O/1f9S43WVs9FnyVaKbRfWOA66OayTX948rOSmBVGtqBiBjMxbf4vOwzrrpVxw7w
 A2nQ1hoh4soP90HVptiBK9hBVaJ58aVDX+E8TDi2dXGYUMSRGZMrJdHBxIrJZQZ2
 EU/LxbzEshFOqVyWMjBGKfelDzN093jXrIM+5kFZMc4ufoINfnPyr3UMVHd0r82N
 8usTqDPCTsYBQcfdKUi29sQ/rt9FFMZjb1P6ILzMtz52oU//kkDy6u2jmXahTTj/
 Osfg9143wX8kEJoG89GsJt3OV/3m+gosOBXJOtvNa1+gz6Cx+IqBuvu7thGVsMKb
 t1VVmlNcYcUs9Mz4f+fR
 =Oy/Y
 -----END PGP SIGNATURE-----

Merge tag 'acpi-4.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
 "These fix a suspend/resume regression in the ACPI driver for Intel
  SoCs (LPSS), add a new system wakeup quirk to the ACPI EC driver and
  fix an inline stub of a function in the ACPI processor driver that
  diverged from the original.

  Specifics:

   - Fix a suspend/resume regression in the ACPI driver for Intel SoCs
     (LPSS) to make it work on systems where some power management
     quirks should only be applied for runtime PM and suspend-to-idle
     and not for suspend-to-RAM (Rafael Wysocki).

   - Add a system wakeup quirk for Thinkpad X1 Carbon 6th to the ACPI EC
     driver to avoid drainig battery too fast while suspended to idle on
     those systems (Mika Westerberg).

   - Fix an inline stub of acpi_processor_ppc_has_changed() to match the
     original function definition (Brian Norris)"

* tag 'acpi-4.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / processor: Finish making acpi_processor_ppc_has_changed() void
  ACPI / EC: Use ec_no_wakeup on Thinkpad X1 Carbon 6th
  ACPI / LPSS: Avoid PM quirks on suspend and resume from S3
This commit is contained in:
Linus Torvalds 2018-06-22 06:00:13 +09:00
commit f43fc5a0c1
3 changed files with 32 additions and 9 deletions

View File

@ -22,6 +22,7 @@
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/pwm.h>
#include <linux/suspend.h>
#include <linux/delay.h>
#include "internal.h"
@ -946,9 +947,10 @@ static void lpss_iosf_exit_d3_state(void)
mutex_unlock(&lpss_iosf_mutex);
}
static int acpi_lpss_suspend(struct device *dev, bool wakeup)
static int acpi_lpss_suspend(struct device *dev, bool runtime)
{
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
bool wakeup = runtime || device_may_wakeup(dev);
int ret;
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
@ -961,13 +963,14 @@ static int acpi_lpss_suspend(struct device *dev, bool wakeup)
* wrong status for devices being about to be powered off. See
* lpss_iosf_enter_d3_state() for further information.
*/
if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
if ((runtime || !pm_suspend_via_firmware()) &&
lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_iosf_enter_d3_state();
return ret;
}
static int acpi_lpss_resume(struct device *dev)
static int acpi_lpss_resume(struct device *dev, bool runtime)
{
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
int ret;
@ -976,7 +979,8 @@ static int acpi_lpss_resume(struct device *dev)
* This call is kept first to be in symmetry with
* acpi_lpss_runtime_suspend() one.
*/
if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
if ((runtime || !pm_resume_via_firmware()) &&
lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_iosf_exit_d3_state();
ret = acpi_dev_resume(dev);
@ -1000,12 +1004,12 @@ static int acpi_lpss_suspend_late(struct device *dev)
return 0;
ret = pm_generic_suspend_late(dev);
return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev));
return ret ? ret : acpi_lpss_suspend(dev, false);
}
static int acpi_lpss_resume_early(struct device *dev)
{
int ret = acpi_lpss_resume(dev);
int ret = acpi_lpss_resume(dev, false);
return ret ? ret : pm_generic_resume_early(dev);
}
@ -1020,7 +1024,7 @@ static int acpi_lpss_runtime_suspend(struct device *dev)
static int acpi_lpss_runtime_resume(struct device *dev)
{
int ret = acpi_lpss_resume(dev);
int ret = acpi_lpss_resume(dev, true);
return ret ? ret : pm_generic_runtime_resume(dev);
}

View File

@ -2037,6 +2037,17 @@ static inline void acpi_ec_query_exit(void)
}
}
static const struct dmi_system_id acpi_ec_no_wakeup[] = {
{
.ident = "Thinkpad X1 Carbon 6th",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "20KGS3JF01"),
},
},
{ },
};
int __init acpi_ec_init(void)
{
int result;
@ -2047,6 +2058,15 @@ int __init acpi_ec_init(void)
if (result)
return result;
/*
* Disable EC wakeup on following systems to prevent periodic
* wakeup from EC GPE.
*/
if (dmi_check_system(acpi_ec_no_wakeup)) {
ec_no_wakeup = true;
pr_debug("Disabling EC wakeup on suspend-to-idle\n");
}
/* Drivers must be started after acpi_ec_query_init() */
dsdt_fail = acpi_bus_register_driver(&acpi_ec_driver);
/*

View File

@ -309,7 +309,7 @@ static inline void acpi_processor_ppc_exit(void)
{
return;
}
static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr,
static inline void acpi_processor_ppc_has_changed(struct acpi_processor *pr,
int event_flag)
{
static unsigned int printout = 1;
@ -320,7 +320,6 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr,
"Consider compiling CPUfreq support into your kernel.\n");
printout = 0;
}
return 0;
}
static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
{