From patchwork Mon Apr 8 11:43:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 15973 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF27F23900 for ; Mon, 8 Apr 2013 11:43:36 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 1sf3609131qec.9 for ; Mon, 08 Apr 2013 04:43:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:mime-version :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=f6S6LInhXJHlp0uiugv8z3RvRIeWTIJi/Khh3unTkKM=; b=WZ+52sBIe+a18aUi2YCx8yzAg2avjwuHG/xPykBTVEXb4ISawOWL11qKGnbixPSegQ AJdhCgl4Yd09UV7sOWIajw8Ae6zI1WvGy5fwCDxBmX6zvZZhyRa7EZN3UX0BOiuUzi2c BI4dnB1p95oy0orLJzXG03ShuKmOvRufjLTADmMUNHYGRDmO0xoHKQvbUv8OR9jjgxg0 ZsuIayuP2TIad+rCDOnPyISoYGq/pJx8WXBIrX6FRKbsoyIiMxtgh4bma63rqZtxrSrv aLd/fCciGOfuxTYCdkraM6yhuNFqc7zPTfiw1aIC7AJdUXcS16w6MHweqx1c8ccPjA7h g5Yw== X-Received: by 10.224.157.1 with SMTP id z1mr5714041qaw.8.1365421402232; Mon, 08 Apr 2013 04:43:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.174 with SMTP id 14ls1619139qef.44.gmail; Mon, 08 Apr 2013 04:43:22 -0700 (PDT) X-Received: by 10.52.93.78 with SMTP id cs14mr1551939vdb.17.1365421402029; Mon, 08 Apr 2013 04:43:22 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id a1si18111939vef.29.2013.04.08.04.43.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 04:43:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz10so5237245veb.31 for ; Mon, 08 Apr 2013 04:43:21 -0700 (PDT) X-Received: by 10.52.65.147 with SMTP id x19mr13339777vds.27.1365421401863; Mon, 08 Apr 2013 04:43:21 -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.58.85.136 with SMTP id h8csp14805vez; Mon, 8 Apr 2013 04:43:21 -0700 (PDT) X-Received: by 10.15.35.193 with SMTP id g41mr2980911eev.45.1365421400447; Mon, 08 Apr 2013 04:43:20 -0700 (PDT) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by mx.google.com with SMTP id f43si19519891eev.66.2013.04.08.04.43.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Apr 2013 04:43:20 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.113; Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUWKtVMjcxh583Fn4SfMOZsYfppyuHAID@postini.com; Mon, 08 Apr 2013 11:43:20 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2B45A16D; Mon, 8 Apr 2013 11:43:10 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 37B4B4BCC; Mon, 8 Apr 2013 11:43:10 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 0F65EA8072; Mon, 8 Apr 2013 13:43:05 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Mon, 8 Apr 2013 13:43:09 +0200 From: Ulf Hansson To: , Chris Ball Cc: Ulf Hansson Subject: [PATCH V2 1/2] mmc: core: Add bus_ops for runtime pm callbacks Date: Mon, 8 Apr 2013 13:43:06 +0200 Message-ID: <1365421386-4623-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlur+/VysWEHPTv0imHSSLVFtU8p0NkzTWkIhGHNhBiXmieYqYAsm8/0VQ0OAoAHC3yFJ6p X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 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: , From: Ulf Hansson SDIO is the only protocol that uses runtime pm for the card device right now. To provide the option for sd and mmc to use runtime pm as well the bus_ops callback are extended with two new functions. One for runtime_suspend and one for runtime_resume. This patch will also implement the callbacks for SDIO to make sure existing functionality is maintained. Signed-off-by: Ulf Hansson Acked-by: Maya Erez Acked-by: Arnd Bergmann Acked-by: Kevin Liu --- drivers/mmc/core/bus.c | 14 ++++++++++++-- drivers/mmc/core/core.h | 2 ++ drivers/mmc/core/sdio.c | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index e219c97..d9e8c2b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -151,15 +151,25 @@ static int mmc_bus_resume(struct device *dev) static int mmc_runtime_suspend(struct device *dev) { struct mmc_card *card = mmc_dev_to_card(dev); + struct mmc_host *host = card->host; + int ret = 0; + + if (host->bus_ops->runtime_suspend) + ret = host->bus_ops->runtime_suspend(host); - return mmc_power_save_host(card->host); + return ret; } static int mmc_runtime_resume(struct device *dev) { struct mmc_card *card = mmc_dev_to_card(dev); + struct mmc_host *host = card->host; + int ret = 0; + + if (host->bus_ops->runtime_resume) + ret = host->bus_ops->runtime_resume(host); - return mmc_power_restore_host(card->host); + return ret; } static int mmc_runtime_idle(struct device *dev) diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index b9f18a2..9445519 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -22,6 +22,8 @@ struct mmc_bus_ops { void (*detect)(struct mmc_host *); int (*suspend)(struct mmc_host *); int (*resume)(struct mmc_host *); + int (*runtime_suspend)(struct mmc_host *); + int (*runtime_resume)(struct mmc_host *); int (*power_save)(struct mmc_host *); int (*power_restore)(struct mmc_host *); int (*alive)(struct mmc_host *); diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index aa0719a..0e6e8c1 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -988,6 +988,24 @@ static int mmc_sdio_resume(struct mmc_host *host) return err; } +static int mmc_sdio_runtime_suspend(struct mmc_host *host) +{ + /* + * Once sdio clients has entirely switched to runtime pm we wrap + * the call to power_save here. + */ + return mmc_power_save_host(host); +} + +static int mmc_sdio_runtime_resume(struct mmc_host *host) +{ + /* + * Once sdio clients has entirely switched to runtime pm we wrap + * the call to power_restore here. + */ + return mmc_power_restore_host(host); +} + static int mmc_sdio_power_restore(struct mmc_host *host) { int ret; @@ -1054,6 +1072,8 @@ static const struct mmc_bus_ops mmc_sdio_ops = { .detect = mmc_sdio_detect, .suspend = mmc_sdio_suspend, .resume = mmc_sdio_resume, + .runtime_suspend = mmc_sdio_runtime_suspend, + .runtime_resume = mmc_sdio_runtime_resume, .power_restore = mmc_sdio_power_restore, .alive = mmc_sdio_alive, };