i2c: mv64xxx: Add runtime PM support
authorSamuel Holland <samuel@sholland.org>
Sun, 3 Jan 2021 10:51:46 +0000 (04:51 -0600)
committerWolfram Sang <wsa@kernel.org>
Mon, 1 Feb 2021 22:05:29 +0000 (23:05 +0100)
commite5c02cf541541605f704fbbb9a764e23f88ad0cb
tree671d17aecbc269e7587380061d56e24e1e83cd9c
parent622fa41b496d5d15247727cbfc5d000f36755bbc
i2c: mv64xxx: Add runtime PM support

To save power, gate the clock when the bus is inactive, during system
sleep, and during shutdown. On some platforms, specifically Allwinner
A13/A20, gating the clock implicitly resets the module as well. Since
the module already needs to be reset after some suspend/resume cycles,
it is simple enough to reset it during every runtime suspend/resume.

Because the bus may be used by wakeup source IRQ threads, it needs to
be functional as soon as IRQs are enabled. Thus, its system PM hooks
need to run in the noirq phase.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Tested-by: Ondrej Jirman <megous@megous.com>
Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-mv64xxx.c