mmc_vdd_to_ocrbitnum(9)
π
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β aboolthat 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 mVtranslates toilog2(MMC_VDD_32_33) - with
low_bits = false,3300 mVtranslates toilog2(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 π:
mmc_request_done(9)mmc_cqe_request_done(9)mmc_cqe_post_req(9)mmc_is_req_done(9)mmc_wait_for_req(9)mmc_wait_for_cmd(9)mmc_set_data_timeout(9)__mmc_claim_host(9)mmc_release_host(9)mmc_vddrange_to_ocrmask(9)mmc_handle_undervoltage(9)mmc_detect_change(9)mmc_erase(9)mmc_hw_reset(9)
π«Ά friendly reminder: those(9)suffixes mean these are kernel API pages β check them out withman 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
- 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