xref: /linux/Documentation/ABI/testing/usb-charger-uevent (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
188008266SPeter ChenWhat:		Raise a uevent when a USB charger is inserted or removed
288008266SPeter ChenDate:		2020-01-14
388008266SPeter ChenKernelVersion:	5.6
488008266SPeter ChenContact:	linux-usb@vger.kernel.org
588008266SPeter ChenDescription:	There are two USB charger states:
6*54a19b4dSMauro Carvalho Chehab
7*54a19b4dSMauro Carvalho Chehab		- USB_CHARGER_ABSENT
8*54a19b4dSMauro Carvalho Chehab		- USB_CHARGER_PRESENT
9*54a19b4dSMauro Carvalho Chehab
1088008266SPeter Chen		There are five USB charger types:
11*54a19b4dSMauro Carvalho Chehab
12*54a19b4dSMauro Carvalho Chehab		========================  ==========================
13*54a19b4dSMauro Carvalho Chehab		USB_CHARGER_UNKNOWN_TYPE  Charger type is unknown
14*54a19b4dSMauro Carvalho Chehab		USB_CHARGER_SDP_TYPE      Standard Downstream Port
15*54a19b4dSMauro Carvalho Chehab		USB_CHARGER_CDP_TYPE      Charging Downstream Port
16*54a19b4dSMauro Carvalho Chehab		USB_CHARGER_DCP_TYPE      Dedicated Charging Port
17*54a19b4dSMauro Carvalho Chehab		USB_CHARGER_ACA_TYPE      Accessory Charging Adapter
18*54a19b4dSMauro Carvalho Chehab		========================  ==========================
19*54a19b4dSMauro Carvalho Chehab
2088008266SPeter Chen		https://www.usb.org/document-library/battery-charging-v12-spec-and-adopters-agreement
2188008266SPeter Chen
22*54a19b4dSMauro Carvalho Chehab		Here are two examples taken using ``udevadm monitor -p`` when
23*54a19b4dSMauro Carvalho Chehab		USB charger is online::
24*54a19b4dSMauro Carvalho Chehab
2588008266SPeter Chen		    UDEV  change   /devices/soc0/usbphynop1 (platform)
2688008266SPeter Chen		    ACTION=change
2788008266SPeter Chen		    DEVPATH=/devices/soc0/usbphynop1
2888008266SPeter Chen		    DRIVER=usb_phy_generic
2988008266SPeter Chen		    MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
3088008266SPeter Chen		    OF_COMPATIBLE_0=usb-nop-xceiv
3188008266SPeter Chen		    OF_COMPATIBLE_N=1
3288008266SPeter Chen		    OF_FULLNAME=/usbphynop1
3388008266SPeter Chen		    OF_NAME=usbphynop1
3488008266SPeter Chen		    SEQNUM=2493
3588008266SPeter Chen		    SUBSYSTEM=platform
3688008266SPeter Chen		    USB_CHARGER_STATE=USB_CHARGER_PRESENT
3788008266SPeter Chen		    USB_CHARGER_TYPE=USB_CHARGER_SDP_TYPE
3888008266SPeter Chen		    USEC_INITIALIZED=227422826
3988008266SPeter Chen
40*54a19b4dSMauro Carvalho Chehab		USB charger is offline::
41*54a19b4dSMauro Carvalho Chehab
4288008266SPeter Chen		    KERNEL change   /devices/soc0/usbphynop1 (platform)
4388008266SPeter Chen		    ACTION=change
4488008266SPeter Chen		    DEVPATH=/devices/soc0/usbphynop1
4588008266SPeter Chen		    DRIVER=usb_phy_generic
4688008266SPeter Chen		    MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
4788008266SPeter Chen		    OF_COMPATIBLE_0=usb-nop-xceiv
4888008266SPeter Chen		    OF_COMPATIBLE_N=1
4988008266SPeter Chen		    OF_FULLNAME=/usbphynop1
5088008266SPeter Chen		    OF_NAME=usbphynop1
5188008266SPeter Chen		    SEQNUM=2494
5288008266SPeter Chen		    SUBSYSTEM=platform
5388008266SPeter Chen		    USB_CHARGER_STATE=USB_CHARGER_ABSENT
5488008266SPeter Chen		    USB_CHARGER_TYPE=USB_CHARGER_UNKNOWN_TYPE
55