From patchwork Fri Oct 11 12:28:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 20967 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB56B25EA1 for ; Fri, 11 Oct 2013 12:28:52 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id uy5sf16693929obc.8 for ; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=LIUnKHq1YH1hVRlHaQvU1qM3bDqU7zGvUbhatzG+nNk=; b=Vqe5xrBxxNckT/YfNIS7l3/IphegzkRieVFZxpUWbxwX/CMfXIzMjewrBqQb50Tgr6 V5vYGLtOlFoHtwSAMv8+6cGOBy9p5i/C/qvhzVH8hbY8W0oGtqoBWExzkvQJfljVqZm3 0TR+DMxDX5dAcnxLwr87j8920fLQ3FlOkEDDDDlHmctXMtBpxXfBD64qT1LcyblECUYU Lzoa9oQT3Cet7uImjwNHzU1h9CpnmtxDUHaipRQfuI/4NM7zAZPxXGCQVwrly3yXd6U4 V5I4ncuF5HOi7s3H7jxL0atp1x7+03DmyEq99LZ3TMCaotnhMejjZ0MGrE2lcN3EwdyM XjsA== X-Received: by 10.182.186.73 with SMTP id fi9mr5044638obc.48.1381494532548; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.107.136 with SMTP id hc8ls1435548qeb.55.gmail; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) X-Received: by 10.52.164.102 with SMTP id yp6mr18052660vdb.14.1381494532452; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id lu1si16595343vcb.13.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 05:28:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so2688257vbe.41 for ; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) X-Gm-Message-State: ALoCoQlcEPjTDA/kNpU8Q5qaJHWrzSUUmMDQItrDr+I6uqyVqpcfDdDOStHO88t00/CkHidQmsY/ X-Received: by 10.220.199.5 with SMTP id eq5mr21276918vcb.16.1381494532356; Fri, 11 Oct 2013 05:28:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp35323vcz; Fri, 11 Oct 2013 05:28:51 -0700 (PDT) X-Received: by 10.152.3.201 with SMTP id e9mr16349165lae.24.1381494531510; Fri, 11 Oct 2013 05:28:51 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id l7si22383336lbd.140.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 05:28:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.43 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id ep20so3376350lab.30 for ; Fri, 11 Oct 2013 05:28:51 -0700 (PDT) X-Received: by 10.152.2.4 with SMTP id 4mr16127293laq.0.1381494530929; Fri, 11 Oct 2013 05:28:50 -0700 (PDT) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id l10sm33275873lbh.13.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 05:28:50 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: "Rafael J. Wysocki" , Kevin Hilman , Alan Stern , Colin Cross , Android Kernel Team , John Stultz , Ulf Hansson Subject: [PATCH 4/4] mmc: core: Add MMC_CAP_RUNTIME_RESUME to resume at runtime_resume Date: Fri, 11 Oct 2013 14:28:18 +0200 Message-Id: <1381494498-16699-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381494498-16699-1-git-send-email-ulf.hansson@linaro.org> References: <1381494498-16699-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In some environments it is to prefer to postpone the resume of the card device until runtime_resume is being carried out, since it will mean a signficant decrease of the total system resume time. The reason of the decreased resume time is simply because of the actual re-initalization of the card, which typically takes hundreds of milliseconds, is performed outside the resume sequence and wont thus affect it. For removable card, the detect work tries to re-detect the card to make sure it is still present, as a part of that sequence the card will also be runtime_resumed and thus also fully resumed. For a non-removable card, typically a mmc blk request will trigger a runtime_resume and thus fully resume the card. This also means the first request will likely suffer from an inital latency since the re-initialization of the card needs to be performed. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 12 +++++++----- drivers/mmc/core/sd.c | 12 +++++++----- include/linux/mmc/host.h | 1 + 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1e29dbc..9825119 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1577,11 +1577,13 @@ static int mmc_shutdown(struct mmc_host *host) */ static int mmc_resume(struct mmc_host *host) { - int err; + int err = 0; - err = _mmc_resume(host); - pm_runtime_set_active(&host->card->dev); - pm_runtime_mark_last_busy(&host->card->dev); + if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { + err = _mmc_resume(host); + pm_runtime_set_active(&host->card->dev); + pm_runtime_mark_last_busy(&host->card->dev); + } pm_runtime_enable(&host->card->dev); return err; @@ -1612,7 +1614,7 @@ static int mmc_runtime_resume(struct mmc_host *host) { int err; - if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) + if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) return 0; err = _mmc_resume(host); diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 57940a8..5052d06 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1137,11 +1137,13 @@ out: */ static int mmc_sd_resume(struct mmc_host *host) { - int err; + int err = 0; - err = _mmc_sd_resume(host); - pm_runtime_set_active(&host->card->dev); - pm_runtime_mark_last_busy(&host->card->dev); + if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { + err = _mmc_sd_resume(host); + pm_runtime_set_active(&host->card->dev); + pm_runtime_mark_last_busy(&host->card->dev); + } pm_runtime_enable(&host->card->dev); return err; @@ -1172,7 +1174,7 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) { int err; - if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) + if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) return 0; err = _mmc_sd_resume(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 3b0c33a..a9f7c96 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -254,6 +254,7 @@ struct mmc_host { #define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */ #define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */ #define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */ +#define MMC_CAP_RUNTIME_RESUME (1 << 20) /* Resume at runtime_resume. */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */