From patchwork Mon May 13 13:47:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 16880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36F8225E14 for ; Mon, 13 May 2013 13:48:52 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id u1sf237632ggn.0 for ; Mon, 13 May 2013 06:48:19 -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:in-reply-to:references :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=5sWX5X76/DVx7N+oJMxehBfYP6PivEk/jaTjfKABI+A=; b=lAHBYRtSTaAXmYkrrnIxkVUxIN23OT+rohzwMQcDYbuc3YY2kT11gbCFqXHfmr/mIC MAYVgNBeIbfIslvojZ4Ju8P7LV4vZi49UN9kC6qYkTW/iqN8s44sUMwimdY/OTfhuu/m CyQDA2Z6jOEA1dDFlbN6X4jRT2ElIx8jit1z7XLN0RaUXLXq+wv67NlARajspD7hbS5g s16zBKx01g9mWNypnYL6ZdldU4SC2aG5dOD0F5jutfV5+3Zqz/orj3fQtV6pjzCfr5dO GIOtCGjZeTR0uWihhf1ahlfHWHs9NmkstSSPutwVOpfOzqUXeeTuCrmMwbvagyAskJhK EN6w== X-Received: by 10.236.151.133 with SMTP id b5mr14632562yhk.49.1368452899582; Mon, 13 May 2013 06:48:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.48 with SMTP id a16ls2843954qen.25.gmail; Mon, 13 May 2013 06:48:19 -0700 (PDT) X-Received: by 10.52.18.230 with SMTP id z6mr15571704vdd.107.1368452899300; Mon, 13 May 2013 06:48:19 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id l10si8458951vet.19.2013.05.13.06.48.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 May 2013 06:48:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id gd11so1023590vcb.39 for ; Mon, 13 May 2013 06:48:18 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr15118801vdo.51.1368452898895; Mon, 13 May 2013 06:48:18 -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.217.15 with SMTP id hk15csp19573vcb; Mon, 13 May 2013 06:48:18 -0700 (PDT) X-Received: by 10.14.38.198 with SMTP id a46mr79263122eeb.11.1368452897435; Mon, 13 May 2013 06:48:17 -0700 (PDT) Received: from eu1sys200aog112.obsmtp.com (eu1sys200aog112.obsmtp.com [207.126.144.133]) by mx.google.com with SMTP id t45si8393575eel.12.2013.05.13.06.47.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 06:48:17 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.133; Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKUZDu+zDRPZz+Yp6S8KATETEFozyKCz8v@postini.com; Mon, 13 May 2013 13:48:17 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id CDAE5BA; Mon, 13 May 2013 13:47:32 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 7E8763FE; Mon, 13 May 2013 13:47:32 +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 relay1.stm.gmessaging.net (Postfix) with ESMTPS id 6D0C124C2AB; Mon, 13 May 2013 15:47:24 +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, 13 May 2013 15:47:31 +0200 From: Ulf Hansson To: , Russell King Cc: , Chris Ball , Daniel Lezcano , Linus Walleij , Rickard Andersson , Ulf Hansson Subject: [PATCH 1/3] mmc: mmci: Use optional sleep pinctrl state Date: Mon, 13 May 2013 15:47:15 +0200 Message-ID: <1368452837-31458-2-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1368452837-31458-1-git-send-email-ulf.hansson@stericsson.com> References: <1368452837-31458-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmq8tTahr9aWi3JzTySZZ7JTHqV9tQ0ZHQ2OzAIk+kW/r6aAlV/ualvrpo/nPxzNdlPwhQU X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 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 By optionally putting the pins into sleep state in the .runtime_suspend callback we can accomplish two things. One is to minimize current leakage from pins and thus save power, second we can prevent the IP from driving pins output in an uncontrolled manner, which may happen if the power domain drops the domain regulator. When returning from idle, entering .runtime_resume callback, the pins are restored to default state. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 16 ++++++++++++++++ drivers/mmc/host/mmci.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index f4f3038..98b0c16 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1437,6 +1437,12 @@ static int mmci_probe(struct amba_device *dev, } else dev_warn(&dev->dev, "could not get default pinstate\n"); + /* fetch optional sleep state of pins */ + host->pins_sleep = pinctrl_lookup_state(host->pinctrl, + PINCTRL_STATE_SLEEP); + if (IS_ERR(host->pins_sleep)) + dev_dbg(&dev->dev, "could not get sleep pinstate\n"); + /* Get regulators and the supported OCR mask */ mmc_regulator_get_supply(mmc); if (!mmc->ocr_avail) @@ -1680,6 +1686,11 @@ static int mmci_runtime_suspend(struct device *dev) if (mmc) { struct mmci_host *host = mmc_priv(mmc); + + /* Optionally let pins go into sleep state */ + if (!IS_ERR(host->pins_sleep)) + pinctrl_select_state(host->pinctrl, host->pins_sleep); + clk_disable_unprepare(host->clk); } @@ -1693,7 +1704,12 @@ static int mmci_runtime_resume(struct device *dev) if (mmc) { struct mmci_host *host = mmc_priv(mmc); + clk_prepare_enable(host->clk); + + /* Optionally enable pins to be muxed in and configured */ + if (!IS_ERR(host->pins_default)) + pinctrl_select_state(host->pinctrl, host->pins_default); } return 0; diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 1f33ad5..4e68c4c 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -199,6 +199,7 @@ struct mmci_host { /* pinctrl handles */ struct pinctrl *pinctrl; struct pinctrl_state *pins_default; + struct pinctrl_state *pins_sleep; #ifdef CONFIG_DMA_ENGINE /* DMA stuff */