All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.wolfsonmicro.com>
Subject: [PATCH] regulator: arizona-ldo1: Mark as always-on if no LDOENA
Date: Thu, 21 Apr 2016 13:02:02 +0100	[thread overview]
Message-ID: <1461240122-3942-1-git-send-email-rf@opensource.wolfsonmicro.com> (raw)

If we don't have a GPIO for LDOENA it's impossible to turn
the LDO1 regulator off so mark it as always-on.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
---
 drivers/regulator/arizona-ldo1.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index f7c88ff..cc62ea2 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -290,9 +290,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	config.ena_gpio = arizona->pdata.ldoena;
 
 	if (arizona->pdata.ldo1)
-		config.init_data = arizona->pdata.ldo1;
-	else
-		config.init_data = &ldo1->init_data;
+		ldo1->init_data = *arizona->pdata.ldo1;
+
+	config.init_data = &ldo1->init_data;
 
 	/*
 	 * LDO1 can only be used to supply DCVDD so if it has no
@@ -301,6 +301,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	if (config.init_data->num_consumer_supplies == 0)
 		arizona->external_dcvdd = true;
 
+	if (!arizona->external_dcvdd && (config.ena_gpio == 0) &&
+	    !config.ena_gpio_initialized) {
+		dev_warn(arizona->dev,
+			 "No LDOENA: regulator will be always-on\n");
+		ldo1->init_data.constraints.always_on = true;
+	}
+
 	ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
 
 	of_node_put(config.of_node);
-- 
1.9.1

             reply	other threads:[~2016-04-21 12:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 12:02 Richard Fitzgerald [this message]
2016-04-21 15:26 ` [PATCH] regulator: arizona-ldo1: Mark as always-on if no LDOENA Mark Brown

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=1461240122-3942-1-git-send-email-rf@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.