power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce
authorCarl Philipp Klemm <philipp@uvos.xyz>
Sun, 17 Jan 2021 21:48:53 +0000 (22:48 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 5 Apr 2021 08:22:18 +0000 (10:22 +0200)
commit751faedf06e895a17e985a88ef5b6364ffd797ed
tree30142b99c9a5e4cd61f4f3d43a88b949ac859703
parent8a5a0cc13aa927eac7a9eb3ca82dfc1f82cfc28d
power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce

Adds 80000 us sleep when the usb cable is plugged in to hopefully avoid
bouncing contacts.

Upon pluging in the usb cable vbus will bounce for some time, causing cpcap to
dissconnect charging due to detecting an undervoltage condition. This is a
scope of vbus on xt894 while quickly inserting the usb cable with firm force,
probed at the far side of the usb socket and vbus loaded with approx 1k:
http://uvos.xyz/maserati/usbplug.jpg.

As can clearly be seen, vbus is all over the place for the first 15 ms or so
with a small blip at ~40 ms this causes the cpcap to trip up and disable
charging again.

The delay helps cpcap_usb_detect avoid the worst of this. It is, however, still
not ideal as strong vibrations can cause the issue to reapear any time during
charging. I have however not been able to cause the device to stop charging due
to this in practice as it is hard to vibrate the device such that the vbus pins
start bouncing again but cpcap_usb_detect is not called again due to a detected
disconnect/reconnect event.

Signed-off-by: Carl Philipp Klemm <philipp@uvos.xyz>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/cpcap-charger.c