OSDN Git Service

clk: mvebu: add suspend/resume for gatable clocks
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 21 Nov 2014 16:00:05 +0000 (17:00 +0100)
committerJason Cooper <jason@lakedaemon.net>
Sun, 30 Nov 2014 16:40:12 +0000 (16:40 +0000)
commitf571053152f660769f9f39f150ac984bc4c6ac85
treeeb85fc93b3d6fe931c35683524f42a5b07dc46ce
parent4749c02b8da6d8dbc29218652985bda844017e95
clk: mvebu: add suspend/resume for gatable clocks

This commit adds suspend/resume support for the gatable clock driver
used on Marvell EBU platforms. When getting out of suspend, the
Marvell EBU platforms go through the bootloader, which re-enables all
gatable clocks. However, upon resume, the clock framework will not
disable again all gatable clocks that are not used.

Therefore, if the clock driver does not save/restore the state of the
gatable clocks, all gatable clocks that are not claimed by any device
driver will remain enabled after a resume. This is why this driver
saves and restores the state of those clocks.

Since clocks aren't real devices, we don't have the normal ->suspend()
and ->resume() of the device model, and have to use the ->suspend()
and ->resume() hooks of the syscore_ops mechanism. This mechanism has
the unfortunate idea of not providing a way of passing private data,
which requires us to change the driver to make the assumption that
there is only once instance of the gatable clock control structure.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-kernel@vger.kernel.org
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1416585613-2113-9-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
drivers/clk/mvebu/common.c