]> git.dujemihanovic.xyz Git - linux.git/commitdiff
clk: qcom: clk-rcg2: add rcg2 mux ops
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 18 Aug 2022 22:06:20 +0000 (00:06 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 27 Sep 2022 02:40:10 +0000 (21:40 -0500)
An RCG may act as a mux that switch between 2 parents.
This is the case on IPQ6018 and IPQ8074 where the APCS core clk that feeds
the CPU cluster clock just switches between XO and the PLL that feeds it.

Add the required ops to add support for this special configuration and use
the generic mux function to determine the rate.

This way we dont have to keep a essentially dummy frequency table to use
RCG2 as a mux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20220818220628.339366-1-robimarko@gmail.com
drivers/clk/qcom/clk-rcg.h
drivers/clk/qcom/clk-rcg2.c

index 012e745794fde2ee97eaa50c0022b038b4e2b570..01581f4d2c39c4a8e27df94d11e1ef379c291c07 100644 (file)
@@ -167,6 +167,7 @@ struct clk_rcg2_gfx3d {
 
 extern const struct clk_ops clk_rcg2_ops;
 extern const struct clk_ops clk_rcg2_floor_ops;
+extern const struct clk_ops clk_rcg2_mux_closest_ops;
 extern const struct clk_ops clk_edp_pixel_ops;
 extern const struct clk_ops clk_byte_ops;
 extern const struct clk_ops clk_byte2_ops;
index 28019edd2a5082e6c1e2a0b420ef6c05b25a2b6b..609c10f8d0d9407cbd4d853b0818a806716ff282 100644 (file)
@@ -509,6 +509,13 @@ const struct clk_ops clk_rcg2_floor_ops = {
 };
 EXPORT_SYMBOL_GPL(clk_rcg2_floor_ops);
 
+const struct clk_ops clk_rcg2_mux_closest_ops = {
+       .determine_rate = __clk_mux_determine_rate_closest,
+       .get_parent = clk_rcg2_get_parent,
+       .set_parent = clk_rcg2_set_parent,
+};
+EXPORT_SYMBOL_GPL(clk_rcg2_mux_closest_ops);
+
 struct frac_entry {
        int num;
        int den;