USB: msm_otg: Increase data contact detection timeout
Battery charging specification allows data contact detection (DCD) timeout to be any value between 300 and 900 msec. As DCD is reliably working, increase the timeout for detecting slow cable insertion cases. DCD would fail with ACA-dock and ACA-A + HS/FS device. Use 750 msec as timeout. The 150 msec (900 - 750) safe guard time compensates the time taken from session valid to DCD enable. Decrese the DCD polling period from 100 msec to 50 msec to exit DCD state quickly. The 150 msec safe guard time compensates the time taken from session valid to starting charger detection procedure. CRs-Fixed: 437484 (cherry picked from commit ebb4a2d613128a2db288402bc834622a36e71956) Conflicts: drivers/usb/otg/msm_otg.c Change-Id: I0e014d2ae0f9e00eaba179af2244924cf4561c90 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
a958facd3d
commit
7b4715f931
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2009-2013, Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
@@ -2045,8 +2045,8 @@ static void msm_ta_detect_work(struct work_struct *w)
|
||||
schedule_delayed_work(&motg->check_ta_work, MSM_CHECK_TA_DELAY);
|
||||
}
|
||||
|
||||
#define MSM_CHG_DCD_POLL_TIME (100 * HZ/1000) /* 100 msec */
|
||||
#define MSM_CHG_DCD_MAX_RETRIES 6 /* Tdcd_tmout = 6 * 100 msec */
|
||||
#define MSM_CHG_DCD_TIMEOUT (750 * HZ/1000) /* 750 msec */
|
||||
#define MSM_CHG_DCD_POLL_TIME (50 * HZ/1000) /* 50 msec */
|
||||
#define MSM_CHG_PRIMARY_DET_TIME (50 * HZ/1000) /* TVDPSRC_ON */
|
||||
#define MSM_CHG_SECONDARY_DET_TIME (50 * HZ/1000) /* TVDMSRC_ON */
|
||||
static void msm_chg_detect_work(struct work_struct *w)
|
||||
@@ -2070,7 +2070,7 @@ static void msm_chg_detect_work(struct work_struct *w)
|
||||
msm_chg_enable_dcd(motg);
|
||||
msm_chg_enable_aca_det(motg);
|
||||
motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
|
||||
motg->dcd_retries = 0;
|
||||
motg->dcd_time = 0;
|
||||
delay = MSM_CHG_DCD_POLL_TIME;
|
||||
break;
|
||||
case USB_CHG_STATE_WAIT_FOR_DCD:
|
||||
@@ -2102,7 +2102,8 @@ static void msm_chg_detect_work(struct work_struct *w)
|
||||
}
|
||||
}
|
||||
is_dcd = msm_chg_check_dcd(motg);
|
||||
tmout = ++motg->dcd_retries == MSM_CHG_DCD_MAX_RETRIES;
|
||||
motg->dcd_time += MSM_CHG_DCD_POLL_TIME;
|
||||
tmout = motg->dcd_time >= MSM_CHG_DCD_TIMEOUT;
|
||||
if (is_dcd || tmout) {
|
||||
msm_chg_disable_dcd(motg);
|
||||
msm_chg_enable_primary_det(motg);
|
||||
|
||||
@@ -331,7 +331,7 @@ struct msm_otg {
|
||||
struct delayed_work check_ta_work;
|
||||
enum usb_chg_state chg_state;
|
||||
enum usb_chg_type chg_type;
|
||||
u8 dcd_retries;
|
||||
unsigned dcd_time;
|
||||
struct wake_lock wlock;
|
||||
struct notifier_block usbdev_nb;
|
||||
unsigned mA_port;
|
||||
|
||||
Reference in New Issue
Block a user