Message ID | 1359373348-18320-3-git-send-email-gautam.vivek@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 28, 2013 at 05:12:26PM +0530, Vivek Gautam wrote: > The current code in the dwc3 probe effectively disables runtime pm > from ever working because it calls a get() that was never put() until > device removal. Change the runtime pm code to match the standard > formula and allow runtime pm to function. > > Note that this doesn't enable full runtime pm on the DWC3 device in > that the port isn't put into a lower power mode when not used. > However it does allow users of dwc3 (like dwc3-exynos) to do some > amount of runtime power management. > > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> > Signed-off-by: Doug Anderson <dianders@chromium.org> > --- > drivers/usb/dwc3/core.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 3a4004a..59c2494 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev) > if (of_get_property(node, "tx-fifo-resize", NULL)) > dwc->needs_fifo_resize = true; > > + pm_runtime_set_active(dev); this usage of pm_runtime_set_active() actually makes me a bit scared. At least OMAP starts with the device switched off, so this will probably break OMAP at least. OTOH, calling ->runtime_resume() during probe() might not make that much sense after all, but the way OMAP is implemented, we won't get clocks turned on if this ->runtime_resume() method isn't called. /me starts to wonder whether OMAP implementation is flakey and what should be done here...
Hi Felipe, On Mon, Jan 28, 2013 at 5:15 PM, Felipe Balbi <balbi@ti.com> wrote: > On Mon, Jan 28, 2013 at 05:12:26PM +0530, Vivek Gautam wrote: >> The current code in the dwc3 probe effectively disables runtime pm >> from ever working because it calls a get() that was never put() until >> device removal. Change the runtime pm code to match the standard >> formula and allow runtime pm to function. >> >> Note that this doesn't enable full runtime pm on the DWC3 device in >> that the port isn't put into a lower power mode when not used. >> However it does allow users of dwc3 (like dwc3-exynos) to do some >> amount of runtime power management. >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> >> Signed-off-by: Doug Anderson <dianders@chromium.org> >> --- >> drivers/usb/dwc3/core.c | 4 +++- >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >> index 3a4004a..59c2494 100644 >> --- a/drivers/usb/dwc3/core.c >> +++ b/drivers/usb/dwc3/core.c >> @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev) >> if (of_get_property(node, "tx-fifo-resize", NULL)) >> dwc->needs_fifo_resize = true; >> >> + pm_runtime_set_active(dev); > > this usage of pm_runtime_set_active() actually makes me a bit scared. At > least OMAP starts with the device switched off, so this will probably > break OMAP at least. I am fine with dropping pm_runtime_set_active(), actually thought to put device in active state so that as and when system finds it idle, force into suspend state. I fact should i drop pm_runtime_set_active() calls from other places too (xhci-plat, dwc3-exynos, and samsung-usb3 phy) and call get_sync() alongwith enable() ? > OTOH, calling ->runtime_resume() during probe() > might not make that much sense after all, but the way OMAP is > implemented, we won't get clocks turned on if this ->runtime_resume() > method isn't called. > > /me starts to wonder whether OMAP implementation is flakey and what > should be done here... >
Hi, sorry for the delay On Mon, Jan 28, 2013 at 07:06:56PM +0530, Vivek Gautam wrote: > Hi Felipe, > > > On Mon, Jan 28, 2013 at 5:15 PM, Felipe Balbi <balbi@ti.com> wrote: > > On Mon, Jan 28, 2013 at 05:12:26PM +0530, Vivek Gautam wrote: > >> The current code in the dwc3 probe effectively disables runtime pm > >> from ever working because it calls a get() that was never put() until > >> device removal. Change the runtime pm code to match the standard > >> formula and allow runtime pm to function. > >> > >> Note that this doesn't enable full runtime pm on the DWC3 device in > >> that the port isn't put into a lower power mode when not used. > >> However it does allow users of dwc3 (like dwc3-exynos) to do some > >> amount of runtime power management. > >> > >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> > >> Signed-off-by: Doug Anderson <dianders@chromium.org> > >> --- > >> drivers/usb/dwc3/core.c | 4 +++- > >> 1 files changed, 3 insertions(+), 1 deletions(-) > >> > >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > >> index 3a4004a..59c2494 100644 > >> --- a/drivers/usb/dwc3/core.c > >> +++ b/drivers/usb/dwc3/core.c > >> @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev) > >> if (of_get_property(node, "tx-fifo-resize", NULL)) > >> dwc->needs_fifo_resize = true; > >> > >> + pm_runtime_set_active(dev); > > > > this usage of pm_runtime_set_active() actually makes me a bit scared. At > > least OMAP starts with the device switched off, so this will probably > > break OMAP at least. > > I am fine with dropping pm_runtime_set_active(), actually thought > to put device in active state so that as and when system finds it idle, > force into suspend state. > > I fact should i drop pm_runtime_set_active() calls from other places too > (xhci-plat, dwc3-exynos, and samsung-usb3 phy) and call get_sync() alongwith > enable() ? that's correct, make sure it works fine for you ;-)
Hi Felipe, On Wed, Feb 27, 2013 at 1:36 PM, Felipe Balbi <balbi@ti.com> wrote: > Hi, > > sorry for the delay > That's alright ;-) > On Mon, Jan 28, 2013 at 07:06:56PM +0530, Vivek Gautam wrote: >> Hi Felipe, >> >> >> On Mon, Jan 28, 2013 at 5:15 PM, Felipe Balbi <balbi@ti.com> wrote: >> > On Mon, Jan 28, 2013 at 05:12:26PM +0530, Vivek Gautam wrote: >> >> The current code in the dwc3 probe effectively disables runtime pm >> >> from ever working because it calls a get() that was never put() until >> >> device removal. Change the runtime pm code to match the standard >> >> formula and allow runtime pm to function. >> >> >> >> Note that this doesn't enable full runtime pm on the DWC3 device in >> >> that the port isn't put into a lower power mode when not used. >> >> However it does allow users of dwc3 (like dwc3-exynos) to do some >> >> amount of runtime power management. >> >> >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> >> >> Signed-off-by: Doug Anderson <dianders@chromium.org> >> >> --- >> >> drivers/usb/dwc3/core.c | 4 +++- >> >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >> >> index 3a4004a..59c2494 100644 >> >> --- a/drivers/usb/dwc3/core.c >> >> +++ b/drivers/usb/dwc3/core.c >> >> @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev) >> >> if (of_get_property(node, "tx-fifo-resize", NULL)) >> >> dwc->needs_fifo_resize = true; >> >> >> >> + pm_runtime_set_active(dev); >> > >> > this usage of pm_runtime_set_active() actually makes me a bit scared. At >> > least OMAP starts with the device switched off, so this will probably >> > break OMAP at least. >> >> I am fine with dropping pm_runtime_set_active(), actually thought >> to put device in active state so that as and when system finds it idle, >> force into suspend state. >> >> I fact should i drop pm_runtime_set_active() calls from other places too >> (xhci-plat, dwc3-exynos, and samsung-usb3 phy) and call get_sync() alongwith >> enable() ? > > that's correct, make sure it works fine for you ;-) > Yeah sure.
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3a4004a..59c2494 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -453,6 +453,7 @@ static int dwc3_probe(struct platform_device *pdev) if (of_get_property(node, "tx-fifo-resize", NULL)) dwc->needs_fifo_resize = true; + pm_runtime_set_active(dev); pm_runtime_enable(dev); pm_runtime_get_sync(dev); pm_runtime_forbid(dev); @@ -517,6 +518,7 @@ static int dwc3_probe(struct platform_device *pdev) goto err2; } + pm_runtime_put(dev); pm_runtime_allow(dev); return 0; @@ -543,6 +545,7 @@ err1: err0: dwc3_free_event_buffers(dwc); + pm_runtime_disable(&pdev->dev); return ret; } @@ -554,7 +557,6 @@ static int dwc3_remove(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); dwc3_debugfs_exit(dwc);