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

Commit a986bde8 authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3: gadget: Return -EAGAIN from dwc_gadget_func_wakeup()



usb_func_ep_queue() performs remote wakeup if func is suspended or
bus is suspended. If usb is bus suspended, resuming and remote wakeup
is performed from work context, whereas in func suspended case it
performs function remote wakeup. usb_func_ep_queue() uses different
return value based on which context remote wakeup is performed, but
it doesn't suggest if request is queued or not. With this, function
driver doesn't know status of provided request. Hence return -EAGAIN
when remote wakeup is successfully performed but provided request is
not queued with dwc_gadget_func_wakeup() API.

CRs-Fixed: 1033093
Change-Id: If8eca2047a6cc85136969295a31a55ded9a849c6
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 50ae2e0d
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -1851,19 +1851,21 @@ static int dwc_gadget_func_wakeup(struct usb_gadget *g, int interface_id)
		return -EAGAIN;
		return -EAGAIN;
	}
	}


	if (dwc->revision < DWC3_REVISION_220A) {
	/*
		ret = dwc3_send_gadget_generic_command(dwc,
	 * Return -EAGAIN on sending function wakeup command successfully
			DWC3_DGCMD_XMIT_FUNCTION, interface_id);
	 * as function driver needs to wait for bus resume before queueing
	} else {
	 * any USB request. USB function driver which supports function
		ret = dwc3_send_gadget_generic_command(dwc,
	 * wakeup functionality should check return value and handle it.
			DWC3_DGCMD_XMIT_DEV, 0x1 | (interface_id << 4));
	 */
	ret = dwc3_send_gadget_generic_command(dwc, DWC3_DGCMD_XMIT_DEV,
			0x1 | (interface_id << 4));
	if (!ret) {
		pr_debug("Function wakeup HW command succeeded.\n");
		ret = -EAGAIN;
		return ret;
	}
	}


	if (ret)
	pr_err("Function wakeup HW command failed.\n");
	pr_err("Function wakeup HW command failed.\n");
	else
		pr_debug("Function wakeup HW command succeeded.\n");

	return ret;
	return ret;
}
}