Skip to content

Commit 68b4a99

Browse files
committed
Updating dwc_otg driver to fix issue releasing pcm stream see: raspberrypi/firmware#51
1 parent 85b7821 commit 68b4a99

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "dwc_otg_hcd_if.h"
7171
#include "dwc_otg_dbg.h"
7272
#include "dwc_otg_driver.h"
73+
#include "dwc_otg_hcd.h"
7374

7475
/**
7576
* Gets the endpoint number from a _bEndpointAddress argument. The endpoint is
@@ -267,6 +268,7 @@ extern unsigned int g_dwc_otg_interrupt_counts[10];
267268
static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
268269
dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status)
269270
{
271+
uint64_t flags;
270272
struct urb *urb = (struct urb *)urb_handle;
271273

272274
#ifdef DEBUG_SOF_FIX
@@ -356,7 +358,9 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
356358
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
357359
usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb);
358360
#else
361+
DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
359362
usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb);
363+
DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);
360364
usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, status);
361365
#endif
362366
return 0;
@@ -767,6 +771,8 @@ static int urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
767771
static int urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
768772
#endif
769773
{
774+
int rc;
775+
uint64_t flags;
770776
dwc_otg_hcd_t *dwc_otg_hcd;
771777
DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue\n");
772778

@@ -788,8 +794,18 @@ static int urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
788794
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
789795
usb_hcd_giveback_urb(hcd, urb);
790796
#else
791-
usb_hcd_unlink_urb_from_ep(hcd, urb);
792-
usb_hcd_giveback_urb(hcd, urb, status);
797+
DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags);
798+
rc = usb_hcd_check_unlink_urb(hcd, urb, status);
799+
if(!rc)
800+
{
801+
usb_hcd_unlink_urb_from_ep(hcd, urb);
802+
}
803+
804+
DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags);
805+
if (!rc)
806+
{
807+
usb_hcd_giveback_urb(hcd, urb, status);
808+
}
793809
#endif
794810
if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) {
795811
DWC_PRINTF("Called usb_hcd_giveback_urb()\n");

0 commit comments

Comments
 (0)