Lines Matching full:clk
3 * linux/include/linux/clk.h
17 struct clk;
22 * DOC: clk notifier callback types
24 * PRE_RATE_CHANGE - called immediately before the clk rate is changed,
32 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must
35 * POST_RATE_CHANGE - called after the clk rate change has successfully
44 * struct clk_notifier - associate a clk with a notifier
45 * @clk: struct clk * to associate the notifier with
46 * @notifier_head: a blocking_notifier_head for this clk
51 * particular @clk. Future notifiers on that @clk are added to the
55 struct clk *clk; member
62 * @clk: struct clk * being changed
63 * @old_rate: previous rate of this clk
64 * @new_rate: new rate of this clk
66 * For a pre-notifier, old_rate is the clk's rate before this rate
68 * post-notifier, old_rate and new_rate are both set to the clk's
72 struct clk *clk; member
78 * struct clk_bulk_data - Data used for bulk clk operations.
81 * @clk: struct clk * to store the associated clock
83 * The CLK APIs provide a series of clk_bulk_() API calls as
89 struct clk *clk; member
96 * @clk: clock whose rate we are interested in
103 int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
107 * @clk: clock whose rate we are no longer interested in
110 int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
115 * @clk: clock whose rate we are interested in
120 int devm_clk_notifier_register(struct device *dev, struct clk *clk,
126 * @clk: clock source
131 long clk_get_accuracy(struct clk *clk);
135 * @clk: clock signal source
141 int clk_set_phase(struct clk *clk, int degrees);
145 * @clk: clock signal source
150 int clk_get_phase(struct clk *clk);
154 * @clk: clock signal source
161 int clk_set_duty_cycle(struct clk *clk, unsigned int num, unsigned int den);
165 * @clk: clock signal source
171 int clk_get_scaled_duty_cycle(struct clk *clk, unsigned int scale);
174 * clk_is_match - check if two clk's point to the same hardware clock
175 * @p: clk compared against q
176 * @q: clk compared against p
178 * Returns true if the two struct clk pointers both point to the same hardware
184 bool clk_is_match(const struct clk *p, const struct clk *q);
188 static inline int clk_notifier_register(struct clk *clk, in clk_notifier_register() argument
194 static inline int clk_notifier_unregister(struct clk *clk, in clk_notifier_unregister() argument
201 struct clk *clk, in devm_clk_notifier_register() argument
207 static inline long clk_get_accuracy(struct clk *clk) in clk_get_accuracy() argument
212 static inline long clk_set_phase(struct clk *clk, int phase) in clk_set_phase() argument
217 static inline long clk_get_phase(struct clk *clk) in clk_get_phase() argument
222 static inline int clk_set_duty_cycle(struct clk *clk, unsigned int num, in clk_set_duty_cycle() argument
228 static inline unsigned int clk_get_scaled_duty_cycle(struct clk *clk, in clk_get_scaled_duty_cycle() argument
234 static inline bool clk_is_match(const struct clk *p, const struct clk *q) in clk_is_match()
244 * @clk: clock source
250 int clk_prepare(struct clk *clk);
256 * @clk: clock source
269 bool clk_is_enabled_when_prepared(struct clk *clk);
271 static inline int clk_prepare(struct clk *clk) in clk_prepare() argument
284 static inline bool clk_is_enabled_when_prepared(struct clk *clk) in clk_is_enabled_when_prepared() argument
292 * @clk: clock source
300 void clk_unprepare(struct clk *clk);
303 static inline void clk_unprepare(struct clk *clk) in clk_unprepare() argument
320 * Returns a struct clk corresponding to the clock producer, or
330 struct clk *clk_get(struct device *dev, const char *id);
338 * This helper function allows drivers to get several clk consumers in one
339 * operation. If any of the clk cannot be acquired then any clks
346 * The clock returned is stored in each @clk_bulk_data.clk field.
360 * This helper function allows drivers to get all clk consumers in one
361 * operation. If any of the clk cannot be acquired then any clks
383 * NULL for a clk for which a clock producer could not be determined.
388 * devm_clk_bulk_get - managed get multiple clk consumers
395 * This helper function allows drivers to get several clk
409 * NULL for given clk. It is assumed all clocks in clk_bulk_data are optional.
412 * successfully or for any clk there was no clk provider available, otherwise
416 * The clock returned is stored in each @clk_bulk_data.clk field.
425 * devm_clk_bulk_get_all - managed get multiple clk consumers
433 * This helper function allows drivers to get several clk
448 * Return: a struct clk corresponding to the clock producer, or
460 struct clk *devm_clk_get(struct device *dev, const char *id);
469 * Return: a struct clk corresponding to the clock producer, or
475 * The returned clk (if valid) is prepared. Drivers must however assume
481 struct clk *devm_clk_get_prepared(struct device *dev, const char *id);
490 * Return: a struct clk corresponding to the clock producer, or
496 * The returned clk (if valid) is prepared and enabled.
501 struct clk *devm_clk_get_enabled(struct device *dev, const char *id);
511 * Return: a struct clk corresponding to the clock producer, or
514 * the clock producer. If no such clk is found, it returns NULL
515 * which serves as a dummy clk. That's the only difference compared
524 struct clk *devm_clk_get_optional(struct device *dev, const char *id);
533 * Return: a struct clk corresponding to the clock producer, or
536 * the clock producer. If no such clk is found, it returns NULL
537 * which serves as a dummy clk. That's the only difference compared
540 * The returned clk (if valid) is prepared. Drivers must however
546 struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id);
556 * Return: a struct clk corresponding to the clock producer, or
559 * the clock producer. If no such clk is found, it returns NULL
560 * which serves as a dummy clk. That's the only difference compared
563 * The returned clk (if valid) is prepared and enabled.
568 struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id);
578 * struct clk from the registered list of clock providers by using
584 struct clk *devm_get_clk_from_child(struct device *dev,
589 * @clk: clock source
602 int clk_rate_exclusive_get(struct clk *clk);
607 * @clk: clock source
617 void clk_rate_exclusive_put(struct clk *clk);
621 * @clk: clock source
629 int clk_enable(struct clk *clk);
645 * @clk: clock source
657 void clk_disable(struct clk *clk);
680 * @clk: clock source
682 unsigned long clk_get_rate(struct clk *clk);
686 * @clk: clock source
694 void clk_put(struct clk *clk);
725 * @clk: clock source acquired with devm_clk_get()
733 void devm_clk_put(struct device *dev, struct clk *clk);
742 * @clk: clock source
749 * rate = clk_round_rate(clk, r);
753 * clk_set_rate(clk, r);
754 * rate = clk_get_rate(clk);
761 long clk_round_rate(struct clk *clk, unsigned long rate);
765 * @clk: clock source
773 int clk_set_rate(struct clk *clk, unsigned long rate);
778 * @clk: clock source
790 int clk_set_rate_exclusive(struct clk *clk, unsigned long rate);
794 * @clk: clock source
800 * Returns true if @parent is a possible parent for @clk, false otherwise.
802 bool clk_has_parent(const struct clk *clk, const struct clk *parent);
806 * @clk: clock source
812 int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max);
816 * @clk: clock source
821 int clk_set_min_rate(struct clk *clk, unsigned long rate);
825 * @clk: clock source
830 int clk_set_max_rate(struct clk *clk, unsigned long rate);
834 * @clk: clock source
839 int clk_set_parent(struct clk *clk, struct clk *parent);
843 * @clk: clock source
845 * Returns struct clk corresponding to parent clock source, or
848 struct clk *clk_get_parent(struct clk *clk);
855 * Returns a struct clk corresponding to the clock producer, or
865 struct clk *clk_get_sys(const char *dev_id, const char *con_id);
886 static inline struct clk *clk_get(struct device *dev, const char *id) in clk_get()
909 static inline struct clk *devm_clk_get(struct device *dev, const char *id) in devm_clk_get()
914 static inline struct clk *devm_clk_get_prepared(struct device *dev, in devm_clk_get_prepared()
920 static inline struct clk *devm_clk_get_enabled(struct device *dev, in devm_clk_get_enabled()
926 static inline struct clk *devm_clk_get_optional(struct device *dev, in devm_clk_get_optional()
932 static inline struct clk *devm_clk_get_optional_prepared(struct device *dev, in devm_clk_get_optional_prepared()
938 static inline struct clk *devm_clk_get_optional_enabled(struct device *dev, in devm_clk_get_optional_enabled()
963 static inline struct clk *devm_get_clk_from_child(struct device *dev, in devm_get_clk_from_child()
969 static inline void clk_put(struct clk *clk) {} in clk_put() argument
975 static inline void devm_clk_put(struct device *dev, struct clk *clk) {} in devm_clk_put() argument
978 static inline int clk_rate_exclusive_get(struct clk *clk) in clk_rate_exclusive_get() argument
983 static inline void clk_rate_exclusive_put(struct clk *clk) {} in clk_rate_exclusive_put() argument
985 static inline int clk_enable(struct clk *clk) in clk_enable() argument
996 static inline void clk_disable(struct clk *clk) {} in clk_disable() argument
1002 static inline unsigned long clk_get_rate(struct clk *clk) in clk_get_rate() argument
1007 static inline int clk_set_rate(struct clk *clk, unsigned long rate) in clk_set_rate() argument
1012 static inline int clk_set_rate_exclusive(struct clk *clk, unsigned long rate) in clk_set_rate_exclusive() argument
1017 static inline long clk_round_rate(struct clk *clk, unsigned long rate) in clk_round_rate() argument
1022 static inline bool clk_has_parent(struct clk *clk, struct clk *parent) in clk_has_parent() argument
1027 static inline int clk_set_rate_range(struct clk *clk, unsigned long min, in clk_set_rate_range() argument
1033 static inline int clk_set_min_rate(struct clk *clk, unsigned long rate) in clk_set_min_rate() argument
1038 static inline int clk_set_max_rate(struct clk *clk, unsigned long rate) in clk_set_max_rate() argument
1043 static inline int clk_set_parent(struct clk *clk, struct clk *parent) in clk_set_parent() argument
1048 static inline struct clk *clk_get_parent(struct clk *clk) in clk_get_parent() argument
1053 static inline struct clk *clk_get_sys(const char *dev_id, const char *con_id) in clk_get_sys()
1068 static inline int clk_prepare_enable(struct clk *clk) in clk_prepare_enable() argument
1072 ret = clk_prepare(clk); in clk_prepare_enable()
1075 ret = clk_enable(clk); in clk_prepare_enable()
1077 clk_unprepare(clk); in clk_prepare_enable()
1083 static inline void clk_disable_unprepare(struct clk *clk) in clk_disable_unprepare() argument
1085 clk_disable(clk); in clk_disable_unprepare()
1086 clk_unprepare(clk); in clk_disable_unprepare()
1113 * @clk: clock source
1117 static inline int clk_drop_range(struct clk *clk) in clk_drop_range() argument
1119 return clk_set_rate_range(clk, 0, ULONG_MAX); in clk_drop_range()
1131 static inline struct clk *clk_get_optional(struct device *dev, const char *id) in clk_get_optional()
1133 struct clk *clk = clk_get(dev, id); in clk_get_optional() local
1135 if (clk == ERR_PTR(-ENOENT)) in clk_get_optional()
1138 return clk; in clk_get_optional()
1142 struct clk *of_clk_get(struct device_node *np, int index);
1143 struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
1144 struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
1146 static inline struct clk *of_clk_get(struct device_node *np, int index) in of_clk_get()
1150 static inline struct clk *of_clk_get_by_name(struct device_node *np, in of_clk_get_by_name()
1155 static inline struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) in of_clk_get_from_provider()