charger_man...repare_sysfs(9)
π NAME
okay so this is charger_manager_prepare_sysfs β it prepares a sysfs entry for each charger, from the Kernel API Manual (yes bestie, that's a whole manual, we're fancy now π).
β¨ SYNOPSIS
int charger_manager_prepare_sysfs (struct charger_manager *cm );
π ARGUMENTS
cmβ the Charger Manager that's representing the battery. that's it, that's the whole argument, she's low maintenance π
π¦ DESCRIPTION
okay so picture this: this function adds a sysfs entry for the charger (the regulator, iykyk) so that user-space can actually control the charger. main character energy fr fr π
and here's the vibe β sometimes a development board uses one more chargers for charging, but only needs one charger in a specific case, and that case depends on the user scenario or on hardware restrictions. so what does the user do? they enter 1 or 0 (zero, the number, not the letter, don't embarrass me π) into:
/sys/class/power_supply/battery/charger.[index]/externally_control
for example β if the user enters 1 into sys/class/power_supply/battery/charger.[index]/externally_control, then that charger isn't controlled from charger-manager anymore, and it always stays in the off state of the regulator. like it's off duty, permanently, no cap π
ngl the externally_control knob is the whole point here β that's the little doorway the user-space side walks through. respect it.
π SEE ALSO
the kernel file ./drivers/power/supply/charger-manager.c β¨ and the whole squad:
is_batt_present(9)is_ext_pwr_online(9)get_batt_uV(9)is_charging(9)is_full_charged(9)is_polling_required(9)try_charger_enable(9)check_charging_duration(9)cm_get_target_status(9)_cm_monitor(9)cm_monitor(9)_setup_polling(9)cm_monitor_poller(9)cm_setup_timer(9)charger_extcon_work(9)charger_extcon_notifier(9)charger_extcon_init(9)charger_manager_register_extcon(9)
and that's the page bestie π«Ά this little gem lives over in ./drivers/power/supply, and it's dated October 2026 β mark your calendars, it's giving iconic πβπ
π¦ 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