clk: qcom: regmap-mux: add pipe clk implementation
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Wed, 23 Mar 2022 08:50:06 +0000 (11:50 +0300)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 12 Apr 2022 18:32:53 +0000 (13:32 -0500)
commite9a4c7f667ed16a95da0e9d68cc88b381dcd99f9
tree42d564da110e5fa906f4ccd552799677e59ebb4f
parent3123109284176b1532874591f7c81f3837bbdc17
clk: qcom: regmap-mux: add pipe clk implementation

On recent Qualcomm platforms the QMP PIPE clocks feed into a set of
muxes which must be parked to the "safe" source (bi_tcxo) when
corresponding GDSC is turned off and on again. Currently this is
handcoded in the PCIe driver by reparenting the gcc_pipe_N_clk_src
clock. However the same code sequence should be applied in the
pcie-qcom endpoint, USB3 and UFS drivers.

Rather than copying this sequence over and over again, follow the
example of clk_rcg2_shared_ops and implement this parking in the
enable() and disable() clock operations. As we are changing the parent
behind the back of the clock framework, also implement custom
set_parent() and get_parent() operations behaving accroding to the clock
framework expectations (cache the new parent if the clock is in disabled
state, return cached parent).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220323085010.1753493-2-dmitry.baryshkov@linaro.org
drivers/clk/qcom/clk-regmap-mux.c
drivers/clk/qcom/clk-regmap-mux.h