include/linux/clk.h
Source file repositories/reference/linux-study-clean/include/linux/clk.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/clk.h- Extension
.h- Size
- 38104 bytes
- Lines
- 1259
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/kernel.hlinux/notifier.h
Detected Declarations
struct devicestruct clkstruct device_nodestruct of_phandle_argsstruct clk_notifierstruct clk_notifier_datastruct clk_bulk_datafunction clk_notifier_registerfunction clk_notifier_unregisterfunction devm_clk_notifier_registerfunction clk_get_accuracyfunction clk_set_phasefunction clk_get_phasefunction clk_set_duty_cyclefunction clk_get_scaled_duty_cyclefunction clk_is_matchfunction clk_rate_exclusive_getfunction devm_clk_rate_exclusive_getfunction clk_rate_exclusive_putfunction clk_restore_contextfunction clk_preparefunction clk_unpreparefunction clk_bulk_preparefunction clk_bulk_unpreparefunction clk_is_enabled_when_preparedfunction clk_bulk_getfunction clk_bulk_get_optionalfunction clk_bulk_get_allfunction devm_clk_get_optional_enabled_with_ratefunction devm_clk_bulk_getfunction devm_clk_bulk_get_optionalfunction devm_clk_bulk_get_optional_enablefunction devm_clk_bulk_get_allfunction devm_clk_bulk_get_all_enabledfunction clk_putfunction clk_bulk_enablefunction clk_disablefunction clk_set_ratefunction clk_set_rate_exclusivefunction clk_round_ratefunction clk_has_parentfunction clk_set_rate_rangefunction clk_set_min_ratefunction clk_set_max_ratefunction clk_set_parentfunction clk_prepare_enablefunction clk_disable_unpreparefunction clk_bulk_prepare_enable
Annotated Snippet
struct clk_notifier {
struct clk *clk;
struct srcu_notifier_head notifier_head;
struct list_head node;
};
/**
* struct clk_notifier_data - rate data to pass to the notifier callback
* @clk: struct clk * being changed
* @old_rate: previous rate of this clk
* @new_rate: new rate of this clk
*
* For a pre-notifier, old_rate is the clk's rate before this rate
* change, and new_rate is what the rate will be in the future. For a
* post-notifier, old_rate and new_rate are both set to the clk's
* current rate (this was done to optimize the implementation).
*/
struct clk_notifier_data {
struct clk *clk;
unsigned long old_rate;
unsigned long new_rate;
};
/**
* struct clk_bulk_data - Data used for bulk clk operations.
*
* @id: clock consumer ID
* @clk: struct clk * to store the associated clock
*
* The CLK APIs provide a series of clk_bulk_() API calls as
* a convenience to consumers which require multiple clks. This
* structure is used to manage data for these calls.
*/
struct clk_bulk_data {
const char *id;
struct clk *clk;
};
#ifdef CONFIG_COMMON_CLK
/**
* clk_notifier_register - register a clock rate-change notifier callback
* @clk: clock whose rate we are interested in
* @nb: notifier block with callback function pointer
*
* ProTip: debugging across notifier chains can be frustrating. Make sure that
* your notifier callback function prints a nice big warning in case of
* failure.
*/
int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
/**
* clk_notifier_unregister - unregister a clock rate-change notifier callback
* @clk: clock whose rate we are no longer interested in
* @nb: notifier block which will be unregistered
*/
int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
/**
* devm_clk_notifier_register - register a managed rate-change notifier callback
* @dev: device for clock "consumer"
* @clk: clock whose rate we are interested in
* @nb: notifier block with callback function pointer
*
* Returns 0 on success, -EERROR otherwise
*/
int devm_clk_notifier_register(struct device *dev, struct clk *clk,
struct notifier_block *nb);
/**
* clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion)
* for a clock source.
* @clk: clock source
*
* This gets the clock source accuracy expressed in ppb.
* A perfect clock returns 0.
*/
long clk_get_accuracy(struct clk *clk);
/**
* clk_set_phase - adjust the phase shift of a clock signal
* @clk: clock signal source
* @degrees: number of degrees the signal is shifted
*
* Shifts the phase of a clock signal by the specified degrees. Returns 0 on
* success, -EERROR otherwise.
*/
int clk_set_phase(struct clk *clk, int degrees);
/**
Annotation
- Immediate include surface: `linux/err.h`, `linux/kernel.h`, `linux/notifier.h`.
- Detected declarations: `struct device`, `struct clk`, `struct device_node`, `struct of_phandle_args`, `struct clk_notifier`, `struct clk_notifier_data`, `struct clk_bulk_data`, `function clk_notifier_register`, `function clk_notifier_unregister`, `function devm_clk_notifier_register`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.