STRUCT BQ257XX_CHIP_INFO(9)
π struct bq257xx_chip_info(9) π
okay so bestie, welcome to the Kernel API Manual β yes we're in the kernel docs now, and yes you're gonna slay this. this page is literally all about the chip-specific routines for the bq257xx charger family. it's giving "one struct to rule all the chip variants" energy. π
β¨ NAME β¨
struct bq257xx_chip_info β chip specific routines
like, the whole vibe of this struct is: every chip gets its own little set of routines and defaults, and this is where they live. no cap. π¦
πΈ SYNOPSIS πΈ
struct bq257xx_chip_info {
int default_iindpm_uA;
int (*bq257xx_hw_init)(struct bq257xx_chg *pdata);
void (*bq257xx_hw_shutdown)(struct bq257xx_chg *pdata);
int (*bq257xx_get_state)(struct bq257xx_chg *pdata);
int (*bq257xx_get_ichg)(struct bq257xx_chg *pdata, int *intval);
int (*bq257xx_set_ichg)(struct bq257xx_chg *pdata, int ichg);
int (*bq257xx_get_vbatreg)(struct bq257xx_chg *pdata, int *intval);
int (*bq257xx_set_vbatreg)(struct bq257xx_chg *pdata, int vbatreg);
int (*bq257xx_get_iindpm)(struct bq257xx_chg *pdata, int *intval);
int (*bq257xx_set_iindpm)(struct bq257xx_chg *pdata, int iindpm);
int (*bq257xx_get_cur)(struct bq257xx_chg *pdata, int *intval);
int (*bq257xx_get_vbat)(struct bq257xx_chg *pdata, int *intval);
int (*bq257xx_get_min_vsys)(struct bq257xx_chg *pdata, int *intval);
};
look at her. one int, a whole bunch of function pointers, and every single one of them takes a struct bq257xx_chg *pdata. she's consistent, she's organized, she's iconic. π
π Members π
okay so let's go member by member, bestie, because there are twelve of these and we're doing all of them. no skipping. π«Ά
default_iindpm_uAβ the default input current limit, measured in microamps. this is the "just vibing out of the box" number. βbq257xx_hw_initβ the init function for the hw. it's the wake-up-and-get-ready moment for the hardware. πΈbq257xx_hw_shutdownβ the shutdown function for hw. when it's time to log off, this is the one that closes the laptop. πbq257xx_get_stateβ gets and updates the state of the hardware. not just a read β an update too. she does both. main character energy. β¨bq257xx_get_ichgβ get the maximum charge current, in uA.bq257xx_set_ichgβ set the maximum charge current, in uA.bq257xx_get_vbatregβ get the maximum charge voltage, in uV.bq257xx_set_vbatregβ set the maximum charge voltage, in uV.bq257xx_get_iindpmβ get the maximum input current, in uA.bq257xx_set_iindpmβ set the maximum input current, in uA.bq257xx_get_curβ get the battery current from the ADC, in uA.bq257xx_get_vbatβ get the battery voltage from the ADC, in uV.bq257xx_get_min_vsysβ get the minimum system voltage, in uV.
see how the get/set pairs are just mirroring each other? it's giving symmetry, it's giving balance, it's giving chef's kiss. and yeah, notice the units: current is uA (microamps), voltage is uV (microvolts). don't mix 'em up, bestie β iykyk. π§
π₯ SEE ALSO π₯
so like, if you wanna go deeper (and you know you do), go look at the kernel file <pink>./drivers/power/supply/bq257xx_charger.c</pink> β that's where the magic lives. πͺ
and then there's the whole squad, the full friend group, the entire group chat:
struct bq257xx_chg(9)bq25792_read16(9)bq25792_write16(9)bq25703_get_state(9)bq25792_get_state(9)bq25703_get_min_vsys(9)bq25792_get_min_vsys(9)bq25703_set_min_vsys(9)bq25792_set_min_vsys(9)bq25703_get_cur(9)bq25792_get_cur(9)bq25703_get_ichg_cur(9)bq25792_get_ichg_cur(9)bq25703_set_ichg_cur(9)bq25792_set_ichg_cur(9)bq25703_get_chrg_volt(9)bq25792_get_chrg_volt(9)bq25703_set_chrg_volt(9)bq25792_set_chrg_volt(9)bq25703_get_iindpm(9)bq25792_get_iindpm(9)bq25703_set_iindpm(9)bq25792_set_iindpm(9)bq25703_get_vbat(9)bq25792_get_vbat(9)bq25703_hw_init(9)bq25792_hw_init(9)bq25703_hw_shutdown(9)bq25792_hw_shutdown(9)bq257xx_set_charger_property(9)bq257xx_get_charger_property(9)bq257xx_property_is_writeable(9)bq257xx_external_power_changed(9)bq257xx_irq_handler_thread(9)bq257xx_parse_dt(9)bq257xx_charger_probe(9)bq257xx_charger_shutdown(9)
go read all of them. yes, all of them. i'll wait. π
ok and one last thing bestie β this whole page lives under<cyan>./drivers/power/supply</cyan>, and it's dated October 2026. so go forth, read your structs, and remember: every chip deserves a routine. 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