From 8503ff166504272577e8f4c77d658395e744a2bb Mon Sep 17 00:00:00 2001 From: Jisheng Zhang Date: Wed, 20 May 2015 22:33:13 +0800 Subject: [PATCH] i2c: designware: Avoid unnecessary resuming during system suspend Commit 1fc2fe204cb9 ("i2c: designware: Add runtime PM hooks") adds runtime pm support using the same ops for system pm and runtime pm. When suspend to ram, the i2c host may have been runtime suspended, thus i2c_dw_disable() hangs. Previously, I fixed this issue by separating ops for system pm and runtime pm, then in the system suspend/resume path, runtime pm apis are used to ensure the device is at correct state. But as Mika Westerberg pointed out: it sounds a bit silly to resume the device just because you want to call i2c_dw_disable() for it before suspending again. He then suggested an elegant solution which keeps the device runtime suspended during system suspend with the help of 'dev->power.direct_complete'. This patch adopted this solution, and in fact Mika provided the main code. Signed-off-by: Jisheng Zhang Acked-by: Mika Westerberg Tested-by: Mika Westerberg Signed-off-by: Wolfram Sang --- Reading git-format-patch failed