power_supply_ocv2cap_simple(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 bestie
  • table_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:


πŸ’€ 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