usb_phy_set_charger_current(9)
π 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 overmAβ 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 π
usb_phy_notify_charger_work(9)usb_phy_get_charger_type(9)usb_phy_get_charger_current(9)usb_phy_set_charger_state(9)devm_usb_get_phy(9)usb_get_phy(9)devm_usb_get_phy_by_node(9)devm_usb_get_phy_by_phandle(9)usb_put_phy(9)usb_add_phy(9)usb_add_phy_dev(9)usb_remove_phy(9)usb_phy_set_event(9)
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
- 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