STRUCT CHARGER_REGULATOR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct charger_regulator(9) ✨

okay so bestie, this is a page from the Kernel API Manual, and it's all about struct charger_regulator β€” the lil struct that handles the regulator side of the charger-manager situation. no cap, it's giving "supporting character who's actually kinda important" energy πŸ‘‘


🌸 NAME 🌸

struct charger_regulator β€” and that's... literally it. the one-liner description? empty. blank. a whole void 😭 the original page leaves it hanging, so we're leaving it hanging too. no spoilers, no invented lore, i don't make the rules 🫢


πŸŽ€ SYNOPSIS πŸŽ€

here's the struct in all its glory, copied character-for-character because i would never mess with the code:

struct charger_regulator {
    const char *regulator_name;
    struct regulator *consumer;
    int externally_control;
    struct charger_cable *cables;
    int num_cables;
    struct attribute_group attr_grp;
    struct device_attribute attr_name;
    struct device_attribute attr_state;
    struct device_attribute attr_externally_control;
    struct attribute *attrs[4];
    struct charger_manager *cm;
 };

look at attrs[4] just sitting there with its hardcoded little size. iconic. tiny. perfect. πŸ”₯


✨ MEMBERS ✨

time for the cast list, let's go member by member πŸ’–

  • regulator_name β€” the name of regulator for using charger. that's the label you use to find your regulator, bestie 🌈
  • consumer β€” the regulator consumer for the charger. this is the actual consumer handle the charger is holding onto πŸ’…
  • externally_control β€” set this if the charger-manager cannot control the charger, and in that case the charger will be maintained with disabled state. so yeah, it's the "hands off, someone else is driving" flag, and the consequence is real: disabled state, maintained. periodt πŸ’€
  • cables β€” the array of charger cables to enable/disable charger and set current limit according to constraint data of struct charger_cable if only charger cable included in the array of charger cables is attached/detached. yes it's a long one, read it twice, it's literally all load-bearing 🧚
  • num_cables β€” the number of charger cables. keeping count, always πŸŽ€
  • attr_name β€” the "name" sysfs entry πŸ¦‹
  • attr_state β€” the "state" sysfs entry πŸ¦‹
  • attr_externally_control β€” the "externally_control" sysfs entry πŸ¦‹
  • attrs β€” arrays pointing to attr_name/state/externally_control for attr_g. (that's how it's written on the page β€” attr_g, not spelled out any further, so we're not gonna guess πŸ™ˆ)
quick note bestie: attr_grp and cm are definitely in the struct up there, but the Members list on this page doesn't describe them. so i'm not making up descriptions β€” that would be a vibe violation fr fr ⭐

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, bestie, i'm obsessed with the cross-referencing:

  • Kernel file ./include/linux/power/charger-manager.h
  • struct charger_cable(9)
  • struct charger_desc(9)
  • struct charger_manager(9)

and that's a wrap, mwah πŸ’‹ this page lives out of ./include/linux/power and it's dated October 2026. blown a kiss to the kernel docs team, they ate πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from