Re: [PATCH] usb: dwc3: gadget: Fix starting microframe for ISOC

2017-03-10 Thread Felipe Balbi
John Youn  writes:

> The gadget wants to set the starting microframe for the first ISOC TRB
> to 4 microframes in the future, but it does so by multiplying the
> dep->interval. This only works if dep->interval = 1. For other intervals
> it will put it 4 *intervals* in the future which may be way too much.
>
> Fix so that it always adds just one interval or at least 4 microframes.
>
> Signed-off-by: John Youn 

I'll apply this since it makes the code do what it intended, however we
might have to revisit Isoc scheduling again in the future. The way it
is, we can always miss frames and driver doesn't currently know what to
do.

-- 
balbi


signature.asc
Description: PGP signature


[PATCH] usb: dwc3: gadget: Fix starting microframe for ISOC

2017-01-26 Thread John Youn
The gadget wants to set the starting microframe for the first ISOC TRB
to 4 microframes in the future, but it does so by multiplying the
dep->interval. This only works if dep->interval = 1. For other intervals
it will put it 4 *intervals* in the future which may be way too much.

Fix so that it always adds just one interval or at least 4 microframes.

Signed-off-by: John Youn 
---
 drivers/usb/dwc3/gadget.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4db97ecae885..1431bc0886fe 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1171,8 +1171,11 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
return;
}
 
-   /* 4 micro frames in the future */
-   uf = cur_uf + dep->interval * 4;
+   /*
+* Schedule the first trb for one interval in the future or at
+* least 4 microframes.
+*/
+   uf = cur_uf + max_t(u32, 4, dep->interval);
 
__dwc3_gadget_kick_transfer(dep, uf);
 }
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html