public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Romain Perier <romain.perier@collabora.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Romain Perier <romain.perier@collabora.com>,
	Sjoerd Simons <sjoerd.simons@collabora.co.uk>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] mmc: pwrseq-simple: Add optional op. for post_ios_power_on callback
Date: Wed,  1 Mar 2017 15:53:08 +0100	[thread overview]
Message-ID: <20170301145310.22813-3-romain.perier@collabora.com> (raw)
In-Reply-To: <20170301145310.22813-1-romain.perier@collabora.com>

Some devices require to do their entire power sequence after that the
power supply of the MMC has been powered on. This can be done by
only implementing the optional post_ios_power_on() callback that rely on
pre_power_on/post_power_on functions, other functions being NULL. Then
we introduce a new DT property "post_ios_power_on", when this property
is set the driver will use its post_ios_power_on operations, otherwise
it fallbacks to the default operations with pre_power_on/post_power_on.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 drivers/mmc/core/pwrseq_simple.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index 1304160..a9aad9a 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -84,12 +84,22 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
 	}
 }
 
+static void mmc_pwrseq_simple_post_ios_power_on(struct mmc_host *host)
+{
+	mmc_pwrseq_simple_pre_power_on(host);
+	mmc_pwrseq_simple_post_power_on(host);
+}
+
 static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
 	.pre_power_on = mmc_pwrseq_simple_pre_power_on,
 	.post_power_on = mmc_pwrseq_simple_post_power_on,
 	.power_off = mmc_pwrseq_simple_power_off,
 };
 
+static const struct mmc_pwrseq_ops mmc_pwrseq_post_ios_ops = {
+	.post_ios_power_on = mmc_pwrseq_simple_post_ios_power_on,
+};
+
 static const struct of_device_id mmc_pwrseq_simple_of_match[] = {
 	{ .compatible = "mmc-pwrseq-simple",},
 	{/* sentinel */},
@@ -121,7 +131,10 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
 				 &pwrseq->post_power_on_delay_ms);
 
 	pwrseq->pwrseq.dev = dev;
-	pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
+	if (device_property_read_bool(dev, "post-ios-power-on"))
+		pwrseq->pwrseq.ops = &mmc_pwrseq_post_ios_ops;
+	else
+		pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
 	pwrseq->pwrseq.owner = THIS_MODULE;
 	platform_set_drvdata(pdev, pwrseq);
 
-- 
2.9.3

  parent reply	other threads:[~2017-03-01 14:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 14:53 [PATCH 0/4] mmc: pwrseq: post_ios power sequence Romain Perier
2017-03-01 14:53 ` [PATCH 1/4] mmc: core: Add post_ios_power_on callback for power sequences Romain Perier
2017-03-16 12:55   ` Ulf Hansson
2017-03-01 14:53 ` Romain Perier [this message]
2017-03-01 14:53 ` [PATCH 3/4] mmc: pwrseq_simple: Add an optional pre-power-on-delay Romain Perier
2017-03-01 14:53 ` [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms Romain Perier
2017-03-01 22:43   ` Heiko Stuebner

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=20170301145310.22813-3-romain.perier@collabora.com \
    --to=romain.perier@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=sjoerd.simons@collabora.co.uk \
    --cc=ulf.hansson@linaro.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