STRUCT CLK_CORE(9)
π NAME
struct clk_core β okay so real talk, this is the internal state of a clk in the clk tree, and it is lowkey the main character of the whole clock framework π°οΈβ¨ (also hiii, you're reading the struct clk_core(9) page from the Kernel API Manual, welcome bestie π«Ά)
π SYNOPSIS
struct clk_core {
const char *name;
const struct clk_ops *ops;
struct clk_hw *hw;
struct module *owner;
struct device *dev;
struct hlist_node rpm_node;
struct device_node *of_node;
struct clk_core *parent;
struct clk_parent_map *parents;
u8 num_parents;
u8 new_parent_index;
unsigned long rate;
unsigned long req_rate;
unsigned long new_rate;
struct clk_core *new_parent;
struct clk_core *new_child;
unsigned long flags;
bool orphan;
bool rpm_enabled;
unsigned int enable_count;
unsigned int prepare_count;
unsigned int protect_count;
unsigned long min_rate;
unsigned long max_rate;
unsigned long accuracy;
int phase;
struct clk_duty duty;
struct hlist_head children;
struct hlist_node child_node;
struct hlist_node hashtable_node;
struct hlist_head clks;
unsigned int notifier_count;
#ifdef CONFIG_DEBUG_FS;
struct dentry *dentry;
struct hlist_node debug_node;
#endif;
struct kref ref;
};
π¦ Members
nameβ the unique name of the clk, for identification. it's how the framework knows which clock you're talking about, no cap πopsβ pointer to the hardware-specific operations for this clk. the actual "how do I do the thing" instructions π§hwβ pointer used for traversing from astruct clkto its corresponding hardware-specific structure. your little bridge between worlds πownerβ the kernel module that owns this clk (for reference counting). keeping the module alive so it doesn't ghost you πdevβ the device associated with this clk (optional)rpm_nodeβ node for runtime power management list management β‘of_nodeβ the device tree node associated with this clk (if applicable) π³parentβ pointer to the current parent in the clock tree. family tree moment πparentsβ array of possible parents (for muxes/selectable parents). the whole roster, not just the current fave β¨num_parentsβ number of possible parents.new_parent_indexβ index of the new parent during parent change operations. mid-switch era πrateβ current cached clock rate (Hz). the vibe, numerically π΅req_rateβ the last rate requested by a call toclk_set_rate. It's initialized toclk_core->rate. It's also updated toclk_core->rateevery time the clock is reparented, and when we're doing the orphan -> !orphan transition. so it's the receipts of what was asked for πnew_rateβ new rate to be set during a rate change operation.new_parentβ pointer to new parent during parent change. This is also used when a clk's rate is changed.new_childβ pointer to new child during reparenting. This is also used when a clk's rate is changed.flagsβ clock property and capability flags. Seeclk framework flagsπ©orphanβ true if this clk is currently orphaned. it has no parent and it's going through it πrpm_enabledβ true if runtime power management is enabled for this clk.enable_countβ reference count of enables.prepare_countβ reference count of prepares.protect_countβ protection reference count against disable. iykyk, this one keeps it from getting shut off against its will π‘οΈmin_rateβ minimum supported clock rate (Hz).max_rateβ maximum supported clock rate (Hz).accuracyβ accuracy of the clock rate (parts per billion). how precise bestie is π―phaseβ current phase (degrees).dutyβ current duty cycle configuration (as ratio: num/den). πchildrenβ all of the children of this clk. the whole squad π―child_nodeβ node for linking as a child in the parent's list.hashtable_nodeβ node for hash table that allows fast clk lookup by name. speed β¨π¨clksβ all of the clk consumers registered.notifier_countβ number of notifiers registered for this clk. πdentryβ DebugFS entry for this clk. (this one lives behindCONFIG_DEBUG_FSπ )debug_nodeβ DebugFS node for this clk. (also aCONFIG_DEBUG_FSgirlie π )refβ reference count for structure lifetime management. keeps the whole thing from evaporating π«Ά
π Description
Managed by the clk framework. Clk providers and consumers do not interact with this structure directly β like, do not touch, it's not for you bestie π. Instead, clk operations flow through the framework, and the framework manipulates this structure to keep track of parent/child relationships, rate, enable state, etc. it's the framework's private lil notebook, periodt πβ¨
π SEE ALSO
Kernel file ./drivers/clk/clk.c plus, in order: clk_pm_runtime_get_all(9), clk_pm_runtime_put_all(9), clk_core_get(9), clk_determine_rate_noop(9), clk_rate_exclusive_put(9), clk_rate_exclusive_get(9), clk_unprepare(9), clk_prepare(9), clk_disable(9), clk_gate_restore_context(9), clk_save_context(9), clk_restore_context(9), clk_enable(9), clk_is_enabled_when_prepared(9), clk_hw_init_rate_request(9), clk_hw_forward_rate_request(9), __clk_determine_rate(9), clk_hw_round_rate(9), clk_round_rate(9), __clk_notify(9), __clk_recalc_accuracies(9), clk_get_accuracy(9), __clk_recalc_rates(9), clk_get_rate(9), clk_hw_get_parent_index(9), __clk_speculate_rates(9), clk_set_rate(9), clk_set_rate_exclusive(9), clk_set_rate_range(9), clk_set_min_rate(9), clk_set_max_rate(9), clk_get_parent(9), clk_has_parent(9), clk_set_parent(9), clk_set_phase(9), clk_get_phase(9), clk_set_duty_cycle(9), clk_get_scaled_duty_cycle(9), clk_is_match(9), clk_debug_register(9), clk_debug_init(9), __clk_core_init(9), clk_core_link_consumer(9), clk_core_unlink_consumer(9), alloc_clk(9), free_clk(9), clk_hw_create_clk(9), clk_hw_get_clk(9), dev_or_parent_of_node(9), clk_register(9), clk_hw_register(9), clk_unregister(9), clk_hw_unregister(9), devm_clk_register(9), devm_clk_hw_register(9), devm_clk_hw_get_clk(9), clk_notifier_register(9), clk_notifier_unregister(9), struct of_clk_provider(9), of_clk_add_provider(9), of_clk_add_hw_provider(9), devm_of_clk_add_hw_provider(9), of_clk_del_provider(9), of_parse_clkspec(9), of_clk_get_from_provider(9), of_clk_get_by_name(9), of_clk_get_parent_count(9), of_clk_parent_fill(9), of_clk_detect_critical(9), of_clk_init(9).
and that's the page bestie!! π«Ά it ships from ./drivers/clk, dated October 2026, and it goes out under the name struct clk_core(9) β slay, go read clk.c πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms