clk: composite: add _register_composite_pdata() variants
authorMichael Walle <michael@walle.cc>
Thu, 2 Jan 2020 23:10:59 +0000 (00:10 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 28 Jan 2020 21:26:48 +0000 (13:26 -0800)
Add support for the new way of specifying the clock parents. Add the
two new functions
    clk_hw_register_composite_pdata()
    clk_register_composite_pdata()
to let the driver provide parent_data instead of the parent_names.

Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lkml.kernel.org/r/20200102231101.11834-1-michael@walle.cc
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk-composite.c
include/linux/clk-provider.h

index 3e9c3e608769041fac3995856265e8d650fba42f..7376f573bfdb5dfab0b2905ce1a47d43666abf74 100644 (file)
@@ -199,8 +199,9 @@ static void clk_composite_disable(struct clk_hw *hw)
        gate_ops->disable(gate_hw);
 }
 
-struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
-                       const char * const *parent_names, int num_parents,
+static struct clk_hw *__clk_hw_register_composite(struct device *dev,
+                       const char *name, const char * const *parent_names,
+                       const struct clk_parent_data *pdata, int num_parents,
                        struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
                        struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
                        struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
@@ -218,7 +219,10 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
 
        init.name = name;
        init.flags = flags;
-       init.parent_names = parent_names;
+       if (parent_names)
+               init.parent_names = parent_names;
+       else
+               init.parent_data = pdata;
        init.num_parents = num_parents;
        hw = &composite->hw;
 
@@ -312,6 +316,34 @@ err:
        return hw;
 }
 
+struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
+                       const char * const *parent_names, int num_parents,
+                       struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
+                       struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
+                       struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
+                       unsigned long flags)
+{
+       return __clk_hw_register_composite(dev, name, parent_names, NULL,
+                                          num_parents, mux_hw, mux_ops,
+                                          rate_hw, rate_ops, gate_hw,
+                                          gate_ops, flags);
+}
+
+struct clk_hw *clk_hw_register_composite_pdata(struct device *dev,
+                       const char *name,
+                       const struct clk_parent_data *parent_data,
+                       int num_parents,
+                       struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
+                       struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
+                       struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
+                       unsigned long flags)
+{
+       return __clk_hw_register_composite(dev, name, NULL, parent_data,
+                                          num_parents, mux_hw, mux_ops,
+                                          rate_hw, rate_ops, gate_hw,
+                                          gate_ops, flags);
+}
+
 struct clk *clk_register_composite(struct device *dev, const char *name,
                        const char * const *parent_names, int num_parents,
                        struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
@@ -329,6 +361,24 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
        return hw->clk;
 }
 
+struct clk *clk_register_composite_pdata(struct device *dev, const char *name,
+                       const struct clk_parent_data *parent_data,
+                       int num_parents,
+                       struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
+                       struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
+                       struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
+                       unsigned long flags)
+{
+       struct clk_hw *hw;
+
+       hw = clk_hw_register_composite_pdata(dev, name, parent_data,
+                       num_parents, mux_hw, mux_ops, rate_hw, rate_ops,
+                       gate_hw, gate_ops, flags);
+       if (IS_ERR(hw))
+               return ERR_CAST(hw);
+       return hw->clk;
+}
+
 void clk_unregister_composite(struct clk *clk)
 {
        struct clk_composite *composite;
index caf4b9df16ebe09ee91eee9fac753422025241b2..e2e9d867df363ffcb78f4acf246484e68b12a9aa 100644 (file)
@@ -743,6 +743,12 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
                struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
                struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
                unsigned long flags);
+struct clk *clk_register_composite_pdata(struct device *dev, const char *name,
+               const struct clk_parent_data *parent_data, int num_parents,
+               struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
+               struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
+               struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
+               unsigned long flags);
 void clk_unregister_composite(struct clk *clk);
 struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
                const char * const *parent_names, int num_parents,
@@ -750,6 +756,13 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
                struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
                struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
                unsigned long flags);
+struct clk_hw *clk_hw_register_composite_pdata(struct device *dev,
+               const char *name,
+               const struct clk_parent_data *parent_data, int num_parents,
+               struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
+               struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
+               struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
+               unsigned long flags);
 void clk_hw_unregister_composite(struct clk_hw *hw);
 
 /**