UPSTREAM: usb: dwc3: gadget: Give some time to schedule isoc

Currently the driver will schedule isoc transfers immediately on the
next interval, which is quite aggressive when the interval is 125us.
There's report that some platforms may need more time to process the
transfer, otherwise the controller may miss the first interval. Let's
keep it simple and give the controller at least 500us to schedule the
isoc transfer.

Link: https://lore.kernel.org/linux-usb/20220302143539.GI11577@pengutronix.de/
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/deb8146b8e1f7f8495ef2d5647017270934cb2d8.1646708142.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 229140375
(cherry picked from commit aa6812be1feb75139b9bc263915b3f1ceeb4e154)
Signed-off-by: Dan Vacura <w36195@motorola.com>
Change-Id: I3bbf5abfdb249fb9a10c664f11d4f3b682ceafd1
This commit is contained in:
Thinh Nguyen
2022-03-07 18:59:56 -08:00
committed by Dan Vacura
parent 5d084e9710
commit 1c14550b60

View File

@@ -1805,7 +1805,13 @@ static int __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
}
for (i = 0; i < DWC3_ISOC_MAX_RETRIES; i++) {
dep->frame_number = DWC3_ALIGN_FRAME(dep, i + 1);
int future_interval = i + 1;
/* Give the controller at least 500us to schedule transfers */
if (desc->bInterval < 3)
future_interval += 3 - desc->bInterval;
dep->frame_number = DWC3_ALIGN_FRAME(dep, future_interval);
ret = __dwc3_gadget_kick_transfer(dep);
if (ret != -EAGAIN)