Re: [PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

From: Felipe Balbi
Date: Mon Jan 28 2013 - 07:12:57 EST


Hi,

On Mon, Jan 28, 2013 at 05:28:30PM +0530, Vivek Gautam wrote:
> >> +static int dwc3_exynos_runtime_resume(struct device *dev)
> >> +{
> >> + struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> >> + struct platform_device *pdev_dwc = exynos->dwc3;
> >> + struct dwc3 *dwc = NULL;
> >> +
> >> + dwc = platform_get_drvdata(pdev_dwc);
> >> +
> >> + clk_enable(exynos->clk);
> >> +
> >> + if (!dwc)
> >> + return 0;
> >> +
> >> + pm_runtime_get_sync(dwc->usb3_phy->dev);
> >
> > dude, this is wrong :-)
> >
> > look at this:
> >
> > pm_runtime_get() -> dwc3_exynos_runtime_resume() ->
> > pm_runtime_get_sync() -> dwc3_exynos_runtime_resume() -> ...
> >
> > only your clock enalbe should do
> >
>
> We want to wake up "dwc->usb3_phy" so tried to call pm_runtime_get_sync()
> with "dwc->usb3_phy->dev".
> Missing something ? :-(

oh, my bad. That's the PHY... But we can't really do that for samsung
only. It needs to be done generically for the entire dwc3 core driver,
and for that we need to introduce usb_phy_autopm_get(),
usb_phy_autopm_get_sync() and friends.

Then, from dwc_probe() we call:

phy = usb_get_phy();
usb_phy_autopm_enable(phy);
usb_phy_autopm_get_sync(phy);

or something similar ;-) Bottom line, you shouldn't fiddle with phy->dev
directly.

--
balbi

Attachment: signature.asc
Description: Digital signature