OSDN Git Service

usb: phy: Add USB charger support
authorBaolin Wang <baolin.wang@linaro.org>
Tue, 15 Aug 2017 11:07:54 +0000 (19:07 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 15 Aug 2017 12:05:01 +0000 (15:05 +0300)
commita9081a008f84819ab2f3da596bf89afa16beea94
tree8ab66396b7c73b1a75275a3b86d30f67a0fcbfba
parent44dd8a989c787e9077745417140aa132bfe45bf5
usb: phy: Add USB charger support

This patch introduces the usb charger support based on usb phy that
makes an enhancement to a power driver. The basic conception of the
usb charger is that, when one usb charger is added or removed by
reporting from the extcon device state change, the usb charger will
report to power user to set the current limitation.

Power user can register a notifiee on the usb phy by issuing
usb_register_notifier() to get notified by charger status changes
or charger current changes.

we can notify what current to be drawn to power user according to
different charger type, and now we have 2 methods to get charger type.
One is get charger type from extcon subsystem, which also means the
charger state changes. Another is we can get the charger type from
USB controller detecting or PMIC detecting, and the charger state
changes should be told by issuing usb_phy_set_charger_state().

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy.c
include/linux/usb/phy.h