STRUCT CLK_MUX(9)
π struct clk_mux(9) β the Kernel API Manual, bestie edition
okay so real talk: this one's a page from the Kernel API Manual and it's all about struct clk_mux, aka the multiplexer clock. it's giving "choose your fighter" energy and honestly? iconic.
β¨ NAME β¨
struct clk_mux β the multiplexer clock, periodt π
π SYNOPSIS π
like, here's the whole vibe, verbatim, no notes:
struct clk_mux {
struct clk_hw hw;
void __iomem *reg;
const u32 *table;
u32 mask;
u8 shift;
u8 flags;
spinlock_t *lock;
};
π¦ Members π¦
okay let's meet the cast, main character energy only:
hwβ the handle between the common interfaces and the hardware-specific ones. it's the little liaison, the go-between, the group-chat admin π«Άregβ the register that controls the multiplexer. this is where the actual business happens.tableβ an array of register values that correspond to the parent index. lowkey the mapping table of your dreams.maskβ the mask of the multiplexer bit field. keeps things contained, as it should.shiftβ the shift to the multiplexer bit field. gotta slide into position πflagsβ hardware-specific flags. yes there are a bunch, hold on, we're getting there.lockβ the register lock. nobody touches the register without it, fr fr.
πΈ Description πΈ
so it's a clock with multiple selectable parents β you get options, you get range, you get choices π. it implements .get_parent, .set_parent and .recalc_rate.
now, the flags. buckle up bestie, there are six π:
CLK_MUX_INDEX_ONEβ the register index starts at1, not0. yes, really. it's one-indexed, don't come for me.CLK_MUX_INDEX_BITβ the register index is a single bit (a power of two).CLK_MUX_HIWORD_MASKβ the mux settings live only in the lower 16-bit of this register, and the mask of the mux bits lives in the higher 16-bit of this register. while you're setting the mux bits, the higher 16-bit should also be updated to indicate the changing mux bits. the way that this one has layers π§CLK_MUX_READ_ONLYβ the mux registers can't be written, only read, in the.get_parentclk_op. look but don't touch, respectfully πCLK_MUX_ROUND_CLOSESTβ use the parent rate that is closest to the desired frequency. bestie-matchmaker behaviour, love that for us.CLK_MUX_BIG_ENDIANβ by default, little endian register accesses are used for the mux register. setting this flag makes the register accesses big endian. flipping the whole byte order, no cap.
β οΈ real one: little endian is the default for the mux register accesses. CLK_MUX_BIG_ENDIAN is how you opt out of that. don't get it twisted π
π₯ SEE ALSO π₯
the whole friend group, all present and accounted for, gather round:
- the kernel file
./include/linux/clk-provider.h - the clk framework
flags(9) struct clk_rate_request(9)struct clk_duty(9)struct clk_spread_spectrum(9)struct clk_ops(9)struct clk_parent_data(9)struct clk_init_data(9)struct clk_hw(9)struct clk_fixed_rate(9)clk_hw_register_fixed_rate(9)devm_clk_hw_register_fixed_rate(9)devm_clk_hw_register_fixed_rate_parent_data(9)clk_hw_register_fixed_rate_parent_hw(9)clk_hw_register_fixed_rate_parent_data(9)clk_hw_register_fixed_rate_with_accuracy(9)clk_hw_register_fixed_rate_with_accuracy_parent_hw(9)clk_hw_register_fixed_rate_with_accuracy_parent_data(9)clk_hw_register_fixed_rate_parent_accuracy(9)struct clk_gate(9)clk_hw_register_gate(9)clk_hw_register_gate_parent_hw(9)clk_hw_register_gate_parent_data(9)devm_clk_hw_register_gate(9)devm_clk_hw_register_gate_parent_hw(9)devm_clk_hw_register_gate_parent_data(9)struct clk_divider(9)clk_register_divider(9)clk_hw_register_divider(9)clk_hw_register_divider_parent_hw(9)clk_hw_register_divider_parent_data(9)clk_hw_register_divider_table(9)clk_hw_register_divider_table_parent_hw(9)clk_hw_register_divider_table_parent_data(9)devm_clk_hw_register_divider(9)devm_clk_hw_register_divider_parent_hw(9)devm_clk_hw_register_divider_parent_data(9)devm_clk_hw_register_divider_table(9)struct clk_fixed_factor(9)devm_clk_hw_register_fixed_factor_parent_hw(9)struct clk_fractional_divider(9)struct clk_multiplier(9)clk_hw_get_dev(9)clk_hw_get_of_node(9)
that's the whole page, bestie, you ate it up πβ¨
βΏ sourced from ./include/linux, dated October 2026, page struct clk_mux(9) β mwah, see u in the next manpage π
π¦ 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