Skip to content

Commit 94f93e9

Browse files
P33Mpopcornmix
authored andcommitted
dwc_otg: Return full-speed frame numbers in HS mode
The frame counter increments on every *microframe* in high-speed mode. Most device drivers expect this number to be in full-speed frames - this caused considerable confusion to e.g. snd_usb_audio which uses the frame counter to estimate the number of samples played.
1 parent e3fb550 commit 94f93e9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,13 @@ void hcd_stop(struct usb_hcd *hcd)
626626
/** Returns the current frame number. */
627627
static int get_frame_number(struct usb_hcd *hcd)
628628
{
629+
hprt0_data_t hprt0;
629630
dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd);
630-
631-
return dwc_otg_hcd_get_frame_number(dwc_otg_hcd);
631+
hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0);
632+
if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED)
633+
return dwc_otg_hcd_get_frame_number(dwc_otg_hcd) >> 3;
634+
else
635+
return dwc_otg_hcd_get_frame_number(dwc_otg_hcd);
632636
}
633637

634638
#ifdef DEBUG

0 commit comments

Comments
 (0)