sg2042_pll_get_postdiv_1_2(9)
π 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β theFOUTPOSTDIV. the output vibe you're aiming for. βprateβ the parent rate, a.k.a.FREF. where you're coming from, bestie.fbdivβ theFBDIV. keep it, don't lose it. πrefdivβ theREFDIV. 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 π
- kernel file
./drivers/clk/sophgo/clk-sg2042-pll.c struct sg2042_pll_clock(9)sg2042_pll_recalc_rate(9)sg2042_get_pll_ctl_setting(9)sg2042_clk_pll_recalc_rate(9)
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
- 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