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

Commit 2f947357 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: msm_otg: Fail suspend if !BSV is under processing"

parents 2faa1954 b4adc4f6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -891,7 +891,7 @@ static int msm_otg_suspend(struct msm_otg *motg)
	struct msm_otg_platform_data *pdata = motg->pdata;
	int cnt = 0;
	bool host_bus_suspend, device_bus_suspend, dcp, prop_charger;
	bool floated_charger;
	bool floated_charger, sm_work_busy;
	u32 phy_ctrl_val = 0, cmd_val;
	unsigned ret;
	u32 portsc, config2;
@@ -915,6 +915,10 @@ static int msm_otg_suspend(struct msm_otg *motg)
	prop_charger = motg->chg_type == USB_PROPRIETARY_CHARGER;
	floated_charger = motg->chg_type == USB_FLOATED_CHARGER;

	/* !BSV, but its handling is in progress by otg sm_work */
	sm_work_busy = !test_bit(B_SESS_VLD, &motg->inputs) &&
			phy->state == OTG_STATE_B_PERIPHERAL;

	/* Enable line state difference wakeup fix for only device and host
	 * bus suspend scenarios.  Otherwise PHY can not be suspended when
	 * a charger that pulls DP/DM high is connected.
@@ -930,11 +934,12 @@ static int msm_otg_suspend(struct msm_otg *motg)
	 * Abort suspend when,
	 * 1. charging detection in progress due to cable plug-in
	 * 2. host mode activation in progress due to Micro-A cable insertion
	 * 3. !BSV, but its handling is in progress by otg sm_work
	 */

	if ((test_bit(B_SESS_VLD, &motg->inputs) && !device_bus_suspend &&
		!dcp && !prop_charger && !floated_charger) ||
		test_bit(A_BUS_REQ, &motg->inputs)) {
		test_bit(A_BUS_REQ, &motg->inputs) || sm_work_busy) {
		motg->ui_enabled = 1;
		enable_irq(motg->irq);
		return -EBUSY;