]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/clk-provider.h
Merge remote-tracking branch 'file-locks/linux-next'
[karo-tx-linux.git] / include / linux / clk-provider.h
index 3ecc07d0da7767555bbe21959c5540375a9a3859..6a7dfe33a317f44f459436ed55640383986f3cce 100644 (file)
@@ -518,6 +518,48 @@ struct clk *clk_register_fractional_divider(struct device *dev,
                void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth,
                u8 clk_divider_flags, spinlock_t *lock);
 
+/**
+ * struct clk_multiplier - adjustable multiplier clock
+ *
+ * @hw:                handle between common and hardware-specific interfaces
+ * @reg:       register containing the multiplier
+ * @shift:     shift to the multiplier bit field
+ * @width:     width of the multiplier bit field
+ * @lock:      register lock
+ *
+ * Clock with an adjustable multiplier affecting its output frequency.
+ * Implements .recalc_rate, .set_rate and .round_rate
+ *
+ * Flags:
+ * CLK_MULTIPLIER_ZERO_BYPASS - By default, the multiplier is the value read
+ *     from the register, with 0 being a valid value effectively
+ *     zeroing the output clock rate. If CLK_MULTIPLIER_ZERO_BYPASS is
+ *     set, then a null multiplier will be considered as a bypass,
+ *     leaving the parent rate unmodified.
+ * CLK_MULTIPLIER_ROUND_CLOSEST - Makes the best calculated divider to be
+ *     rounded to the closest integer instead of the down one.
+ */
+struct clk_multiplier {
+       struct clk_hw   hw;
+       void __iomem    *reg;
+       u8              shift;
+       u8              width;
+       u8              flags;
+       spinlock_t      *lock;
+};
+
+#define CLK_MULTIPLIER_ZERO_BYPASS             BIT(0)
+#define CLK_MULTIPLIER_ROUND_CLOSEST   BIT(1)
+
+extern const struct clk_ops clk_multiplier_ops;
+
+struct clk *clk_register_multiplier(struct device *dev, const char *name,
+                                   const char *parent_name,
+                                   unsigned long flags,
+                                   void __iomem *reg, u8 shift, u8 width,
+                                   u8 clk_mult_flags, spinlock_t *lock);
+void clk_unregister_multiplier(struct clk *clk);
+
 /***
  * struct clk_composite - aggregate clock of mux, divider and gate clocks
  *