linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Felipe F. Tonello" <eu@felipetonello.com>
To: linux-mmc@vger.kernel.org
Cc: ben-linux@fluff.org, cjb@laptop.org, arnd@arndb.de,
	linux-kernel@vger.kernel.org,
	"Felipe F. Tonello" <eu@felipetonello.com>
Subject: [PATCH 1/2] mmc: sdhci: Added set_power sdhci_ops handler.
Date: Wed, 22 May 2013 10:47:11 -0700	[thread overview]
Message-ID: <1369244832-23868-2-git-send-email-eu@felipetonello.com> (raw)
In-Reply-To: <1369244832-23868-1-git-send-email-eu@felipetonello.com>

From: "Felipe F. Tonello" <eu@felipetonello.com>

This is useful for power managment purposes if a sdhci child host wants to
turn off some other peripheral also.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 drivers/mmc/host/sdhci.c | 8 ++++++++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 2ea429c..0a026c6 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1244,6 +1244,10 @@ static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
 	u8 pwr = 0;
 
 	if (power != (unsigned short)-1) {
+
+		if (host->ops->set_power)
+			host->ops->set_power(host, true);
+
 		switch (1 << power) {
 		case MMC_VDD_165_195:
 			pwr = SDHCI_POWER_180;
@@ -1259,6 +1263,10 @@ static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
 		default:
 			BUG();
 		}
+	} else {
+
+		if (host->ops->set_power)
+			host->ops->set_power(host, false);
 	}
 
 	if (host->pwr == pwr)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 379e09d..293d56d 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -294,6 +294,7 @@ struct sdhci_ops {
 	void	(*platform_resume)(struct sdhci_host *host);
 	void    (*adma_workaround)(struct sdhci_host *host, u32 intmask);
 	void	(*platform_init)(struct sdhci_host *host);
+	void	(*set_power)(struct sdhci_host *host, bool power);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
-- 
1.8.1.4

  reply	other threads:[~2013-05-22 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 17:47 [PATCH 0/2] Added set_power handler to mmc sdhci host Felipe F. Tonello
2013-05-22 17:47 ` Felipe F. Tonello [this message]
2013-05-22 20:30   ` [PATCH 1/2] mmc: sdhci: Added set_power sdhci_ops handler Guennadi Liakhovetski
2013-05-22 21:22     ` Felipe Ferreri Tonello
2013-05-23  7:25       ` Guennadi Liakhovetski
2013-05-24  4:02         ` Jaehoon Chung
2013-05-24 22:12           ` Felipe Tonello
2013-05-22 17:47 ` [PATCH 2/2] mmc: sdhci-s3c: Added set_power handler to platdata Felipe F. Tonello
2013-05-24  3:57   ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369244832-23868-2-git-send-email-eu@felipetonello.com \
    --to=eu@felipetonello.com \
    --cc=arnd@arndb.de \
    --cc=ben-linux@fluff.org \
    --cc=cjb@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).