qcom: smb-lib: rerun APSD on insertion for micro USB mode

In case of very slow insertion of SDP/DCP there is a possibility
that D+/D- makes contact while APSD is in progress. This will
result in an incorrect type detection.
Fix this by doing a APSD rerun after charger-type detection is
complete.

CRs-Fixed: 2032590
Change-Id: I0037b90f29dbe65a2cdb2771d5caceff77862f03
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
This commit is contained in:
Ashay Jaiswal 2017-04-14 09:42:32 +05:30
parent 9b3e8a81dc
commit dabce32c24
2 changed files with 14 additions and 0 deletions

View file

@ -685,6 +685,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
chg->voltage_max_uv = MICRO_5V;
chg->usb_icl_delta_ua = 0;
chg->pulse_cnt = 0;
chg->uusb_apsd_rerun_done = false;
/* clear USB ICL vote for USB_PSY_VOTER */
rc = vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);
@ -752,6 +753,7 @@ int smblib_rerun_apsd_if_required(struct smb_charger *chg)
rc);
}
chg->uusb_apsd_rerun_done = true;
smblib_rerun_apsd(chg);
return 0;
@ -3482,6 +3484,17 @@ irqreturn_t smblib_handle_usb_source_change(int irq, void *data)
}
smblib_dbg(chg, PR_REGISTER, "APSD_STATUS = 0x%02x\n", stat);
if (chg->micro_usb_mode && (stat & APSD_DTC_STATUS_DONE_BIT)
&& !chg->uusb_apsd_rerun_done) {
/*
* Force re-run APSD to handle slow insertion related
* charger-mis-detection.
*/
chg->uusb_apsd_rerun_done = true;
smblib_rerun_apsd(chg);
return IRQ_HANDLED;
}
smblib_handle_apsd_done(chg,
(bool)(stat & APSD_DTC_STATUS_DONE_BIT));

View file

@ -312,6 +312,7 @@ struct smb_charger {
int vconn_attempts;
int default_icl_ua;
int otg_cl_ua;
bool uusb_apsd_rerun_done;
/* workaround flag */
u32 wa_flags;