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

Commit 590aaf42 authored by Vamsi Krishna Samavedam's avatar Vamsi Krishna Samavedam
Browse files

usb: dwc3: Enable l1_suspend_n signal for host mode



L1 suspend enables the PHY's utmi clock to be powered
off during L1 suspend which can save power during
audio playback using usb audio headphones

Change-Id: I9711ed625df119c48f4edddb8d1a0e48315e037b
Signed-off-by: default avatarVamsi Krishna Samavedam <vskrishn@codeaurora.org>
parent 91083098
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -132,6 +132,27 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode)
	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
}

void dwc3_en_sleep_mode(struct dwc3 *dwc)
{
	u32 reg;

	if (dwc->dis_enblslpm_quirk)
		return;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
	reg |= DWC3_GUSB2PHYCFG_ENBLSLPM;
	dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

void dwc3_dis_sleep_mode(struct dwc3 *dwc)
{
	u32 reg;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
	reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
	dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
{
	unsigned long flags;
+2 −0
Original line number Diff line number Diff line
@@ -1322,6 +1322,8 @@ struct dwc3_gadget_ep_cmd_params {

/* prototypes */
void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode);
void dwc3_en_sleep_mode(struct dwc3 *dwc);
void dwc3_dis_sleep_mode(struct dwc3 *dwc);
void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type);

+3 −2
Original line number Diff line number Diff line
@@ -2468,8 +2468,7 @@ static int dwc3_msm_resume(struct dwc3_msm *mdwc)
	/* Disable HSPHY auto suspend */
	dwc3_msm_write_reg(mdwc->base, DWC3_GUSB2PHYCFG(0),
		dwc3_msm_read_reg(mdwc->base, DWC3_GUSB2PHYCFG(0)) &
				~(DWC3_GUSB2PHYCFG_ENBLSLPM |
					DWC3_GUSB2PHYCFG_SUSPHY));
				~DWC3_GUSB2PHYCFG_SUSPHY);

	/* Disable wakeup capable for HS_PHY IRQ & SS_PHY_IRQ if enabled */
	if (mdwc->lpm_flags & MDWC3_ASYNC_IRQ_WAKE_CAPABILITY) {
@@ -3664,6 +3663,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		usb_register_notify(&mdwc->host_nb);

		dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
		dwc3_en_sleep_mode(dwc);
		mdwc->usbdev_nb.notifier_call = msm_dwc3_usbdev_notify;
		usb_register_atomic_notify(&mdwc->usbdev_nb);
		ret = dwc3_host_init(dwc);
@@ -3791,6 +3791,7 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on)
		 */
		dwc3_msm_block_reset(mdwc, false);
		dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
		dwc3_dis_sleep_mode(dwc);
		mdwc->in_device_mode = true;
		usb_gadget_vbus_connect(&dwc->gadget);
#ifdef CONFIG_SMP