STRUCT AB8500_FG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 reentrance
  • irq β€” holds the CCEOC interrupt number
  • vbat_uv β€” Battery voltage in uV
  • vbat_nom_uv β€” Nominal battery voltage in uV
  • inst_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 uA
  • bat_temp β€” battery temperature
  • fg_samples β€” Number of samples used in the FG accumulation
  • accu_charge β€” Accumulated charge from the last conversion
  • recovery_cnt β€” Counter for recovery mode
  • high_curr_cnt β€” Counter for high current mode
  • init_cnt β€” Counter for init mode
  • low_bat_cnt β€” Counter for number of consecutive low battery measures
  • nbr_cceoc_irq_cnt β€” Counter for number of CCEOC irqs received since enabled
  • recovery_needed β€” Indicate if recovery is needed
  • high_curr_mode β€” Indicate if we're in high current mode
  • init_capacity β€” Indicate if initial capacity measuring should be done
  • turn_off_fg β€” True if fg was off before current measurement
  • calib_state β€” State during offset calibration
  • discharge_state β€” Current discharge state
  • charge_state β€” Current charge state
  • ab8500_fg_started β€” Completion struct used for the instant current start
  • ab8500_fg_complete β€” Completion struct used for the instant current reading
  • flags β€” Structure for information about events triggered
  • bat_cap β€” Structure for battery capacity specific parameters
  • avg_cap β€” Average capacity filter
  • parent β€” Pointer to the struct ab8500
  • main_bat_v β€” ADC channel for the main battery voltage
  • bm β€” Platform specific battery management information
  • fg_psy β€” Structure that holds the FG specific battery properties
  • fg_wq β€” Work queue for running the FG algorithm
  • fg_periodic_work β€” Work to run the FG algorithm periodically
  • fg_low_bat_work β€” Work to check low bat condition
  • fg_reinit_work β€” Work used to reset and reinitialise the FG algorithm
  • fg_work β€” Work to run the FG algorithm instantly
  • fg_acc_cur_work β€” Work to read the FG accumulator
  • fg_check_hw_failure_work β€” Work for checking HW state
  • cc_lock β€” Mutex for locking the CC
  • fg_kobject β€” Structure of type kobject

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