mmc_vdd_to_ocrbitnum(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mmc_vdd_to_ocrbitnum(9) β€” the mmc_vdd_to_ocrbitnum glow-up πŸŽ€

okay so bestie, this is the kernel API manual for mmc_vdd_to_ocrbitnum and honestly? it's a little one-function wonder and I'm obsessed. ✨


✨ NAME ✨

mmc_vdd_to_ocrbitnum β€” convert a voltage to the OCR bit number πŸ¦‹

like... voltage goes in, bit number comes out. it's giving vending machine but for kernel math, ngl.


🌸 SYNOPSIS 🌸

int mmc_vdd_to_ocrbitnum (int vdd , bool low_bits );

that's the whole signature, no cap β€” copy it exactly, don't be cute with it. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • vdd β€” the voltage, in mV (millivolts, if you were about to ask πŸ™ˆ). this is the thing you're converting, bestie.
  • low_bits β€” a bool that says prefer low bits in boundary cases. so when a voltage is being all ambiguous and sitting right on a line, this flag picks the side. 🫢

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea β˜• β€” this function returns the OCR bit number according to the vdd value you hand it. that's the whole job. and if the conversion is not possible? it returns a negative errno value instead. not me getting a whole error code back 😭 β€” so like, check it, fr fr.

now, the low_bits flag is the main character here πŸ‘‘. depending on it, the function prefers low or high OCR bits on boundary voltages. for example:

  • with low_bits = true, 3300 mV translates to ilog2(MMC_VDD_32_33)
  • with low_bits = false, 3300 mV translates to ilog2(MMC_VDD_33_34)

same voltage, two different answers, and it's entirely the flag's fault. iconic behaviour honestly. πŸ’€

and one more thing bestie, write this down πŸ“ β€” any value in the [1951:1999] range translates to the ilog2(MMC_VDD_20_21). the whole range. every single value in it. no wiggle room, periodt. ⭐


πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file ./drivers/mmc/core/core.c is the place to be, and here's the whole friend group of sibling functions β€” go say hi, iykyk πŸ’œ:

🫢 friendly reminder: those (9) suffixes mean these are kernel API pages β€” check them out with man 9 <name> and slay your way through the MMC subsystem.

🌈 okay that's the whole page, you ate it up bestie. this one lives in ./drivers/mmc/core and the page is dated October 2026 β€” so yeah, future vibes only. go convert some voltages, love you bye πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from