From patchwork Wed Apr 19 21:17:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 97683 Delivered-To: patches@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp447957obc; Wed, 19 Apr 2017 14:17:24 -0700 (PDT) X-Received: by 10.28.7.137 with SMTP id 131mr13797wmh.49.1492636644411; Wed, 19 Apr 2017 14:17:24 -0700 (PDT) Return-Path: Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com. [2a00:1450:400c:c09::229]) by mx.google.com with ESMTPS id p2si22792026wmb.77.2017.04.19.14.17.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 14:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::229 as permitted sender) client-ip=2a00:1450:400c:c09::229; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x229.google.com with SMTP id o81so89660605wmb.1 for ; Wed, 19 Apr 2017 14:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W0zODX+ZOkx8Ics0RZBXIB1u0sTg4+bKtV9E32eORY4=; b=U4yQzVljLB2usL9om4g73/bowuV0aHNib4+jAg4ObF1aAKuF7S5kWvp2ZsvsXzl7SB XDx5WXiwMUdEkis0AWs69+V7cWnJcfMgm46NNjopii7gKwdTb8bUQ94XbrF6bJHEId++ yqZjoo262WJHti9dYGXeLscOWjCVRcai9fG9c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W0zODX+ZOkx8Ics0RZBXIB1u0sTg4+bKtV9E32eORY4=; b=Y+/3darhNYfP3B2K7Gtz/wOmyqVW9MAWCZ3qZLPcAFG1miwUeQKSkeiq/g6Gr51ZgV E/jaztx1l9cgETlcwHlOJC8BBi4DJa6zUwWvjP1sLJgbJpDoYmkmElmDhebYLe55cHcO RMZMsZDg4IsWbk5Am7i7kGYQcRDyTxe0IfvzCN4JKjc/pGulq1vllX316ZRv0WXrJlSu 7hwFEcOdTNsR20FE/ggYPIn3iT2t6v2AUxWwlEYmzuQ0XamEmq+kUklGX9nZfO3wYUlb U2LU1mtD/l6MIwfj5MsRBAsu78s3q2Ak1kktrp8G/o95Msom6CNOdKQx1SLoI3UQPCDt ED1Q== X-Gm-Message-State: AN3rC/58c+peoYlGCpl3wFw1HxhDXqgzoD9J6eh7sSGxr/mMovZDshMu 4Rs2mR1rnO1Tmyne2+8= X-Received: by 10.28.91.82 with SMTP id p79mr24440wmb.130.1492636643999; Wed, 19 Apr 2017 14:17:23 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id g53sm4837747wrg.22.2017.04.19.14.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 14:17:23 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Brian Norris , Shawn Lin , Doug Anderson Subject: [PATCH v2 4/5] mmc: dw_mmc: Prevent runtime PM suspend when SDIO IRQs are enabled Date: Wed, 19 Apr 2017 23:17:10 +0200 Message-Id: <1492636631-28254-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492636631-28254-1-git-send-email-ulf.hansson@linaro.org> References: <1492636631-28254-1-git-send-email-ulf.hansson@linaro.org> To be able to handle SDIO IRQs the dw_mmc device needs to be powered and providing clock to the SDIO card. Therefore, we must not allow the device to be runtime PM suspended while SDIO IRQs are enabled. To fix this, let's increase the runtime PM usage count while the mmc core enables SDIO IRQs. Later when the mmc core tells dw_mmc to disable SDIO IRQs, we drop the usage count to again allow runtime PM suspend. This now becomes the default behaviour for dw_mmc. In cases where SDIO IRQs can be re-routed as GPIO wake-ups during runtime PM suspend, one could potentially allow runtime PM suspend. However, that will have to be addressed as a separate change on top of this one. Signed-off-by: Ulf Hansson --- drivers/mmc/host/dw_mmc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 635d76c..c14a36b 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "dw_mmc.h" @@ -1664,8 +1665,15 @@ static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb) static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb) { struct dw_mci_slot *slot = mmc_priv(mmc); + struct dw_mci *host = slot->host; __dw_mci_enable_sdio_irq(slot, enb); + + /* Avoid runtime suspending the device when SDIO IRQ is enabled */ + if (enb) + pm_runtime_get_noresume(host->dev); + else + pm_runtime_put_noidle(host->dev); } static void dw_mci_ack_sdio_irq(struct mmc_host *mmc)