Skip to content

Commit 8d1ab20

Browse files
committed
usb: dwc3: gadget: fix tx fifos resize for disabled eps
If we put other gadget function before UVC, for example UAC and UVC, the ep1in will be assigned to UAC and ep2in/ep3in will be assigned to UVC. Under these circumstances, if we open UVC before UAC, ep1in tx fifo will not be resized and get wrong base address which leading to UVC and UAC can not be opened at the same time. This patch make all epin tx fifos resized whether it is enabled or not. For RV1126/RV1109, totol size of tx fifos is 0x51e(1310) and number of epin is 7 (Include ep0in). We can configured as UAC + RNDIS + UVC + ADB, followed by details of functions. | function | epin | xfer | mult | maxpacket | tx fifo | | - | 0 | ctl | - | - | 10 | | UAC | 1 | isoc | 2 | 200 | 53 | | RNDIS | 2 | int | 1 | 8 | 3 | | RNDIS | 3 | bulk | 3 | 512 | 196 | | UVC | 4 | int | 1 | 16 | 4 | | UVC | 5 | isoc | 6 | 1024 | 775 | | ADB | 6 | bulk | 3 | 512 | 196 | | totol | - | - | - | - | 1237 | Attention, the max_packetsize of UAC can be increased to 1024 to support multi-channel or high sampling depth. If we need all these four functions, we can set max_packetsize of UAC to (((1310 - 1237 + 53 ) * 8 - 8) / 2 - 8 = 492 Bytes at most, which can support 48K 16bits 5-channel audio source. Fixes: 256fb76 ("usb: dwc3: gadget: support to resize TxFIFOs dynamically") Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com> Change-Id: Ib2d3854bd305289c30ea85c447eca49af28b62fd
1 parent d5e8273 commit 8d1ab20

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/usb/dwc3/gadget.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ static int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
192192
int tmp;
193193

194194
if (!(dep->flags & DWC3_EP_ENABLED))
195-
continue;
196-
197-
if (usb_endpoint_xfer_bulk(dep->endpoint.desc))
195+
mult = 2;
196+
else if (usb_endpoint_xfer_bulk(dep->endpoint.desc))
198197
mult = 3;
199198
else if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
200199
mult = 6;

0 commit comments

Comments
 (0)