From patchwork Sun Nov 18 18:50:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 1761461 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DFC893FCDE for ; Sun, 18 Nov 2012 19:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220Ab2KRTi0 (ORCPT ); Sun, 18 Nov 2012 14:38:26 -0500 Received: from gloria.sntech.de ([95.129.55.99]:38124 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003Ab2KRTiZ (ORCPT ); Sun, 18 Nov 2012 14:38:25 -0500 Received: from 146-52-255-101-dynip.superkabel.de ([146.52.255.101] helo=marty.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Ta9wV-0005VJ-Lt; Sun, 18 Nov 2012 19:50:07 +0100 From: Heiko =?utf-8?q?St=C3=BCbner?= To: Chris Ball Subject: [PATCH] mmc: sdhci-s3c: fix missing clock for gpio card-detect Date: Sun, 18 Nov 2012 19:50:05 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-3-686-pae; KDE/4.8.4; i686; ; ) Cc: linux-mmc@vger.kernel.org, Chander Kashyap , Seungwon Jeon References: <201211072357.15572.heiko@sntech.de> <87pq3c7wza.fsf@octavius.laptop.org> In-Reply-To: <87pq3c7wza.fsf@octavius.laptop.org> MIME-Version: 1.0 Message-Id: <201211181950.06005.heiko@sntech.de> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Commit 2abeb5c5ded2 (Add clk_(enable/disable) in runtime suspend/resume) added the capability to stop the clocks when the device is runtime suspended, but forgot to handle the case of the card-detect using an external gpio. Therefore in the case that runtime-pm is enabled, start the io-clock when a card is inserted and stop it again once it is removed. Signed-off-by: Heiko Stuebner --- drivers/mmc/host/sdhci-s3c.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) This _should_ go into 3.7 because currently it causes a regression there. Nevertheless it applies to both 3.7-rc6 and linux-next. I also tried to use pm_runtime_get_sync (and _put) there, but it didn't seem to work and the clock was still missing. With the changes in this patch, the gpio-card-detect works again on my machine - all of insert, remove and reinsert. diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index a54dd5d..c9ec725 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -373,18 +373,25 @@ static struct sdhci_ops sdhci_s3c_ops = { static void sdhci_s3c_notify_change(struct platform_device *dev, int state) { struct sdhci_host *host = platform_get_drvdata(dev); + struct sdhci_s3c *sc = sdhci_priv(host); unsigned long flags; if (host) { spin_lock_irqsave(&host->lock, flags); if (state) { dev_dbg(&dev->dev, "card inserted.\n"); +#ifdef CONFIG_PM_RUNTIME + clk_prepare_enable(sc->clk_io); +#endif host->flags &= ~SDHCI_DEVICE_DEAD; host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; } else { dev_dbg(&dev->dev, "card removed.\n"); host->flags |= SDHCI_DEVICE_DEAD; host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; +#ifdef CONFIG_PM_RUNTIME + clk_disable_unprepare(sc->clk_io); +#endif } tasklet_schedule(&host->card_tasklet); spin_unlock_irqrestore(&host->lock, flags);