i2c: designware: Avoid unnecessary resuming during system suspend
authorJisheng Zhang <jszhang@marvell.com>
Wed, 20 May 2015 14:33:13 +0000 (22:33 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 2 Jun 2015 17:54:19 +0000 (02:54 +0900)
commit8503ff166504272577e8f4c77d658395e744a2bb
treeea82c50eec7ff5cbf96af689dfa9f13589390485
parent7e2dc811b4ae70ecfa3c164e3e400a78a3244338
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 <jszhang@marvell.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-platdrv.c