clk_round_rate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌈 clk_round_rate(9) β€” Kernel API Manual 🌈

okay so this is the Kernel API Manual page for clk_round_rate, and bestie it’s giving β€œclock math without touching the hardware” energy. πŸ’…

πŸ’– NAME πŸ’–

clk_round_rate β€” adjust a rate to the exact rate a clock can provide.

✨ SYNOPSIS ✨

long clk_round_rate (struct clk *clk , unsigned long rate );

πŸŽ€ ARGUMENTS πŸŽ€

  • clk β€” clock source. the actual clock bestie we’re asking about.
  • rate β€” desired clock rate in Hz.

πŸ¦‹ DESCRIPTION πŸ¦‹

Bestie, this is the β€œwhat would I actually get?” function. It answers the question β€œif I were to pass rate to clk_set_rate, what clock rate would I end up with?” β€” and it does it without changing the hardware in any way. no cap. ✨

In other words, this:

rate = clk_round_rate(clk, r);

and this:

clk_set_rate(clk, r); rate = clk_get_rate(clk);

are equivalent β€” except the first one does not modify the clock hardware in any way. iconic behavior, honestly. πŸ’…

It returns the rounded clock rate in Hz, or a negative errno. That’s the whole vibe check. 🫢

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/clk.h, plus the whole clk 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_clk_get_optional_enabled_with_rate(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_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).

mwah πŸ’‹ β€” source/version is ./include/linux, dated October 2026, and this is the clk_round_rate(9) page. periodt. 🫢

πŸ“¦ where this page comes from