atmel_smc_cs_encode_ncycles(9)
π atmel_smc_cs_encode_ncycles(9) β the Kernel API Manual, but make it make sense
okay so this is atmel_smc_cs_encode_ncycles(9) from the Kernel API Manual β yes bestie, we're reading kernel docs for fun now, this is who we are π
β¨ NAME β¨
atmel_smc_cs_encode_ncycles β lowkey the glow-up translator that encodes a number of MCK clk cycles into the exact format the SMC engine expects π
πΈ SYNOPSIS πΈ
int atmel_smc_cs_encode_ncycles (unsigned int ncycles , unsigned int
msbpos , unsigned int msbwidth , unsigned int msbfactor , unsigned int
*encodedval );
like, that's the whole vibe. five args, one return, zero chill π
π¦ ARGUMENTS π¦
ncyclesβ the number of MCK clk cycles. this is the whole main character of the function fr fr β¨msbposβ where the MSB part of the timing field sits. its little home address πmsbwidthβ how wide the MSB part of the timing field is. giving measurements, giving precision πmsbfactorβ the factor applied to the MSB. it's the multiplier era π₯encodedvalβ the param used to store the encoding result. this is where the answer goes to live, bestie π
π§ DESCRIPTION π§
so what does it actually do? it encodes the ncycles value as described in the datasheet β specifically the section "SMC Setup/Pulse/Cycle/Timings Register". iykyk πβ¨
it's a generic helper, which means it gets called with different parameters depending on the encoding scheme. so it's like, adaptable. flexible. versatile. main character energy honestly π«Ά
now the part where you need to pay attention π if the ncycles value is too big to be encoded, the function returns -ERANGE and the encodedval contains the maximum val. dramatic? yes. necessary? also yes π
otherwise β and this is the slay case β 0 is returned. periodt β
π SEE ALSO π
go read the kernel file ./drivers/mfd/atmel-smc.c bestie, and while you're there these are all in the group chat too:
atmel_smc_cs_conf_init(9)atmel_smc_cs_conf_set_timing(9)atmel_smc_cs_conf_set_setup(9)atmel_smc_cs_conf_set_pulse(9)atmel_smc_cs_conf_set_cycle(9)atmel_smc_cs_conf_apply(9)atmel_hsmc_cs_conf_apply(9)atmel_smc_cs_conf_get(9)atmel_hsmc_cs_conf_get(9)atmel_hsmc_get_reg_layout(9)
like a whole friend group of functions. obsessed π¦
ngl, -ERANGE is not a vibe, but at least you get the maximum val out of it instead of nothing. silver lining behavior π
okay that's the page!! and for the cute sign-off: this one lives over in ./drivers/mfd, dated October 2026, and it's filed under atmel_smc_cs_encode_ncycles(9) in case you need to find it again. mwah, go encode some cycles ππ
π¦ 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