All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Gautam <gautam.vivek@samsung.com>
To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-omap@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	balbi@ti.com, stern@rowland.harvard.edu,
	sarah.a.sharp@linux.intel.com, rob.herring@calxeda.com,
	kgene.kim@samsung.com, kishon@ti.com, dianders@chromium.org,
	t.figa@samsung.com, p.paneri@samsung.com
Subject: [PATCH v3 02/11] USB: dwc3: Adjust runtime pm to allow autosuspend
Date: Mon, 01 Apr 2013 19:24:01 +0530	[thread overview]
Message-ID: <1364824448-14732-3-git-send-email-gautam.vivek@samsung.com> (raw)
In-Reply-To: <1364824448-14732-1-git-send-email-gautam.vivek@samsung.com>

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.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
CC: Doug Anderson <dianders@chromium.org>
---
 drivers/usb/dwc3/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e2325ad..3a6993c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -491,6 +491,11 @@ static int dwc3_probe(struct platform_device *pdev)
 
 	dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
 
+	/* Setting device state as 'suspended' initially,
+	 * to make sure we know device state prior to
+	 * pm_runtime_enable
+	 */
+	pm_runtime_set_suspended(dev);
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);
 	pm_runtime_forbid(dev);
@@ -566,6 +571,7 @@ static int dwc3_probe(struct platform_device *pdev)
 		goto err3;
 	}
 
+	pm_runtime_put_sync(dev);
 	pm_runtime_allow(dev);
 
 	return 0;
@@ -595,6 +601,7 @@ err1:
 
 err0:
 	dwc3_free_event_buffers(dwc);
+	pm_runtime_disable(&pdev->dev);
 
 	return ret;
 }
@@ -606,7 +613,6 @@ static int dwc3_remove(struct platform_device *pdev)
 	usb_phy_set_suspend(dwc->usb2_phy, 1);
 	usb_phy_set_suspend(dwc->usb3_phy, 1);
 
-	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	dwc3_debugfs_exit(dwc);
-- 
1.7.6.5


  parent reply	other threads:[~2013-04-01 14:00 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 13:53 [PATCH v3 00/11] usb: dwc3/xhci/phy: Enable runtime power management Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 01/11] usb: phy: Add APIs for " Vivek Gautam
2013-04-02  8:23   ` Felipe Balbi
2013-04-02  8:23     ` Felipe Balbi
2013-04-02 10:34     ` Vivek Gautam
2013-04-02 12:10       ` Felipe Balbi
2013-04-02 12:10         ` Felipe Balbi
2013-04-02 12:40         ` Vivek Gautam
2013-04-18 11:50           ` Kishon Vijay Abraham I
2013-04-18 11:50             ` Kishon Vijay Abraham I
2013-04-23 11:15             ` Felipe Balbi
2013-04-23 11:15               ` Felipe Balbi
2013-04-03  5:08   ` Kishon Vijay Abraham I
2013-04-03  5:08     ` Kishon Vijay Abraham I
2013-04-03  6:18     ` Vivek Gautam
2013-04-03  8:15       ` Felipe Balbi
2013-04-03  8:15         ` Felipe Balbi
2013-04-03 13:12         ` Vivek Gautam
2013-04-03 13:54           ` Felipe Balbi
2013-04-03 13:54             ` Felipe Balbi
2013-04-03 13:56             ` Felipe Balbi
2013-04-03 13:56               ` Felipe Balbi
2013-04-03 14:10               ` Vivek Gautam
2013-04-03 14:18                 ` Felipe Balbi
2013-04-03 14:18                   ` Felipe Balbi
2013-04-03 14:42                   ` Vivek Gautam
2013-04-03 18:14                   ` Alan Stern
2013-04-03 18:14                     ` Alan Stern
2013-04-04  7:18                     ` Felipe Balbi
2013-04-04  7:18                       ` Felipe Balbi
2013-04-04  8:56                       ` Vivek Gautam
2013-04-04  9:26                         ` Felipe Balbi
2013-04-04  9:26                           ` Felipe Balbi
2013-04-04 14:46                           ` Alan Stern
2013-04-04 14:46                             ` Alan Stern
2013-04-23 12:42                             ` Vivek Gautam
2013-04-23 16:53                               ` Alan Stern
2013-04-23 16:53                                 ` Alan Stern
2013-04-23 18:05                                 ` Vivek Gautam
2013-04-23 18:05                                   ` Vivek Gautam
2013-04-23 18:12                                   ` Alan Stern
2013-04-23 18:12                                     ` Alan Stern
2013-04-24 13:12                                     ` Vivek Gautam
2013-04-01 13:54 ` Vivek Gautam [this message]
2013-04-02  8:29   ` [PATCH v3 02/11] USB: dwc3: Adjust runtime pm to allow autosuspend Felipe Balbi
2013-04-02  8:29     ` Felipe Balbi
2013-04-03  6:05     ` Vivek Gautam
2013-04-03  8:17       ` Felipe Balbi
2013-04-03  8:17         ` Felipe Balbi
2013-04-01 13:54 ` [PATCH v3 03/11] usb: dwc3: Enable runtime pm only after PHYs are initialized Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 04/11] usb: dwc3: Add runtime power management callbacks Vivek Gautam
2013-04-02  8:32   ` Felipe Balbi
2013-04-02  8:32     ` Felipe Balbi
2013-04-03  4:59     ` Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 05/11] usb: dwc3: exynos: Enable runtime power management Vivek Gautam
2013-04-02  8:33   ` Felipe Balbi
2013-04-02  8:33     ` Felipe Balbi
2013-04-01 13:54 ` [PATCH v3 06/11] usb: xhci: Enable runtime pm in xhci-plat Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 07/11] usb: phy: samsung: Enable runtime power management on usb2phy Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 08/11] usb: phy: samsung: Enable runtime power management on usb3phy Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 09/11] usb: phy: samsung: Add support for external reference clock Vivek Gautam
2013-04-03 17:27 ` [PATCH v3 00/11] usb: dwc3/xhci/phy: Enable runtime power management Sarah Sharp
2013-04-04  5:04   ` Vivek Gautam
2013-04-04  7:10     ` Felipe Balbi
2013-04-04  7:10       ` Felipe Balbi
2013-04-04  7:32       ` Vivek Gautam
2013-04-04 16:40         ` Sarah Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364824448-14732-3-git-send-email-gautam.vivek@samsung.com \
    --to=gautam.vivek@samsung.com \
    --cc=balbi@ti.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kgene.kim@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.paneri@samsung.com \
    --cc=rob.herring@calxeda.com \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=t.figa@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.