clk: Add generic sync_state callback for disabling unused clocks
authorAbel Vesa <abel.vesa@linaro.org>
Tue, 27 Dec 2022 20:45:27 +0000 (22:45 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 10 Jan 2023 17:04:50 +0000 (11:04 -0600)
commit26b36df7516692292312063ca6fd19e73c06d4e7
treed98d4a2d946ff5d7bc95e5eec70ac7742592696d
parentce273e690d84b63ba73db2b63badeba4e74f3980
clk: Add generic sync_state callback for disabling unused clocks

There are unused clocks that need to remain untouched by clk_disable_unused,
and most likely could be disabled later on sync_state. So provide a generic
sync_state callback for the clock providers that register such clocks.
Then, use the same mechanism as clk_disable_unused from that generic
callback, but pass the device to make sure only the clocks belonging to
the current clock provider get disabled, if unused. Also, during the
default clk_disable_unused, if the driver that registered the clock has
the generic clk_sync_state_disable_unused callback set for sync_state,
skip disabling its clocks.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20221227204528.1899863-1-abel.vesa@linaro.org
drivers/clk/clk.c
include/linux/clk-provider.h