]> git.itanic.dy.fi Git - linux-stable/commit
clk: Add support for runtime PM
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 21 Aug 2017 08:04:59 +0000 (10:04 +0200)
committerMichael Turquette <mturquette@baylibre.com>
Thu, 7 Sep 2017 22:25:13 +0000 (15:25 -0700)
commit9a34b45397e5a389e25a0c5d39983300d040e5e2
tree519d5207054d7c79c24596e2ea1509e4219ec36b
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877
clk: Add support for runtime PM

Registers for some clocks might be located in the SOC area, which are under the
power domain. To enable access to those registers respective domain has to be
turned on. Additionally, registers for such clocks will usually loose its
contents when power domain is turned off, so additional saving and restoring of
them might be needed in the clock controller driver.

This patch adds basic infrastructure in the clocks core to allow implementing
driver for such clocks under power domains. Clock provider can supply a
struct device pointer, which is the used by clock core for tracking and managing
clock's controller runtime pm state. Each clk_prepare() operation
will first call pm_runtime_get_sync() on the supplied device, while
clk_unprepare() will do pm_runtime_put_sync() at the end.

Additional calls to pm_runtime_get/put functions are required to ensure that any
register access (like calculating/changing clock rates and unpreparing/disabling
unused clocks on boot) will be done with clock controller in runtime resumend
state.

When one wants to register clock controller, which make use of this feature, he
has to:
1. Provide a struct device to the core when registering the provider.
2. Ensure to enable runtime PM for that device before registering clocks.
3. Make sure that the runtime PM status of the controller device reflects
   the HW state.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-2-git-send-email-m.szyprowski@samsung.com
drivers/clk/clk.c