From patchwork Tue Aug 23 10:16:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 1088002 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7NAISUc021468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 23 Aug 2011 10:18:48 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p7NAGthF006506; Tue, 23 Aug 2011 03:16:55 -0700 Received: from caramon.arm.linux.org.uk (caramon.arm.linux.org.uk [78.32.30.218]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p7NAGo8p006471 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Aug 2011 03:16:52 -0700 Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd] helo=rmk-PC.arm.linux.org.uk) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Qvo29-0007Er-2Z; Tue, 23 Aug 2011 11:16:37 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Qvo2B-0000qz-3A; Tue, 23 Aug 2011 11:16:39 +0100 In-Reply-To: <20110823101555.GE19622@n2100.arm.linux.org.uk> References: <20110823101555.GE19622@n2100.arm.linux.org.uk> From: Russell King - ARM Linux To: Linus Walleij , "Rafael J. Wysocki" MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 Aug 2011 11:16:39 +0100 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-4.361 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: linux-pm@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: [linux-pm] [PATCH 2/2] PM: add runtime PM support to MMCI X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 23 Aug 2011 10:18:48 +0000 (UTC) Add runtime PM support to the MMCI primecell driver, making use of the core primecell bus runtime PM support. Tested-by: Linus Walleij Signed-off-by: Russell King --- drivers/mmc/host/mmci.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 56e9a41..5e142b7 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -170,6 +171,7 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) * back into the driver... */ spin_unlock(&host->lock); + pm_runtime_put(mmc_dev(host->mmc)); mmc_request_done(host->mmc, mrq); spin_lock(&host->lock); } @@ -984,6 +986,8 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) return; } + pm_runtime_get_sync(mmc_dev(mmc)); + spin_lock_irqsave(&host->lock, flags); host->mrq = mrq; @@ -1327,6 +1331,8 @@ static int __devinit mmci_probe(struct amba_device *dev, mmci_dma_setup(host); + pm_runtime_put(&dev->dev); + mmc_add_host(mmc); return 0; @@ -1364,6 +1370,12 @@ static int __devexit mmci_remove(struct amba_device *dev) if (mmc) { struct mmci_host *host = mmc_priv(mmc); + /* + * Undo pm_runtime_put() in probe. We use the _sync + * version here so that we can access the primecell. + */ + pm_runtime_get_sync(&dev->dev); + mmc_remove_host(mmc); writel(0, host->base + MMCIMASK0);