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

Commit 6a6f8be3 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: dwc3-msm: Don't schedule sm_work initially during probe



Currently driver schedules sm_work with no delay in probe and due to this,
sm_work doesn't wait for initial VBUS state notification and goes ahead
with USB block reset and USB initialization as VBUS is not set. This will
interfere with PMIC's charger detection.  Hence don't schedule sm_work in
probe as PMIC always notifies initial VBUS state. Also don't flush sm_work
for initial notification from PMIC during bootup. Otherwise VBUS state
doesn't get updated before sm_work starts executing.

Also set typec_current_max to zero during disconnect.

Change-Id: I89cde170debb43ca3198076fb47c7eef6789846d
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 0940fb6a
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@
#define DWC3_IDEV_CHG_MAX 1500
#define DWC3_HVDCP_CHG_MAX 1800

/* time out to wait for USB cable status notification (in ms)*/
#define SM_INIT_TIMEOUT 30000

/* AHB2PHY register offsets */
#define PERIPH_SS_AHB2PHY_TOP_CFG 0x10

@@ -2131,7 +2128,11 @@ static int dwc3_msm_resume(struct dwc3_msm *mdwc)
 */
static void dwc3_ext_event_notify(struct dwc3_msm *mdwc)
{
	/* Flush processing any pending events before handling new ones */
	/*
	 * Flush processing any pending events before handling new ones except
	 * for initial notification during bootup.
	 */
	if (mdwc->init)
		flush_delayed_work(&mdwc->sm_work);

	if (mdwc->id_state == DWC3_ID_FLOAT) {
@@ -2966,8 +2967,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	if (of_property_read_bool(node, "qcom,disable-dev-mode-pm"))
		pm_runtime_get_noresume(mdwc->dev);

	schedule_delayed_work(&mdwc->sm_work, 0);

	/* Update initial ID state */
	if (mdwc->pmic_id_irq) {
		enable_irq(mdwc->pmic_id_irq);
@@ -3512,6 +3511,7 @@ static void dwc3_otg_sm_work(struct work_struct *w)
				break;
			}
		} else {
			mdwc->typec_current_max = 0;
			dwc3_msm_gadget_vbus_draw(mdwc, 0);
			dev_dbg(mdwc->dev, "No device, allowing suspend\n");
		}