Linux Kernel
3.7.1
|
#include <linux/clk-private.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/err.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/of.h>
Go to the source code of this file.
__clk_register - register a clock and return a cookie.
Same as clk_register, except that the .clk field inside hw shall point to a preallocated (generally statically allocated) struct clk. None of the fields of the struct clk need to be initialized.
The data pointed to by .init and .clk field shall NOT be marked as init data.
__clk_register is only exposed via clk-private.h and is intended for use with very large numbers of clocks that need to be statically initialized. It is a layering violation to include clk-private.h from any code which implements a clock's .ops; as such any statically initialized clock data MUST be in a separate C file from the logic that implements it's operations. Returns 0 on success, otherwise an error code.
clk_disable - gate a clock : the clk being gated
clk_disable must not sleep, which differentiates it from clk_unprepare. In a simple case, clk_disable can be used instead of clk_unprepare to gate a clk if the operation is fast and will never sleep. One example is a SoC-internal clk which is controlled via simple register writes. In the complex case a clk gate operation may require a fast and a slow part. It is this reason that clk_unprepare and clk_disable are not mutually exclusive. In fact clk_disable must be called before clk_unprepare.
clk_enable - ungate a clock : the clk being ungated
clk_enable must not sleep, which differentiates it from clk_prepare. In a simple case, clk_enable can be used instead of clk_prepare to ungate a clk if the operation will never sleep. One example is a SoC-internal clk which is controlled via simple register writes. In the complex case a clk ungate operation may require a fast and a slow part. It is this reason that clk_enable and clk_prepare are not mutually exclusive. In fact clk_prepare must be called before clk_enable. Returns 0 on success, -EERROR otherwise.
int clk_notifier_register | ( | struct clk * | clk, |
struct notifier_block * | nb | ||
) |
clk_notifier_register - add a clk rate change notifier : struct clk * to watch : struct notifier_block * with callback info
Request notification when clk's rate changes. This uses an SRCU notifier because we want it to block and notifier unregistrations are uncommon. The callbacks associated with the notifier must not re-enter into the clk framework by calling any top-level clk APIs; this will cause a nested prepare_lock mutex.
Pre-change notifier callbacks will be passed the current, pre-change rate of the clk via struct clk_notifier_data.old_rate. The new, post-change rate of the clk is passed via struct clk_notifier_data.new_rate.
Post-change notifiers will pass the now-current, post-change rate of the clk in both struct clk_notifier_data.old_rate and struct clk_notifier_data.new_rate.
Abort-change notifiers are effectively the opposite of pre-change notifiers: the original pre-change clk rate is passed in via struct clk_notifier_data.new_rate and the failed post-change rate is passed in via struct clk_notifier_data.old_rate.
clk_notifier_register() must be called from non-atomic context. Returns -EINVAL if called with null arguments, -ENOMEM upon allocation failure; otherwise, passes along the return value of srcu_notifier_chain_register().
int clk_notifier_unregister | ( | struct clk * | clk, |
struct notifier_block * | nb | ||
) |
clk_notifier_unregister - remove a clk rate change notifier : struct clk * : struct notifier_block * with callback info
Request no further notification for changes to 'clk' and frees memory allocated in clk_notifier_register.
Returns -EINVAL if called with null arguments; otherwise, passes along the return value of srcu_notifier_chain_unregister().
clk_prepare - prepare a clock source : the clk being prepared
clk_prepare may sleep, which differentiates it from clk_enable. In a simple case, clk_prepare can be used instead of clk_enable to ungate a clk if the operation may sleep. One example is a clk which is accessed over I2c. In the complex case a clk ungate operation may require a fast and a slow part. It is this reason that clk_prepare and clk_enable are not mutually exclusive. In fact clk_prepare must be called before clk_enable. Returns 0 on success, -EERROR otherwise.
clk_register - allocate a new clock, register it and return an opaque cookie : device that is registering this clock : link to hardware-specific clock data
clk_register is the primary interface for populating the clock tree with new clock nodes. It returns a pointer to the newly allocated struct clk which cannot be dereferenced by driver code but may be used in conjuction with the rest of the clock API. In the event of an error clk_register will return an error code; drivers must test for an error code after calling clk_register.
clk_round_rate - round the given rate for a clk : the clk for which we are rounding a rate : the rate which is to be rounded
Takes in a rate as input and rounds it to a rate that the clk can actually use which is then returned. If clk doesn't support round_rate operation then the parent rate is returned.
clk_set_parent - switch the parent of a mux clk : the mux clk whose input we are switching : the new input to clk
Re-parent clk to use parent as it's new input source. If clk has the CLK_SET_PARENT_GATE flag set then clk must be gated for this operation to succeed. After successfully changing clk's parent clk_set_parent will update the clk topology, sysfs topology and propagate rate recalculation via __clk_recalc_rates. Returns 0 on success, -EERROR otherwise.
clk_set_rate - specify a new rate for clk : the clk whose rate is being changed : the new rate for clk
In the simplest case clk_set_rate will only adjust the rate of clk.
Setting the CLK_SET_RATE_PARENT flag allows the rate change operation to propagate up to clk's parent; whether or not this happens depends on the outcome of clk's .round_rate implementation. If *parent_rate is unchanged after calling .round_rate then upstream parent propagation is ignored. If *parent_rate comes back with a new rate for clk's parent then we propagate up to clk's parent and set it's rate. Upward propagation will continue until either a clk does not support the CLK_SET_RATE_PARENT flag or .round_rate stops requesting changes to clk's parent_rate.
Rate changes are accomplished via tree traversal that also recalculates the rates for the clocks and fires off POST_RATE_CHANGE notifiers.
Returns 0 on success, -EERROR otherwise.
clk_unprepare - undo preparation of a clock source : the clk being unprepare
clk_unprepare may sleep, which differentiates it from clk_disable. In a simple case, clk_unprepare can be used instead of clk_disable to gate a clk if the operation may sleep. One example is a clk which is accessed over I2c. In the complex case a clk gate operation may require a fast and a slow part. It is this reason that clk_unprepare and clk_disable are not mutually exclusive. In fact clk_disable must be called before clk_unprepare.
EXPORT_SYMBOL_GPL | ( | clk_unprepare | ) |
EXPORT_SYMBOL_GPL | ( | clk_prepare | ) |
EXPORT_SYMBOL_GPL | ( | clk_disable | ) |
EXPORT_SYMBOL_GPL | ( | clk_enable | ) |
EXPORT_SYMBOL_GPL | ( | clk_round_rate | ) |
EXPORT_SYMBOL_GPL | ( | clk_get_rate | ) |
EXPORT_SYMBOL_GPL | ( | clk_set_rate | ) |
EXPORT_SYMBOL_GPL | ( | clk_get_parent | ) |
EXPORT_SYMBOL_GPL | ( | clk_set_parent | ) |
EXPORT_SYMBOL_GPL | ( | __clk_register | ) |
EXPORT_SYMBOL_GPL | ( | clk_register | ) |
EXPORT_SYMBOL_GPL | ( | clk_unregister | ) |
EXPORT_SYMBOL_GPL | ( | clk_notifier_register | ) |
EXPORT_SYMBOL_GPL | ( | clk_notifier_unregister | ) |
late_initcall | ( | clk_disable_unused | ) |