power: supply: axp20x_usb_power: use polling to detect vbus status change
authorChen-Yu Tsai <wens@csie.org>
Tue, 16 Apr 2019 06:40:20 +0000 (14:40 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 17 Apr 2019 21:23:15 +0000 (23:23 +0200)
commit97ec136e7124fa12cf56ce706993e747c5f99a20
treec096b1f1e1fd428022ebaa90c6e856ae33cb59f7
parentc11f0b8f226a411915f8d7467bd554a8c9ceec42
power: supply: axp20x_usb_power: use polling to detect vbus status change

On AXP221 and later AXP PMICs that have the N_VBUSEN pin, when this pin
is high, either due to the PMIC driving it high or as an input, the VBUS
detection related interrupt mechanisms are disabled.

Previously this was worked around in the phy-sun4i-usb driver, which
needed to sense VBUS changes and report them to the musb driver in a
timely matter. However this workaround was only for the A31 and A33 type
USB PHYs. To support newer platforms we would have to enable it for
almost all the post-A31 SoCs.

However, since this is actually the result of the PMIC's behavior, the
workaround would be better if done in the PMIC driver, in this case the
VBUS power supply driver.

Add the same workqueue-based polling to the VBUS power supply driver.
The polling interval is chosen to be the debounce interval from the USB
PHY driver, as this short interval is needed in some cases, but the
power supply driver would not know when.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/axp20x_usb_power.c