Merge branch 'omap-serial' of git://git.linaro.org/people/rmk/linux-arm
[firefly-linux-kernel-4.4.55.git] / include / linux / clk-provider.h
index f9f5e9eeb9dd1f37f59cc95cf1da0cdbd91b7001..4989b8a7bed1703659c8f9a3fd7d955b5c6f6ffb 100644 (file)
@@ -53,9 +53,18 @@ struct clk_hw;
  * @disable:   Disable the clock atomically. Called with enable_lock held.
  *             This function must not sleep.
  *
- * @recalc_rate        Recalculate the rate of this clock, by quering hardware.  The
+ * @is_enabled:        Queries the hardware to determine if the clock is enabled.
+ *             This function must not sleep. Optional, if this op is not
+ *             set then the enable count will be used.
+ *
+ * @disable_unused: Disable the clock atomically.  Only called from
+ *             clk_disable_unused for gate clocks with special needs.
+ *             Called with enable_lock held.  This function must not
+ *             sleep.
+ *
+ * @recalc_rate        Recalculate the rate of this clock, by querying hardware. The
  *             parent rate is an input parameter.  It is up to the caller to
- *             insure that the prepare_mutex is held across this call.
+ *             ensure that the prepare_mutex is held across this call.
  *             Returns the calculated rate.  Optional, but recommended - if
  *             this op is not set then clock rate will be initialized to 0.
  *
@@ -89,7 +98,7 @@ struct clk_hw;
  * implementations to split any work between atomic (enable) and sleepable
  * (prepare) contexts.  If enabling a clock requires code that might sleep,
  * this must be done in clk_prepare.  Clock enable code that will never be
- * called in a sleepable context may be implement in clk_enable.
+ * called in a sleepable context may be implemented in clk_enable.
  *
  * Typically, drivers will call clk_prepare when a clock may be needed later
  * (eg. when a device is opened), and clk_enable when the clock is actually
@@ -102,6 +111,7 @@ struct clk_ops {
        int             (*enable)(struct clk_hw *hw);
        void            (*disable)(struct clk_hw *hw);
        int             (*is_enabled)(struct clk_hw *hw);
+       void            (*disable_unused)(struct clk_hw *hw);
        unsigned long   (*recalc_rate)(struct clk_hw *hw,
                                        unsigned long parent_rate);
        long            (*round_rate)(struct clk_hw *hw, unsigned long,
@@ -327,19 +337,21 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
  * error code; drivers must test for an error code after calling clk_register.
  */
 struct clk *clk_register(struct device *dev, struct clk_hw *hw);
+struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw);
 
 void clk_unregister(struct clk *clk);
+void devm_clk_unregister(struct device *dev, struct clk *clk);
 
 /* helper functions */
 const char *__clk_get_name(struct clk *clk);
 struct clk_hw *__clk_get_hw(struct clk *clk);
 u8 __clk_get_num_parents(struct clk *clk);
 struct clk *__clk_get_parent(struct clk *clk);
-int __clk_get_enable_count(struct clk *clk);
-int __clk_get_prepare_count(struct clk *clk);
+unsigned int __clk_get_enable_count(struct clk *clk);
+unsigned int __clk_get_prepare_count(struct clk *clk);
 unsigned long __clk_get_rate(struct clk *clk);
 unsigned long __clk_get_flags(struct clk *clk);
-int __clk_is_enabled(struct clk *clk);
+bool __clk_is_enabled(struct clk *clk);
 struct clk *__clk_lookup(const char *name);
 
 /*