diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-03-13 23:25:09 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-03-22 09:53:24 +0100 |
commit | 41c80b8a63bccf9de96698b4eb0916e223fb6e72 (patch) | |
tree | e305de406850c7bb7fccc3286cb773b3df355e4f /drivers/i2c/busses/i2c-designware-platdrv.c | |
parent | 78c43af2c1d79653e2e6fb9a05c8f3def7c87940 (diff) | |
download | lwn-41c80b8a63bccf9de96698b4eb0916e223fb6e72.tar.gz lwn-41c80b8a63bccf9de96698b4eb0916e223fb6e72.zip |
i2c: designware: Never suspend i2c-busses used for accessing the system PMIC
Currently we are already setting a pm_runtime_disabled flag and disabling
runtime-pm for i2c-busses used for accessing the system PMIC on x86.
But this is not enough, there are ACPI opregions which may want to access
the PMIC during late-suspend and early-resume, so we need to completely
disable pm to be safe.
This commit renames the flag from pm_runtime_disabled to pm_disabled and
adds the following new behavior if the flag is set:
1) Call dev_pm_syscore_device(dev, true) which disables normal suspend /
resume and remove the pm_runtime_disabled check from dw_i2c_plat_resume
since that will now never get called. This fixes suspend_late handlers
which use ACPI PMIC opregions causing errors like these:
PM: Suspending system (freeze)
PM: suspend of devices complete after 1127.751 msecs
i2c_designware 808622C1:06: timeout waiting for bus ready
ACPI Exception: AE_ERROR, Returned by Handler for [UserDefinedRegion]
acpi 80860F14:02: Failed to change power state to D3hot
PM: late suspend of devices failed
2) Set IRQF_NO_SUSPEND irq flag. This fixes resume_early handlers which
handlers which use ACPI PMIC opregions causing errors like these:
PM: resume from suspend-to-idle
i2c_designware 808622C1:06: controller timed out
ACPI Exception: AE_ERROR, Returned by Handler for [UserDefinedRegion]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-designware-platdrv.c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index d8665098dce9..0b6f6dc671a8 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -286,7 +286,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); adap->dev.of_node = pdev->dev.of_node; - if (dev->pm_runtime_disabled) { + if (dev->pm_disabled) { pm_runtime_forbid(&pdev->dev); } else { pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); @@ -302,7 +302,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) return r; exit_probe: - if (!dev->pm_runtime_disabled) + if (!dev->pm_disabled) pm_runtime_disable(&pdev->dev); exit_reset: if (!IS_ERR_OR_NULL(dev->rst)) @@ -322,7 +322,7 @@ static int dw_i2c_plat_remove(struct platform_device *pdev) pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); - if (!dev->pm_runtime_disabled) + if (!dev->pm_disabled) pm_runtime_disable(&pdev->dev); if (!IS_ERR_OR_NULL(dev->rst)) reset_control_assert(dev->rst); @@ -374,9 +374,7 @@ static int dw_i2c_plat_resume(struct device *dev) struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); i2c_dw_plat_prepare_clk(i_dev, true); - - if (!i_dev->pm_runtime_disabled) - i2c_dw_init(i_dev); + i2c_dw_init(i_dev); return 0; } |