From patchwork Tue May 9 08:27:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 98886 Delivered-To: patches@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1708412qge; Tue, 9 May 2017 01:27:41 -0700 (PDT) X-Received: by 10.223.146.225 with SMTP id 88mr42132875wrn.51.1494318461057; Tue, 09 May 2017 01:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494318461; cv=none; d=google.com; s=arc-20160816; b=p4rxihsx4Zk4/wD6wsqilvAtSpoH52RPYV03cEiHGGTDBIp995AGWsW4lhcV05msp/ HyU6MGJJP8B52Hl/xipHhe2XpqzUHOviCtilkgjqoTfsVAz2+NGMLsccKO6m+DE4BoO/ ywqsgxaBSGv0pjMhuJosn2fwHACLp2YYKuTYEaLDdo1Z60X0zI0lRIO0KhdKDNCDAFTW CzMb8xGxoZz8cu02g85BuU9y9m275+FzZbyTrLP1uVk7f4Vr4Vvjhp2Ls7VPHydUxjNe qhxA+pLc1VafLX8gSCZRkttTMS6GWVdr0jWRzqcKfM02oTxaIAsUAWzql7w0eslbr2ac Fqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=430++NgDsfRLE2/2rRn0RsJBv5NaHP2iADbDyENosGQ=; b=tn8QvvYh+whGP0yLRh0DoxGcVFZP146UqPG0SpIjTH97p8l3qME/h3PpgD7bkmdyFP 5PiMr+/0t9Meqr1aeAVj0dGpGV6E0+MwP97eisN+tLWwADGsz/zmWhmxMOYomT1nxElj F0yL0DlPpZZdGRb98cLVhpo+2SvQrMeGCyDp1o2ywfdD8H3TlmOrzDNVBf+DjuKWWBRc ACeMHFpw9hJ2GzmptiojctSOjnYpRZImC/eF5Hey8CU/ndUCH85qS4he7Y2Uy+E/Nlbe gP0XMuMtgpwpbhcY2bc6Brliq9F/P6jmeb27T6cFtbd97vm6bUddXi4e1hZ+c6ryIUXY LoUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::230 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-wr0-x230.google.com (mail-wr0-x230.google.com. [2a00:1450:400c:c0c::230]) by mx.google.com with ESMTPS id j30si16919424wrb.275.2017.05.09.01.27.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 01:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::230 as permitted sender) client-ip=2a00:1450:400c:c0c::230; 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:c0c::230 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wr0-x230.google.com with SMTP id l50so63261702wrc.3 for ; Tue, 09 May 2017 01:27:40 -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=430++NgDsfRLE2/2rRn0RsJBv5NaHP2iADbDyENosGQ=; b=KwiUJ/Fr4udKHe1ugvmXJXoLvyZUNYXUZoRjyq7bGbsJxufTSif+yZERUgWr0ZrXT5 3Zpm5ViqNAJOhFenxbwDKlO1D+37Uepfm4ZOUSrSFuAufSY/+OgDhIVoxiB2l1Pd2yJV j2G4hf0Vl9DrTk1fbha05xKcTT4Ud9QX9i0ag= 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=430++NgDsfRLE2/2rRn0RsJBv5NaHP2iADbDyENosGQ=; b=GlzW4MLEkOJz2PREo06lNajTG+UbbD5WfG9wQIS54tzrcIo0kVMKn6IWOFYmy2h94u 6fAWmNqdT6BzEOu09bL/8SUwiA0594OZ3Ey88+u6XHKkydXxWr6KQtt6mSYMNDpOKno2 eClZfUjLxTAj5eOAa80e/T8KBXYjaCb0L50e3FnvvsDZG9IIzqdUc8Fp0tATg//TA3jp BVKn3Iqpc8WbRh5UIcTg1DijFewbKHL3KdqQWAAVDAKTgFEeJUZzAc6bCrtdqSa9FNvZ HhC4DeNJ1kR/MfhrNYvLz6lGyAe1t7kHSVcQv7xIGLFqpIwD7LXr5GXs802uBrLMiiDb x1+Q== X-Gm-Message-State: AODbwcD9vjU7SEr4nsj47XG+N8psIqVxkV6eWtCB1l2AbqB9trtcQo0w gO6OSyr7fL8nfpbbp24= X-Received: by 10.46.87.79 with SMTP id r15mr5762473ljd.4.1494318460682; Tue, 09 May 2017 01:27:40 -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 o21sm3151108lfo.34.2017.05.09.01.27.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 01:27:40 -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 v3 4/5] mmc: dw_mmc: Prevent runtime PM suspend when SDIO IRQs are enabled Date: Tue, 9 May 2017 10:27:28 +0200 Message-Id: <1494318449-2591-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494318449-2591-1-git-send-email-ulf.hansson@linaro.org> References: <1494318449-2591-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 Tested-by: Douglas Anderson Reviewed-by: Douglas Anderson --- Changes in v3: - Don't add include of pm_runtime.h as it's already there. --- drivers/mmc/host/dw_mmc.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 635d76c..454b847 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1664,8 +1664,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)