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

Commit 71bbdae0 authored by Arumuga Durai A's avatar Arumuga Durai A
Browse files

USB: phy: Fix clearing of Vbus based ID clear on bootup



Some platform devices like smart audio platform devices should be
enumerated as USB HOST if there is no usb_vbus on bootup. Since the
ID state marked as FLOAT on bootup device fails to enumerate as
USB HOST also, usb role switch/swap fails when do multiple connect and
disconnect of usb cable even PMI notifies removal of usb_vbus. Fix this
by setting ID state as GROUND and clear USB_ID if there is no usb_vbus
on bootup and also, as we cleared USB_ID on removal of vbus avoid
checking for ID GROUND this fix usb role swap failure on multiple
connect/disconnect.

CRs-Fixed: 2058197
Change-Id: I327a82215ab770142d69ee34de8d3e0d0f25c09a
Signed-off-by: default avatarArumuga Durai A <cadurai@codeaurora.org>
parent c7402fa4
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3047,7 +3047,8 @@ static void msm_otg_set_vbus_state(int online)
	}

	/* do not queue state m/c work if id is grounded */
	if (!test_bit(ID, &motg->inputs)) {
	if (!test_bit(ID, &motg->inputs) &&
		!motg->pdata->vbus_low_as_hostmode) {
		/*
		 * state machine work waits for initial VBUS
		 * completion in UNDEFINED state.  Process
@@ -3066,6 +3067,12 @@ static void msm_otg_set_vbus_state(int online)
					init, motg->inputs);
			goto out;
		}

		if (motg->pdata->vbus_low_as_hostmode &&
			!test_bit(B_SESS_VLD, &motg->inputs)) {
			motg->id_state = USB_ID_GROUND;
			clear_bit(ID, &motg->inputs);
		}
		complete(&pmic_vbus_init);
		pr_debug("PMIC: BSV init complete\n");
		msm_otg_dbg_log_event(&motg->phy, "PMIC: BSV INIT COMPLETE",
@@ -3094,7 +3101,6 @@ out:
	if (motg->pdata->vbus_low_as_hostmode) {
		if (!test_bit(B_SESS_VLD, &motg->inputs)) {
			clear_bit(ID, &motg->inputs);
			init = false;
		} else {
			set_bit(ID, &motg->inputs);
		}