public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@kernel•org>
To: Mark Brown <broonie@kernel•org>, Liam Girdwood <lgirdwood@gmail•com>
Cc: Maxime Ripard <mripard@kernel•org>, Chen-Yu Tsai <wens@csie•org>,
	linux-kernel@vger•kernel.org,
	linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3] regulator: gpio: Honor regulator-boot-on property
Date: Mon, 20 Jul 2020 21:28:09 +0800	[thread overview]
Message-ID: <20200720132809.26908-1-wens@kernel.org> (raw)

From: Chen-Yu Tsai <wens@csie•org>

When requesting the enable GPIO, the driver should do so with the
correct output level matching some expected state. This is especially
important if the regulator is a critical one, such as a supply for
the boot CPU. This is currently done by checking for the enable-at-boot
property, but this is not documented in the device tree binding, nor
does it match the common regulator properties.

Honor the common regulator-boot-on property by checking the boot_on
constraint setting within the DT probe path. This is the same as what
is done in the fixed regulator driver.

Also add a comment stating that the enable-at-boot property should not
be used.

Fixes: 006694d099e8 ("regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT")
Signed-off-by: Chen-Yu Tsai <wens@csie•org>
---
Changes since v2:
  - Keep enable-at-boot property support
  - Add comment stating enable-at-boot should not be used

Changes since v1:
  - Reworded commit log
  - Fixed typo in subject
---
 drivers/regulator/gpio-regulator.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 110ee6fe76c4..044e45ee9629 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -148,6 +148,13 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
 
 	config->supply_name = config->init_data->constraints.name;
 
+	if (config->init_data->constraints.boot_on)
+		config->enabled_at_boot = true;
+
+	/*
+	 * Do not use: undocumented device tree property.
+	 * This is kept around solely for device tree ABI stability.
+	 */
 	if (of_property_read_bool(np, "enable-at-boot"))
 		config->enabled_at_boot = true;
 
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-07-20 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 13:28 Chen-Yu Tsai [this message]
2020-07-22  0:57 ` [PATCH v3] regulator: gpio: Honor regulator-boot-on property 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=20200720132809.26908-1-wens@kernel.org \
    --to=wens@kernel$(echo .)org \
    --cc=broonie@kernel$(echo .)org \
    --cc=lgirdwood@gmail$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mripard@kernel$(echo .)org \
    --cc=wens@csie$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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