power_supply_ocv2cap_simple(9)
π power_supply_ocv2cap_simple π
okay bestie, welcome to the Kernel API Manual β¨ β this one's a lil helper called power_supply_ocv2cap_simple, and honestly? it's giving "small function, big job" energy π«Ά
πΈ NAME πΈ
power_supply_ocv2cap_simple β find the battery capacity πβ¨
like, that's literally it, that's the whole vibe check
π SYNOPSIS π
int power_supply_ocv2cap_simple (const struct
power_supply_battery_ocv_table *table , int table_len , int ocv );
she takes three args and hands you back an int, no cap π
π¦ ARGUMENTS π¦
tableβ a pointer to the battery OCV lookup table π like, this is the source of truth bestietable_lenβ the length of that OCV table, i.e. how many entries you're working with π’ocvβ the current OCV value, the thing you're tryna match up π
π DESCRIPTION π
so here's the tea β β this helper function is used to look up the battery capacity according to the current OCV value, and it pulls that from one OCV table π
β οΈ okay important: the OCV table must be ordered descending, fr fr. don't come at her with an unsorted table, she will not be slaying π
it's the "simple" version of the lookup and she knows exactly what she's doing πββοΈ
β¨ RETURN β¨
returns the battery capacity ππ that's the whole answer, that's the payoff
π SEE ALSO π
the kernel file lives at:
./drivers/power/supply/power_supply_core.c
and here's the whole friend group π―ββοΈ β all these icons:
power_supply_get_by_name(9)power_supply_get_system_batteries(9)power_supply_put_system_batteries(9)power_supply_put(9)power_supply_get_by_reference(9)devm_power_supply_get_by_reference(9)power_supply_temp2resist_simple(9)power_supply_vbat2ri(9)power_supply_get_property_direct(9)power_supply_set_property_direct(9)power_supply_register(9)devm_power_supply_register(9)power_supply_unregister(9)
π reminder that <italic>table</italic> has to be descending or the whole thing's a mess, iykyk
and that's the page!! mwah π this lil cutie lives over in ./drivers/power/supply and the version/date stamp on her is October 2026 ποΈβ¨ k byeee, go read the source, ily π«Άπ
π¦ 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