diff options
author | Li Jun <B47624@freescale.com> | 2014-03-12 22:08:00 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:57:56 -0400 |
commit | e780694aa6cc357f35d9651f158dfdc205815bcf (patch) | |
tree | 84868c2a32b426a9e2f7652a6e186ba2a20545ff /drivers/power | |
parent | eb5685a252b27c38505bd91ed6c5d9ed59558dd4 (diff) |
ENGR00302247 usb: charger: use stable plug contact in charger detection
- Background:
When a USB plug is inserted, the pins are staggered such that the ground
and VBUS pins make first, followed by the D+/D- pins. The detection of
the VBUS eventually results in the usb_charger_detect() being called
in order to further identify the type of USB port the product is being
tied to. USB 2.0 and the Battery Charging 1.1 specs define how this
detection is to be done. The problem with current dirver is that it
does not allow the D+/D- detection circuit to settle to a stable state
prior to checking to see if there is a valid result. Instead, the for
loop breaks on the first iteration due to a false indication of contact.
The code then looks to see what kind of device is actually out there,
and if the D+/D- pins still have not made contact, it comes to the
potentially erroneous conclusion that it is an SDP.
- Solution:
This patch use a successive check to make sure the contact is reliable.
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/imx6_usb_charger.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/imx6_usb_charger.c b/drivers/power/imx6_usb_charger.c index 81a8064f1362..cf7e438cb19c 100644 --- a/drivers/power/imx6_usb_charger.c +++ b/drivers/power/imx6_usb_charger.c | |||
@@ -121,7 +121,10 @@ static int imx6_usb_charger_detect(struct usb_charger *charger) | |||
121 | if (data_pin_contact_count++ > 5) | 121 | if (data_pin_contact_count++ > 5) |
122 | /* Data pin makes contact */ | 122 | /* Data pin makes contact */ |
123 | break; | 123 | break; |
124 | else | ||
125 | usleep_range(5000, 10000); | ||
124 | } else { | 126 | } else { |
127 | data_pin_contact_count = 0; | ||
125 | msleep(20); | 128 | msleep(20); |
126 | } | 129 | } |
127 | } | 130 | } |