Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7778c3b8 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: dwc3-msm: Fix USB connection issue after DCP charger disconnection



Commit "6e3630b5: usb: dwc3-msm: Support
external charging detection " has added check not to start charger
detection in case charger detection is done by external circuit. when otg
driver calls charger_detection API to set charger type to invalid as part
of VBUS disconnect handling, this check prevents to do that. This results
next charger detection not happening after DCP charger disconnection.
Hence fix the issue by moving down the check in the charger_detection API.

Change-Id: I5c614a208f22e4cd9f334c80dae6831bcff64ada
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent a260c9b2
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The 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
@@ -1240,11 +1240,6 @@ static void dwc3_start_chg_det(struct dwc3_charger *charger, bool start)
{
	struct dwc3_msm *mdwc = container_of(charger, struct dwc3_msm, charger);

	/* Skip if charger type was already detected externally */
	if (mdwc->chg_state == USB_CHG_STATE_DETECTED &&
		charger->chg_type != DWC3_INVALID_CHARGER)
		return;

	if (start == false) {
		dev_dbg(mdwc->dev, "canceling charging detection work\n");
		cancel_delayed_work_sync(&mdwc->chg_work);
@@ -1253,6 +1248,11 @@ static void dwc3_start_chg_det(struct dwc3_charger *charger, bool start)
		return;
	}

	/* Skip if charger type was already detected externally */
	if (mdwc->chg_state == USB_CHG_STATE_DETECTED &&
		charger->chg_type != DWC3_INVALID_CHARGER)
		return;

	mdwc->chg_state = USB_CHG_STATE_UNDEFINED;
	charger->chg_type = DWC3_INVALID_CHARGER;
	queue_delayed_work(system_nrt_wq, &mdwc->chg_work, 0);