ab8500_fg_c...led_capacity(9)
β¨ ab8500_fg_calculate_scaled_capacity(9) β¨
okay so real talk, bestie β this is a page from the Kernel API Manual, and today's main character is ab8500_fg_calculate_scaled_capacity. it's giving "small function, big job" energy, and honestly? we're obsessed π
πΈ NAME πΈ
ab8500_fg_calculate_scaled_capacity β the capacity-scaling girlie of the ab8500 fuel gauge. that's it, that's the vibe. lowkey her whole personality is "make the numbers look right for the people upstairs." π
π¦ SYNOPSIS π¦
int ab8500_fg_calculate_scaled_capacity (struct ab8500_fg *di );
like, she takes one pointer and hands you back an int. clean, simple, iconic. no cap. β¨
π ARGUMENTS π
diβ a pointer to theab8500_fgstructure. that's the fuel-gauge bestie herself, the whole struct, the main character. she needs it, so hand it over π«Ά
π DESCRIPTION π
so here's the tea, and it's actually important tea β β ab8500_fg_calculate_scaled_capacity calculates the capacity that gets shown to the upper layers. like, the stuff that people (and by people i mean the rest of the kernel and eventually your little battery icon) actually see.
and the way it does that? it scales the capacity so that 100% is the reference β pulled from the actual capacity at the moment the charger gets removed, when charging is hanging out in maintenance mode. yeah. that exact moment. that's the moment she cares about. β‘
so: charger out, maintenance mode, actual capacity in hand β boom, now that's your 100% reference, and everything else gets scaled around it. periodt. ππ₯
π SEE ALSO π
okay this is the part where the page just. keeps. going. it's a whole group chat of related symbols and honestly? i respect the commitment π. the kernel file lives at ./drivers/power/supply/ab8500_fg.c and the struct squad rolls deep:
ab8500_fg_interrupts(9)struct ab8500_fg(9)ab8500_fg_get(9)ab8500_fg_is_low_curr(9)ab8500_fg_add_cap_sample(9)ab8500_fg_clear_cap_samples(9)ab8500_fg_fill_cap_sample(9)ab8500_fg_coulomb_counter(9)ab8500_fg_inst_curr_start(9)ab8500_fg_inst_curr_started(9)ab8500_fg_inst_curr_done(9)ab8500_fg_inst_curr_finalize(9)ab8500_fg_inst_curr_blocking(9)ab8500_fg_acc_cur_work(9)ab8500_fg_bat_voltage(9)ab8500_fg_volt_to_capacity(9)ab8500_fg_uncomp_volt_to_capacity(9)ab8500_fg_battery_resistance(9)ab8500_load_comp_fg_bat_voltage(9)ab8500_fg_load_comp_volt_to_capacity(9)ab8500_fg_convert_mah_to_permille(9)ab8500_fg_convert_permille_to_mah(9)ab8500_fg_convert_mah_to_uwh(9)ab8500_fg_calc_cap_charging(9)ab8500_fg_calc_cap_discharge_voltage(9)ab8500_fg_calc_cap_discharge_fg(9)ab8500_fg_capacity_level(9)ab8500_fg_update_cap_scalers(9)ab8500_fg_check_capacity_limits(9)ab8500_fg_algorithm_charging(9)ab8500_fg_algorithm_discharging(9)ab8500_fg_algorithm_calibrate(9)ab8500_fg_algorithm(9)ab8500_fg_periodic_work(9)ab8500_fg_check_hw_failure_work(9)ab8500_fg_low_bat_work(9)ab8500_fg_battok_calc(9)ab8500_fg_battok_init_hw_register(9)ab8500_fg_instant_work(9)ab8500_fg_cc_data_end_handler(9)ab8500_fg_cc_int_calib_handler(9)ab8500_fg_cc_convend_handler(9)ab8500_fg_batt_ovv_handler(9)ab8500_fg_lowbatf_handler(9)ab8500_fg_get_property(9)ab8500_fg_init_hw_registers(9)ab8500_fg_external_power_changed(9)ab8500_fg_reinit_work(9)ab8500_fg_sysfs_exit(9)ab8500_fg_sysfs_init(9)
iykyk β if you're poking at the ab8500 fuel gauge, you're gonna meet all of these eventually π§
fr fr, don't skip the DESCRIPTION β the whole "100% reference from the actual capacity on charger removal in maintenance mode" thing is the entire point of this function. miss it and the scaling will confuse you, no cap π
and that's the page!! this lil slice of kernel-api goodness is served up from ./drivers/power/supply, dated October 2026, and it's literally the ab8500 fuel gauge's finest hour. go forth, scale that capacity, and slay πβπ
π¦ 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