usb: dwc_otg_310: hcd: fix isoc urb actual length
authorFeng Mingli <fml@rock-chips.com>
Wed, 12 Jul 2017 08:54:22 +0000 (16:54 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 13 Jul 2017 03:40:26 +0000 (11:40 +0800)
USB isochronous urb consists of some isoc frames, urb use iso_frame_desc
structure record actual_length, then device drivers always use this and
don't care urb actual_length. But in usb devio driver, processcompl()
function will process urb complete and copy data to user depend on urb
actual_length.

In dwc controller driver, update_isoc_urb_state() function will only
update isoc frames actual_length, urb actual_length will be 0. When use
usb devio driver, there is no data copy to user, so need update urb
actual_length at the same time.

TEST=use libusb to transport isochronous data

Change-Id: I1dc8e8d8c6609924626761525b98f41a739aeb65
Signed-off-by: Feng Mingli <fml@rock-chips.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
drivers/usb/dwc_otg_310/dwc_otg_hcd_intr.c

index 98271c7805e2d06f6ee8a7dd96861ca6d347b2a7..1d1046b65b2f5a146b192ecf12a31d02da5bf7c0 100755 (executable)
@@ -724,6 +724,7 @@ update_isoc_urb_state(dwc_otg_hcd_t *hcd,
                frame_desc->status = 0;
                frame_desc->actual_length =
                    get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL);
+               urb->actual_length += frame_desc->actual_length;
 
                /* non DWORD-aligned buffer case handling. */
                if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) {
@@ -752,6 +753,7 @@ update_isoc_urb_state(dwc_otg_hcd_t *hcd,
                frame_desc->status = -DWC_E_PROTOCOL;
                frame_desc->actual_length =
                    get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL);
+               urb->actual_length += frame_desc->actual_length;
 
                /* non DWORD-aligned buffer case handling. */
                if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) {