mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-21 22:03:58 +00:00
ACPI / LPSS: Consolidate runtime PM and system sleep handling
Move the LPSS-specific code from acpi_lpss_runtime_suspend() and acpi_lpss_runtime_resume() into separate functions, acpi_lpss_suspend() and acpi_lpss_resume(), respectively, and make acpi_lpss_suspend_late() and acpi_lpss_resume_early() use them too in order to unify the runtime PM and system sleep handling in the LPSS driver. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
cbe25ce37d
commit
a192aa923b
1 changed files with 34 additions and 42 deletions
|
@ -716,40 +716,6 @@ static void acpi_lpss_dismiss(struct device *dev)
|
||||||
acpi_dev_suspend(dev, false);
|
acpi_dev_suspend(dev, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
|
||||||
static int acpi_lpss_suspend_late(struct device *dev)
|
|
||||||
{
|
|
||||||
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = pm_generic_suspend_late(dev);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
|
||||||
acpi_lpss_save_ctx(dev, pdata);
|
|
||||||
|
|
||||||
return acpi_dev_suspend(dev, device_may_wakeup(dev));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int acpi_lpss_resume_early(struct device *dev)
|
|
||||||
{
|
|
||||||
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = acpi_dev_resume(dev);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
acpi_lpss_d3_to_d0_delay(pdata);
|
|
||||||
|
|
||||||
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
|
||||||
acpi_lpss_restore_ctx(dev, pdata);
|
|
||||||
|
|
||||||
return pm_generic_resume_early(dev);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_PM_SLEEP */
|
|
||||||
|
|
||||||
/* IOSF SB for LPSS island */
|
/* IOSF SB for LPSS island */
|
||||||
#define LPSS_IOSF_UNIT_LPIOEP 0xA0
|
#define LPSS_IOSF_UNIT_LPIOEP 0xA0
|
||||||
#define LPSS_IOSF_UNIT_LPIO1 0xAB
|
#define LPSS_IOSF_UNIT_LPIO1 0xAB
|
||||||
|
@ -835,19 +801,15 @@ static void lpss_iosf_exit_d3_state(void)
|
||||||
mutex_unlock(&lpss_iosf_mutex);
|
mutex_unlock(&lpss_iosf_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_lpss_runtime_suspend(struct device *dev)
|
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));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pm_generic_runtime_suspend(dev);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
||||||
acpi_lpss_save_ctx(dev, pdata);
|
acpi_lpss_save_ctx(dev, pdata);
|
||||||
|
|
||||||
ret = acpi_dev_suspend(dev, true);
|
ret = acpi_dev_suspend(dev, wakeup);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This call must be last in the sequence, otherwise PMC will return
|
* This call must be last in the sequence, otherwise PMC will return
|
||||||
|
@ -860,7 +822,7 @@ static int acpi_lpss_runtime_suspend(struct device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_lpss_runtime_resume(struct device *dev)
|
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;
|
||||||
|
@ -881,7 +843,37 @@ static int acpi_lpss_runtime_resume(struct device *dev)
|
||||||
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
|
||||||
acpi_lpss_restore_ctx(dev, pdata);
|
acpi_lpss_restore_ctx(dev, pdata);
|
||||||
|
|
||||||
return pm_generic_runtime_resume(dev);
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
static int acpi_lpss_suspend_late(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret = pm_generic_suspend_late(dev);
|
||||||
|
|
||||||
|
return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int acpi_lpss_resume_early(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret = acpi_lpss_resume(dev);
|
||||||
|
|
||||||
|
return ret ? ret : pm_generic_resume_early(dev);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
|
static int acpi_lpss_runtime_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret = pm_generic_runtime_suspend(dev);
|
||||||
|
|
||||||
|
return ret ? ret : acpi_lpss_suspend(dev, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int acpi_lpss_runtime_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret = acpi_lpss_resume(dev);
|
||||||
|
|
||||||
|
return ret ? ret : pm_generic_runtime_resume(dev);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PM */
|
#endif /* CONFIG_PM */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue