diff options
Diffstat (limited to 'include/linux/clk-provider.h')
-rw-r--r-- | include/linux/clk-provider.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index f711be6e8c44..210a890008f9 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -399,6 +399,7 @@ struct clk_divider { | |||
399 | spinlock_t *lock; | 399 | spinlock_t *lock; |
400 | }; | 400 | }; |
401 | 401 | ||
402 | #define clk_div_mask(width) ((1 << (width)) - 1) | ||
402 | #define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw) | 403 | #define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw) |
403 | 404 | ||
404 | #define CLK_DIVIDER_ONE_BASED BIT(0) | 405 | #define CLK_DIVIDER_ONE_BASED BIT(0) |
@@ -419,6 +420,10 @@ long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent, | |||
419 | unsigned long rate, unsigned long *prate, | 420 | unsigned long rate, unsigned long *prate, |
420 | const struct clk_div_table *table, | 421 | const struct clk_div_table *table, |
421 | u8 width, unsigned long flags); | 422 | u8 width, unsigned long flags); |
423 | long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent, | ||
424 | unsigned long rate, unsigned long *prate, | ||
425 | const struct clk_div_table *table, u8 width, | ||
426 | unsigned long flags, unsigned int val); | ||
422 | int divider_get_val(unsigned long rate, unsigned long parent_rate, | 427 | int divider_get_val(unsigned long rate, unsigned long parent_rate, |
423 | const struct clk_div_table *table, u8 width, | 428 | const struct clk_div_table *table, u8 width, |
424 | unsigned long flags); | 429 | unsigned long flags); |
@@ -449,8 +454,9 @@ void clk_hw_unregister_divider(struct clk_hw *hw); | |||
449 | * | 454 | * |
450 | * @hw: handle between common and hardware-specific interfaces | 455 | * @hw: handle between common and hardware-specific interfaces |
451 | * @reg: register controlling multiplexer | 456 | * @reg: register controlling multiplexer |
457 | * @table: array of register values corresponding to the parent index | ||
452 | * @shift: shift to multiplexer bit field | 458 | * @shift: shift to multiplexer bit field |
453 | * @width: width of mutliplexer bit field | 459 | * @mask: mask of mutliplexer bit field |
454 | * @flags: hardware-specific flags | 460 | * @flags: hardware-specific flags |
455 | * @lock: register lock | 461 | * @lock: register lock |
456 | * | 462 | * |
@@ -510,6 +516,10 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name, | |||
510 | void __iomem *reg, u8 shift, u32 mask, | 516 | void __iomem *reg, u8 shift, u32 mask, |
511 | u8 clk_mux_flags, u32 *table, spinlock_t *lock); | 517 | u8 clk_mux_flags, u32 *table, spinlock_t *lock); |
512 | 518 | ||
519 | int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, | ||
520 | unsigned int val); | ||
521 | unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index); | ||
522 | |||
513 | void clk_unregister_mux(struct clk *clk); | 523 | void clk_unregister_mux(struct clk *clk); |
514 | void clk_hw_unregister_mux(struct clk_hw *hw); | 524 | void clk_hw_unregister_mux(struct clk_hw *hw); |
515 | 525 | ||
@@ -774,6 +784,17 @@ static inline long divider_round_rate(struct clk_hw *hw, unsigned long rate, | |||
774 | rate, prate, table, width, flags); | 784 | rate, prate, table, width, flags); |
775 | } | 785 | } |
776 | 786 | ||
787 | static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate, | ||
788 | unsigned long *prate, | ||
789 | const struct clk_div_table *table, | ||
790 | u8 width, unsigned long flags, | ||
791 | unsigned int val) | ||
792 | { | ||
793 | return divider_ro_round_rate_parent(hw, clk_hw_get_parent(hw), | ||
794 | rate, prate, table, width, flags, | ||
795 | val); | ||
796 | } | ||
797 | |||
777 | /* | 798 | /* |
778 | * FIXME clock api without lock protection | 799 | * FIXME clock api without lock protection |
779 | */ | 800 | */ |