devm_clk_ge...ed_with_rate(9)
π devm_clk_get_optional_enabled_with_rate(9) π
okay so bestie, welcome to the Kernel API Manual β¨ β this is the one-stop glow-up page for devm_clk_get_optional_enabled_with_rate, which is literally three clock things wearing a trench coat: devm_clk_get_optional() + clk_set_rate() + clk_prepare_enable(). no cap, it's giving "convenience wrapper, but make it fashion" π
πΈ NAME πΈ
devm_clk_get_optional_enabled_with_rate β the combo deal: devm_clk_get_optional() plus clk_set_rate() plus clk_prepare_enable(). three icons, one function π«Ά
β¨ SYNOPSIS β¨
struct clk * devm_clk_get_optional_enabled_with_rate (struct device *dev
, const char *id , unsigned long rate );
π ARGUMENTS π
devβ the device that's acting as the clock "consumer" (yes, the quotes are canon, it's a whole role ok)idβ the clock consumer ID, aka this clock's little name tag π·οΈrateβ the new clock rate you're manifesting
π€ CONTEXT π€
May sleep. so like... it's allowed to nap π΄ don't call it from somewhere that can't handle sleeping, bestie, that's the whole vibe check.
π₯ RETURN π₯
You get back a struct clk that corresponds to the clock producer β or a valid IS_ERR condition containing errno π (that's the "something went wrong" energy, check it with IS_ERR before you get attached).
The implementation uses dev and id to determine the clock consumer, and thereby the clock producer. iykyk π
If no such clk is found, it returns NULL, which serves as a dummy clk β like a stand-in extra in the background of your movie π¬. That's the only difference compared to devm_clk_get_enabled. periodt.
π DESCRIPTION π
The returned clk (if valid) is prepared β
and enabled β
and rate was set β
. all three, done, slay.
The clock will automatically be disabled, unprepared and freed when the device is unbound from the bus. so it cleans up after itself β literally the dream π§β¨ no manual clk_put chore era for you.
π SEE ALSO π
Kernel file ./include/linux/clk.h π and the whole clock friend group:
clk notifier callback types(9)struct clk_notifier(9)struct clk_notifier_data(9)struct clk_bulk_data(9)clk_notifier_register(9)clk_notifier_unregister(9)devm_clk_notifier_register(9)clk_get_accuracy(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_rate_exclusive_get(9)devm_clk_rate_exclusive_get(9)clk_rate_exclusive_put(9)clk_save_context(9)clk_restore_context(9)clk_prepare(9)clk_unprepare(9)clk_is_enabled_when_prepared(9)clk_get(9)clk_bulk_get(9)clk_bulk_get_all(9)clk_bulk_get_optional(9)devm_clk_bulk_get(9)devm_clk_bulk_get_optional(9)devm_clk_bulk_get_enable(9)devm_clk_bulk_get_optional_enable(9)devm_clk_bulk_get_all(9)devm_clk_bulk_get_all_enabled(9)devm_clk_get(9)devm_clk_get_prepared(9)devm_clk_get_enabled(9)devm_clk_get_optional(9)devm_clk_get_optional_prepared(9)devm_clk_get_optional_enabled(9)devm_get_clk_from_child(9)clk_enable(9)clk_bulk_enable(9)clk_disable(9)clk_bulk_disable(9)clk_get_rate(9)clk_put(9)clk_bulk_put(9)clk_bulk_put_all(9)devm_clk_put(9)clk_round_rate(9)clk_set_rate(9)clk_set_rate_exclusive(9)clk_has_parent(9)clk_set_rate_range(9)clk_set_min_rate(9)clk_set_max_rate(9)clk_set_parent(9)clk_get_parent(9)clk_get_sys(9)clk_drop_range(9)clk_get_optional(9)
that's the whole page, bestie π¦ this one lives in ./include/linux, it's the October 2026 edition of the Kernel API Manual, and it's filed under devm_clk_get_optional_enabled_with_rate(9) β go be iconic with your clocks πβ
π¦ 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