clk_core_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… clk_core_get(9) πŸ’…

ok so bestie, welcome to the Kernel API Manual β€” this page is called clk_core_get, and honestly? it's lowkey the glow-up your clock provider has been waiting for ✨


🌸 NAME 🌸

clk_core_get β€” find the clk_core parent of a clk 🫢


✨ SYNOPSIS ✨

struct clk_core * clk_core_get (struct clk_core *core , u8 p_index );

like yes, that's the whole signature, no cap πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • core β€” the clk you're trying to find the parent of. that's the main character right there πŸ‘‘
  • p_index β€” the parent index you're searching for πŸ”

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. this is the preferred method for clk providers to find the parent of a clk when that parent lives outside the clk controller. fr fr, this is the way 🌈

here's the tea: the parent_names array is indexed, and its entry gets treated either as

  • a local name that matches a string in the device node's 'clock-names' property, or
  • the 'con_id' that matches the device's dev_name in a clk_lookup.

the whole point? it lets clk providers kick it in their own namespace instead of hunting for a globally unique parent string. iconic behaviour, honestly πŸ’œ

for example, the following DT snippet would let a clock registered by the clock-controllerc001 β€” which has a clk_init_data::parent_data array with 'xtal' sitting in the 'name' member β€” find the clock provided by clock-controllerf00abcd without needing to get the globally unique name of the xtal clk. slay πŸ’…

parent: clock-controllerf00abcd {
    reg = <0xf00abcd 0xabcd>;
    #clock-cells = <0>;
};

clock-controllerc001 {
    reg = <0xc001 0xf00d>;
    clocks = <parent>;
    clock-names = "xtal";
    #clock-cells = <1>;
};

see how clean that is? no global-name scavenger hunt required 🧚


πŸ”₯ RETURN πŸ”₯

three possible vibes, bestie β€” know them, love them:

  • -ENOENT β€” when the provider can't be found, or the clk doesn't exist in the provider, or the name can't be found in the DT node or in a clkdev lookup. sad but valid 😭
  • NULL β€” when the provider knows about the clk but it isn't provided on this system. it's giving "i know her but she's not here" πŸ’€
  • a valid clk_core pointer β€” when the clk can be found in the provider. that's the win, that's the moment, periodt πŸŽ‰

⭐ SEE ALSO ⭐

okay this list is long long, buckle up bestie β€” it's the whole clock family reunion 🫢


okay that's the whole page bestie, go forth and find those parents πŸ’–

this came to you from ./drivers/clk, dated October 2026 β€” mwah, hope this helped, you're gonna do great πŸŒΈπŸ’…
πŸ“¦ where this page comes from