usb: common: usb-conn-gpio: Register charger
authorPaul Cercueil <paul@crapouillou.net>
Mon, 27 Jul 2020 17:04:13 +0000 (19:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jul 2020 06:45:24 +0000 (08:45 +0200)
commite3ee0e740c3887d2293e8d54a8707218d70d86ca
tree558839c547809d321ecf7a781eec68b9394b62ec
parentab4dc051d7b39ce31dd7a7c1d7c64fef69178050
usb: common: usb-conn-gpio: Register charger

Register a power supply charger, whose online state depends on whether
the USB role is set to device or not.

This is useful when the USB role is the only way to know if the device
is charging from USB. The API is the standard power supply charger API,
you get a /sys/class/power_supply/xxx/online node which tells you the
state of the charger.

The sole purpose of this is to give userspace applications a way to
know whether or not the charger is plugged.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20200727170413.23131-1-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/common/Kconfig
drivers/usb/common/usb-conn-gpio.c