STRUCT CLK_DIVIDER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the struct clk_divider(9) page from the Kernel API Manual β€” it’s giving adjustable divider clock and we’re gonna read it together πŸ’…βœ¨

✨ NAME ✨

struct clk_divider β€” adjustable divider clock πŸ•°οΈ

πŸ“œ SYNOPSIS πŸ“œ

       struct clk_divider {
           struct clk_hw   hw;
           void __iomem    *reg;
           u8 shift;
           u8 width;
           u16 flags;
           const struct clk_div_table      *table;
           spinlock_t *lock;
        };

🧩 Members 🧩

  • hw β€” handle between common and hardware-specific interfaces ✨
  • reg β€” register containing the divider πŸ“
  • shift β€” shift to the divider bit field ⬅️
  • width β€” width of the divider bit field πŸ“
  • flags β€” the flag vibes go like this πŸ‘‡
    • CLK_DIVIDER_ONE_BASED β€” by default the divisor is the value read from the register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is the raw value read from the register, with the value of zero considered invalid, unless CLK_DIVIDER_ALLOW_ZERO is set. πŸ’…
    • CLK_DIVIDER_POWER_OF_TWO β€” clock divisor is 2 raised to the value read from the hardware register πŸ”₯
    • CLK_DIVIDER_ALLOW_ZERO β€” Allow zero divisors. For dividers which have CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor. Some hardware implementations gracefully handle this case and allow a zero divisor by not modifying their input clock (divide by one / bypass). 🫢
    • CLK_DIVIDER_HIWORD_MASK β€” The divider settings are only in lower 16-bit of this register, and mask of divider bits are in higher 16-bit of this register. While setting the divider bits, higher 16-bit should also be updated to indicate changing divider bits. 🧠
    • CLK_DIVIDER_ROUND_CLOSEST β€” Makes the best calculated divider to be rounded to the closest integer instead of the up one. 🎯
    • CLK_DIVIDER_READ_ONLY β€” The divider settings are preconfigured and should not be changed by the clock framework. 🚫
    • CLK_DIVIDER_MAX_AT_ZERO β€” For dividers which are like CLK_DIVIDER_ONE_BASED except when the value read from the register is zero, the divisor is 2^width of the field. πŸ’₯
    • CLK_DIVIDER_BIG_ENDIAN β€” By default little endian register accesses are used for the divider register. Setting this flag makes the register accesses big endian. πŸ”„
    • CLK_DIVIDER_EVEN_INTEGERS β€” clock divisor is 2, 4, 6, 8, 10, etc. Formula is 2 * (value read from hardware + 1). ✌️
  • table β€” array of value/divider pairs, last entry should have div = 0 πŸ“š
  • lock β€” register lock πŸ”’

πŸ’– Description πŸ’–

Clock with an adjustable divider affecting its output frequency. Implements .recalc_rate, .set_rate and .determine_rate βœ¨πŸ‘‘

πŸ”— SEE ALSO πŸ”—


mwah πŸ’‹ this page is sourced/versioned at ./include/linux, dated October 2026, and it’s literally struct clk_divider(9) β€” k bye bestie, go slay those dividers πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from