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

Commit 29276cc4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Add support to LPM L1 remote wakeup for ep0 endpoints"

parents b806e9b3 43a7caa2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -985,6 +985,8 @@ struct dwc3 {
	unsigned                irq_event_count[MAX_INTR_STATS];
	unsigned                irq_dbg_index;

	unsigned long		l1_remote_wakeup_cnt;

	wait_queue_head_t	wait_linkstate;
	void			*dwc_ipc_log_ctxt;
};
+4 −1
Original line number Diff line number Diff line
@@ -1051,9 +1051,12 @@ static int dwc3_gadget_int_events_show(struct seq_file *s, void *unused)
		seq_printf(s, "%d\t", dwc->bh_completion_time[i]);
	seq_putc(s, '\n');

	seq_printf(s, "t_pwr evt irq : %lld\t",
	seq_printf(s, "t_pwr evt irq : %lld\n",
			ktime_to_us(dwc->t_pwr_evt_irq));

	seq_printf(s, "l1_remote_wakeup_cnt : %lu\n",
		dwc->l1_remote_wakeup_cnt);

	spin_unlock_irqrestore(&dwc->lock, flags);
	return 0;
}
+14 −0
Original line number Diff line number Diff line
@@ -224,6 +224,8 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
	unsigned long			flags;

	int				ret;
	enum dwc3_link_state		link_state;
	u32				reg;

	spin_lock_irqsave(&dwc->lock, flags);
	if (!dep->endpoint.desc) {
@@ -240,6 +242,18 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
		goto out;
	}

	/* if link stats is in L1 initiate  remote wakeup before queuing req */
	if (dwc->speed != DWC3_DSTS_SUPERSPEED) {
		link_state = dwc3_get_link_state(dwc);
		/* in HS this link state is same as L1 */
		if (link_state == DWC3_LINK_STATE_U2) {
			dwc->l1_remote_wakeup_cnt++;
			reg = dwc3_readl(dwc->regs, DWC3_DCTL);
			reg |= DWC3_DCTL_ULSTCHNG_RECOVERY;
			dwc3_writel(dwc->regs, DWC3_DCTL, reg);
		}
	}

	dwc3_trace(trace_dwc3_ep0,
			"queueing request %pK to %s length %d state '%s'",
			request, dep->name, request->length,
+0 −7
Original line number Diff line number Diff line
@@ -1416,13 +1416,6 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
	return 0;
}

static inline enum dwc3_link_state dwc3_get_link_state(struct dwc3 *dwc)
{
	u32 reg;
	reg = dwc3_readl(dwc->regs, DWC3_DSTS);
	return DWC3_DSTS_USBLNKST(reg);
}

static bool dwc3_gadget_is_suspended(struct dwc3 *dwc)
{
	if (atomic_read(&dwc->in_lpm) ||
+8 −0
Original line number Diff line number Diff line
@@ -84,6 +84,14 @@ static inline void dwc3_gadget_move_request_queued(struct dwc3_request *req)
	list_move_tail(&req->list, &dep->req_queued);
}

static inline enum dwc3_link_state dwc3_get_link_state(struct dwc3 *dwc)
{
	u32 reg;

	reg = dwc3_readl(dwc->regs, DWC3_DSTS);
	return DWC3_DSTS_USBLNKST(reg);
}

void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
		int status);