STRUCT AB8500_FG(9)
π struct ab8500_fg(9) β like, the whole FG device info situation
okay bestie, so this is a page from the Kernel API Manual (section 9, kernel API, iykyk) and it's all about struct ab8500_fg. That's the ab8500 FG (fuel gauge) device info struct. It's the main character of the show. π
β¨ NAME β¨
struct ab8500_fg β ab8500 FG device information. That's it, that's the vibe. π
π¦ SYNOPSIS π¦
here's the whole struct, every field, no skips, no cap:
struct ab8500_fg {
struct device *dev;
struct list_head node;
int irq;
int vbat_uv;
int vbat_nom_uv;
int inst_curr_ua;
int avg_curr_ua;
int bat_temp;
int fg_samples;
int accu_charge;
int recovery_cnt;
int high_curr_cnt;
int init_cnt;
int low_bat_cnt;
int nbr_cceoc_irq_cnt;
u32 line_impedance_uohm;
bool recovery_needed;
bool high_curr_mode;
bool init_capacity;
bool turn_off_fg;
enum ab8500_fg_calibration_state calib_state;
enum ab8500_fg_discharge_state discharge_state;
enum ab8500_fg_charge_state charge_state;
struct completion ab8500_fg_started;
struct completion ab8500_fg_complete;
struct ab8500_fg_flags flags;
struct ab8500_fg_battery_capacity bat_cap;
struct ab8500_fg_avg_cap avg_cap;
struct ab8500 *parent;
struct iio_channel *main_bat_v;
struct ab8500_bm_data *bm;
struct power_supply *fg_psy;
struct workqueue_struct *fg_wq;
struct delayed_work fg_periodic_work;
struct delayed_work fg_low_bat_work;
struct delayed_work fg_reinit_work;
struct work_struct fg_work;
struct work_struct fg_acc_cur_work;
struct delayed_work fg_check_hw_failure_work;
struct mutex cc_lock;
struct kobject fg_kobject;
};
π Members π
okay so here's the field-by-field tea, in order, all 41-ish of them β grab a snack π
devβ Pointer to the structure device. the classic.nodeβ a list of AB8500 FGs, hence prepared for reentranceirqβ holds the CCEOC interrupt numbervbat_uvβ Battery voltage in uVvbat_nom_uvβ Nominal battery voltage in uVinst_curr_uaβ Instantenous battery current in uA (yes, spelled exactly like that in the og, don't come for me π)avg_curr_uaβ Average battery current in uAbat_tempβ battery temperaturefg_samplesβ Number of samples used in the FG accumulationaccu_chargeβ Accumulated charge from the last conversionrecovery_cntβ Counter for recovery modehigh_curr_cntβ Counter for high current modeinit_cntβ Counter for init modelow_bat_cntβ Counter for number of consecutive low battery measuresnbr_cceoc_irq_cntβ Counter for number of CCEOC irqs received since enabledrecovery_neededβ Indicate if recovery is neededhigh_curr_modeβ Indicate if we're in high current modeinit_capacityβ Indicate if initial capacity measuring should be doneturn_off_fgβ True if fg was off before current measurementcalib_stateβ State during offset calibrationdischarge_stateβ Current discharge statecharge_stateβ Current charge stateab8500_fg_startedβ Completion struct used for the instant current startab8500_fg_completeβ Completion struct used for the instant current readingflagsβ Structure for information about events triggeredbat_capβ Structure for battery capacity specific parametersavg_capβ Average capacity filterparentβ Pointer to thestruct ab8500main_bat_vβ ADC channel for the main battery voltagebmβ Platform specific battery management informationfg_psyβ Structure that holds the FG specific battery propertiesfg_wqβ Work queue for running the FG algorithmfg_periodic_workβ Work to run the FG algorithm periodicallyfg_low_bat_workβ Work to check low bat conditionfg_reinit_workβ Work used to reset and reinitialise the FG algorithmfg_workβ Work to run the FG algorithm instantlyfg_acc_cur_workβ Work to read the FG accumulatorfg_check_hw_failure_workβ Work for checking HW statecc_lockβ Mutex for locking the CCfg_kobjectβ Structure of typekobject
literally every single one accounted for π
π₯ SEE ALSO π₯
first up, the source file itself: Kernel file ./drivers/power/supply/ab8500_fg.c π«Ά
and then, bestie, the friend group β struct ab8500_fg_interrupts(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_calculate_scaled_capacity(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).
that's the entire guest list, go say hi π
πΈ the cute sign-off πΈ
this lil masterpiece lives in ./drivers/power/supply, dated October 2026, and it's filed under struct ab8500_fg(9) in the Kernel API Manual. slay, honestly. periodt. πβ¨π
π¦ 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