phy: cpcap-usb: Improve host vs docked mode detection
authorTony Lindgren <tony@atomide.com>
Sun, 22 Dec 2019 18:17:03 +0000 (10:17 -0800)
committerKishon Vijay Abraham I <kishon@ti.com>
Thu, 26 Dec 2019 10:57:53 +0000 (16:27 +0530)
commit9492535ecd9b6df89e483ddd05740b3f3d547600
tree9536fdea98bc689dc7b2345be6a79afce09de139
parent63078b6ba09e842f09df052c5728857389fddcd2
phy: cpcap-usb: Improve host vs docked mode detection

When docked to a Motorola lapdock or media dock, we're in USB A-host mode
with VBUS provided by the dock. When in regular USB A-host mode, we're
providing the VBUS. And in regular USB A-host mode we must also keep
kicking the VBUS to keep it active.

Let's wait a bit before configuring the USB PHY to allow some time between
the ID and VBUS changes. And let's add vbus_provider flag so we can detect
docked mode and regularo USB A-host mode better.

With better USB A-host mode detection, we can now also just kick the
VBUS to keep it enabled and leave out the unnecessary line muxing.

We only need to set and clear vbus_provider in the delayed work so no
locking is needed for it currently.

Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/motorola/phy-cpcap-usb.c