sg2042_pll_get_postdiv_1_2(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– sg2042_pll_get_postdiv_1_2(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” yes this is that Kernel API Manual β€” and today's main character is a PLL helper that just wants to find you the right divider combo. no cap. 🫢


✨ NAME ✨

sg2042_pll_get_postdiv_1_2 β€” literally takes your input rate/prate/fbdiv/refdiv, looks up the postdiv1_2 table, and gets you the closest postdiiv combination. (and yes, "postdiiv" is spelled exactly like that in the source material, i'm not fixing it, it's iconic πŸ’€)


πŸ¦‹ SYNOPSIS πŸ¦‹

int sg2042_pll_get_postdiv_1_2 (unsigned long rate , unsigned long prate
, unsigned int fbdiv , unsigned int refdiv , unsigned int *postdiv1 ,
unsigned int *postdiv2 );

πŸŽ€ ARGUMENTS πŸŽ€

  • rate β€” the FOUTPOSTDIV. the output vibe you're aiming for. ⭐
  • prate β€” the parent rate, a.k.a. FREF. where you're coming from, bestie.
  • fbdiv β€” the FBDIV. keep it, don't lose it. πŸ’…
  • refdiv β€” the REFDIV. the reference divider of the group.
  • postdiv1 β€” POSTDIV1, and it's an output. so this pointer gets filled in, not read. πŸ™ˆ
  • postdiv2 β€” POSTDIV2, also an output. same deal, pointer goes out. 🌸

πŸ”₯ DESCRIPTION πŸ”₯

postdiv1_2 is holding all the possible combination lists of POSTDIV1 and POSTDIV2 β€” like, the whole roster. for example:

postdiv1_2[0] = {2, 4, 8}, where div1 = 2, div2 = 4 , div1 * div2 = 8

so in that one, div1 = 2, div2 = 4, and div1 * div2 = 8. math ate, honestly. ✨

See TRM: FOUTPOSTDIV = FREF * FBDIV / REFDIV / (POSTDIV1 * POSTDIV2)

so from that we get the following formula to get POSTDIV1 and POSTDIV2:

POSTDIV = (prate/REFDIV) x FBDIV/rate

and, above, POSTDIV = POSTDIV1*POSTDIV2. periodt. πŸ‘‘


πŸ’€ RETURN πŸ’€

  • 0 β€” okay! OK. we slayed, everything worked. πŸŽ‰
  • -EINVAL β€” invalid argument, which means it failed to get the postdivs. sad girl hours. 😭

🌈 SEE ALSO 🌈

all of these are lowkey part of the same friend group, go say hi. 🫢


and that's the whole page, bestie! this one came to you from ./drivers/clk/sophgo, dated October 2026 β€” the source/version and the date are right there, folded into this cute little sign-off instead of a boring footer line. mwah πŸ’‹ sg2042_pll_get_postdiv_1_2(9) out. πŸ’…πŸŽ€

πŸ“¦ where this page comes from