diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2017-03-30 15:04:44 +0300 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-06-06 14:47:33 +0530 |
commit | 0661e7514d9c74d29af9559954d00915af1b6ff6 (patch) | |
tree | 63d56cbbc72901267ed3086adba98f150d0b18f0 | |
parent | e44b450780ca7f515767dce58c39e43fb050e0b7 (diff) | |
download | linaro-android-wip/hibernate-android-hikey-linaro-4.4.tar.gz |
HACK: i2c: designware: Do nothing in system suspend/resume when RT suspendedwip/hibernate-android-hikey-linaro-4.4
Original thread: https://www.spinics.net/lists/linux-i2c/msg29413.html
There is possibility to enter dw_i2c_plat_suspend() callback twice
during system suspend under certain cases which is causing here warnings
from clk_core_disable() and clk_core_unprepare() as well as accessing the
registers that can be power gated.
Commit 8503ff166504 ("i2c: designware: Avoid unnecessary resuming during
system suspend") implemented a prepare callback that checks for runtime
suspended device which allow PM core to set direct_complete flag and
skip system suspend and resume callbacks.
However it can still happen if nothing resumes the device prior system
syspend (e.g. acpi_subsys_suspend()) and there is a slave device which
unsets the direct_complete flag of the parent in __device_suspend() thus
causing PM code to not skip the system suspend/resume callbacks.
Avoid this by checking runtime status in suspend and resume callbacks
and return directly if device is runtime suspended. This affects only
system suspend/resume since during runtime suspend/resume runtime status
is suspending (not suspended) or resuming.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 798d81827c0f..44663e47c303 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -305,6 +305,9 @@ static int dw_i2c_plat_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); + if (pm_runtime_suspended(dev)) + return 0; + i2c_dw_disable(i_dev); clk_disable_unprepare(i_dev->clk); @@ -316,6 +319,9 @@ static int dw_i2c_plat_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); + if (pm_runtime_suspended(dev)) + return 0; + clk_prepare_enable(i_dev->clk); if (!i_dev->pm_runtime_disabled) |