Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7ada7c7 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: dwc3: Request dwc3 irq in driver probe



request_irq() for dwc irq is called in dwc3_gadget_start()
when msm-dwc3 is in suspended state because usb cable is not
connected. dwc3 resume happens upon USB connect, enables
already enabled irq. This result into unbalanced enable irq
warning. Fix this by moving request_irq to dwc3_probe().

CRs-Fixed: 999124
Change-Id: I61ec085778fe43b87de18a84829ea3f5280c451c
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent b7a0d4a6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -777,6 +777,7 @@ static int dwc3_probe(struct platform_device *pdev)
	u8			lpm_nyet_threshold;
	u8			hird_threshold;
	u32			num_evt_buffs;
	int			irq;

	int			ret;

@@ -802,6 +803,17 @@ static int dwc3_probe(struct platform_device *pdev)
	dwc->xhci_resources[1].flags = res->flags;
	dwc->xhci_resources[1].name = res->name;

	irq = platform_get_irq(to_platform_device(dwc->dev), 0);
	ret = devm_request_irq(dev, irq, dwc3_interrupt, IRQF_SHARED, "dwc3",
			dwc);
	if (ret) {
		dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
				irq, ret);
		return -ENODEV;
	}

	dwc->irq = irq;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		dev_err(dev, "missing memory resource\n");
+3 −18
Original line number Diff line number Diff line
@@ -2020,7 +2020,6 @@ void dwc3_gadget_disable_irq(struct dwc3 *dwc)
	dwc3_writel(dwc->regs, DWC3_DEVTEN, 0x00);
}

static irqreturn_t dwc3_interrupt(int irq, void *_dwc);
static irqreturn_t dwc3_thread_interrupt(int irq, void *_dwc);
static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc);

@@ -2170,18 +2169,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
	struct dwc3		*dwc = gadget_to_dwc(g);
	unsigned long		flags;
	int			ret = 0;
	int			irq;

	irq = platform_get_irq(to_platform_device(dwc->dev), 0);
	dwc->irq = irq;
	ret = request_irq(irq, dwc3_interrupt, IRQF_SHARED, "dwc3", dwc);
	if (ret) {
		dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
				irq, ret);
		goto err0;
	}

	dwc->irq = irq;
	g->interrupt_num = dwc->irq;
	spin_lock_irqsave(&dwc->lock, flags);

@@ -2190,7 +2178,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
				dwc->gadget.name,
				dwc->gadget_driver->driver.name);
		ret = -EBUSY;
		goto err1;
		goto err0;
	}

	dwc->gadget_driver	= driver;
@@ -2204,11 +2192,8 @@ static int dwc3_gadget_start(struct usb_gadget *g,
	spin_unlock_irqrestore(&dwc->lock, flags);
	return 0;

err1:
	spin_unlock_irqrestore(&dwc->lock, flags);
	free_irq(irq, dwc);

err0:
	spin_unlock_irqrestore(&dwc->lock, flags);
	return ret;
}

@@ -3572,7 +3557,7 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3 *dwc, u32 buf)
	return IRQ_WAKE_THREAD;
}

static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
irqreturn_t dwc3_interrupt(int irq, void *_dwc)
{
	struct dwc3			*dwc = _dwc;
	int				i;
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
		gfp_t gfp_flags);
int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol);
void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force);
irqreturn_t dwc3_interrupt(int irq, void *_dwc);

static inline dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,
		struct dwc3_trb *trb)