Merge branch 'acpi-soc'

Merge a fix for hibernation regression in the ACPI driver for Intel
SoCs (LPSS).

* acpi-soc:
  ACPI / LPSS: Avoid PM quirks on suspend and resume from hibernation
This commit is contained in:
Rafael J. Wysocki 2018-07-31 10:35:47 +02:00
commit 5f95d39b42
1 changed files with 17 additions and 9 deletions

View File

@ -879,6 +879,7 @@ static void acpi_lpss_dismiss(struct device *dev)
#define LPSS_GPIODEF0_DMA_LLP BIT(13) #define LPSS_GPIODEF0_DMA_LLP BIT(13)
static DEFINE_MUTEX(lpss_iosf_mutex); static DEFINE_MUTEX(lpss_iosf_mutex);
static bool lpss_iosf_d3_entered;
static void lpss_iosf_enter_d3_state(void) static void lpss_iosf_enter_d3_state(void)
{ {
@ -921,6 +922,9 @@ static void lpss_iosf_enter_d3_state(void)
iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE,
LPSS_IOSF_GPIODEF0, value1, mask1); LPSS_IOSF_GPIODEF0, value1, mask1);
lpss_iosf_d3_entered = true;
exit: exit:
mutex_unlock(&lpss_iosf_mutex); mutex_unlock(&lpss_iosf_mutex);
} }
@ -935,6 +939,11 @@ static void lpss_iosf_exit_d3_state(void)
mutex_lock(&lpss_iosf_mutex); mutex_lock(&lpss_iosf_mutex);
if (!lpss_iosf_d3_entered)
goto exit;
lpss_iosf_d3_entered = false;
iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE,
LPSS_IOSF_GPIODEF0, value1, mask1); LPSS_IOSF_GPIODEF0, value1, mask1);
@ -944,13 +953,13 @@ static void lpss_iosf_exit_d3_state(void)
iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE,
LPSS_IOSF_PMCSR, value2, mask2); LPSS_IOSF_PMCSR, value2, mask2);
exit:
mutex_unlock(&lpss_iosf_mutex); mutex_unlock(&lpss_iosf_mutex);
} }
static int acpi_lpss_suspend(struct device *dev, bool runtime) static int acpi_lpss_suspend(struct device *dev, bool wakeup)
{ {
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
bool wakeup = runtime || device_may_wakeup(dev);
int ret; int ret;
if (pdata->dev_desc->flags & LPSS_SAVE_CTX) if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
@ -963,14 +972,14 @@ static int acpi_lpss_suspend(struct device *dev, bool runtime)
* wrong status for devices being about to be powered off. See * wrong status for devices being about to be powered off. See
* lpss_iosf_enter_d3_state() for further information. * lpss_iosf_enter_d3_state() for further information.
*/ */
if ((runtime || !pm_suspend_via_firmware()) && if (acpi_target_system_state() == ACPI_STATE_S0 &&
lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_iosf_enter_d3_state(); lpss_iosf_enter_d3_state();
return ret; return ret;
} }
static int acpi_lpss_resume(struct device *dev, bool runtime) static int acpi_lpss_resume(struct device *dev)
{ {
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
int ret; int ret;
@ -979,8 +988,7 @@ static int acpi_lpss_resume(struct device *dev, bool runtime)
* This call is kept first to be in symmetry with * This call is kept first to be in symmetry with
* acpi_lpss_runtime_suspend() one. * acpi_lpss_runtime_suspend() one.
*/ */
if ((runtime || !pm_resume_via_firmware()) && if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_iosf_exit_d3_state(); lpss_iosf_exit_d3_state();
ret = acpi_dev_resume(dev); ret = acpi_dev_resume(dev);
@ -1004,12 +1012,12 @@ static int acpi_lpss_suspend_late(struct device *dev)
return 0; return 0;
ret = pm_generic_suspend_late(dev); ret = pm_generic_suspend_late(dev);
return ret ? ret : acpi_lpss_suspend(dev, false); return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev));
} }
static int acpi_lpss_resume_early(struct device *dev) static int acpi_lpss_resume_early(struct device *dev)
{ {
int ret = acpi_lpss_resume(dev, false); int ret = acpi_lpss_resume(dev);
return ret ? ret : pm_generic_resume_early(dev); return ret ? ret : pm_generic_resume_early(dev);
} }
@ -1024,7 +1032,7 @@ static int acpi_lpss_runtime_suspend(struct device *dev)
static int acpi_lpss_runtime_resume(struct device *dev) static int acpi_lpss_runtime_resume(struct device *dev)
{ {
int ret = acpi_lpss_resume(dev, true); int ret = acpi_lpss_resume(dev);
return ret ? ret : pm_generic_runtime_resume(dev); return ret ? ret : pm_generic_runtime_resume(dev);
} }