usb_phy_set_charger_current(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… usb_phy_set_charger_current(9) πŸ’…

okay so this is a page straight out of the Kernel API Manual, bestie β€” it's usb_phy_set_charger_current, and yes the title is literally the function name so we're already iconic ✨


🌸 NAME 🌸

usb_phy_set_charger_current β€” set the USB charger current πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

void usb_phy_set_charger_current (struct usb_phy *usb_phy , unsigned int
mA );

that's it. that's the whole vibe. one function, two args, no return value (it's void, she gives nothing back and honestly? mood) πŸ’…


⭐ ARGUMENTS ⭐

  • usb_phy β€” the USB phy to be used 🫢 like, the phy you're working with, hand it over
  • mA β€” the current need to be set ⚑ that's the current, in milliamps, that you want set. fr fr

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the tea, bestie β˜•

Usually we only change the charger default current when USB finished the enumeration as one SDP charger. like, only then. that's the one scenario, no cap.

As one SDP charger, usb_phy_set_power will issue this function to change charger current when after setting USB configuration, or suspend/resume USB. so the flow is: usb_phy_set_power calls this, and that happens either after the USB configuration gets set, or on suspend/resume of USB. periodt. πŸ’€

🚨 For other type charger, we should use the default charger current and we do not suggest to issue this function to change the charger current. like β€” do not do it. the docs literally say "we do not suggest" and that's the polite kernel way of saying don't 😭

When USB charger current has been changed, we need to notify the power users. yep β€” changed current = you gotta tell the power users. no skipping that step πŸ‘‘


🌈 SEE ALSO 🌈

Kernel file ./drivers/usb/phy/phy.c β€” go read it iykyk πŸ“–

all the phy besties in one list, we love a linked family πŸ§šπŸ’œ


and that's the whole page!! sourced from ./drivers/usb/phy, dated October 2026, manual section 9 β€” mwah, go set those charger currents responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from