linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add input_supply support in gpio_regulator_config
@ 2022-09-29 13:25 Jerome Neanne
  2022-09-29 13:25 ` [PATCH 1/2] regulator: gpio: " Jerome Neanne
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jerome Neanne @ 2022-09-29 13:25 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt
  Cc: linux-kernel, devicetree, khilman, msp, Jerome Neanne

This is simillar needs and implementation as fixed-regulator.
Used to extract regulator parent from the device tree.

Provide implementation and bindings for vin-supply property.

Jerome Neanne (2):
  regulator: gpio: Add input_supply support in gpio_regulator_config
  dt-bindings: gpio-regulator: add vin-supply property support

 .../bindings/regulator/gpio-regulator.yaml        |  3 +++
 drivers/regulator/gpio-regulator.c                | 15 +++++++++++++++
 include/linux/regulator/gpio-regulator.h          |  2 ++
 3 files changed, 20 insertions(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] regulator: gpio: Add input_supply support in gpio_regulator_config
  2022-09-29 13:25 [PATCH 0/2] Add input_supply support in gpio_regulator_config Jerome Neanne
@ 2022-09-29 13:25 ` Jerome Neanne
  2022-09-29 13:25 ` [PATCH 2/2] dt-bindings: gpio-regulator: add vin-supply property support Jerome Neanne
  2022-09-29 15:52 ` [PATCH 0/2] Add input_supply support in gpio_regulator_config Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jerome Neanne @ 2022-09-29 13:25 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt
  Cc: linux-kernel, devicetree, khilman, msp, Jerome Neanne

This is simillar as fixed-regulator.
Used to extract regulator parent from the device tree.

Without that property used, the parent regulator can be shut down (if not an always on).
Thus leading to inappropriate behavior:
On am62-SP-SK this fix is required to avoid tps65219 ldo1 (SDMMC rail) to be shut down after boot completion.

Signed-off-by: Jerome Neanne <jneanne@baylibre.com>
---
 drivers/regulator/gpio-regulator.c       | 15 +++++++++++++++
 include/linux/regulator/gpio-regulator.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 5927d4f3ea..95e61a2f43 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -220,6 +220,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
 				 regtype);
 	}
 
+	if (of_find_property(np, "vin-supply", NULL))
+		config->input_supply = "vin";
+
 	return config;
 }
 
@@ -259,6 +262,18 @@ static int gpio_regulator_probe(struct platform_device *pdev)
 
 	drvdata->gpiods = devm_kzalloc(dev, sizeof(struct gpio_desc *),
 				       GFP_KERNEL);
+
+	if (config->input_supply) {
+		drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
+							 config->input_supply,
+							 GFP_KERNEL);
+		if (!drvdata->desc.supply_name) {
+			dev_err(&pdev->dev,
+				"Failed to allocate input supply\n");
+			return -ENOMEM;
+		}
+	}
+
 	if (!drvdata->gpiods)
 		return -ENOMEM;
 	for (i = 0; i < config->ngpios; i++) {
diff --git a/include/linux/regulator/gpio-regulator.h b/include/linux/regulator/gpio-regulator.h
index fdeb312cda..c223e50ff9 100644
--- a/include/linux/regulator/gpio-regulator.h
+++ b/include/linux/regulator/gpio-regulator.h
@@ -42,6 +42,7 @@ struct gpio_regulator_state {
 /**
  * struct gpio_regulator_config - config structure
  * @supply_name:	Name of the regulator supply
+ * @input_supply:	Name of the input regulator supply
  * @enabled_at_boot:	Whether regulator has been enabled at
  *			boot or not. 1 = Yes, 0 = No
  *			This is used to keep the regulator at
@@ -62,6 +63,7 @@ struct gpio_regulator_state {
  */
 struct gpio_regulator_config {
 	const char *supply_name;
+	const char *input_supply;
 
 	unsigned enabled_at_boot:1;
 	unsigned startup_delay;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dt-bindings: gpio-regulator: add vin-supply property support
  2022-09-29 13:25 [PATCH 0/2] Add input_supply support in gpio_regulator_config Jerome Neanne
  2022-09-29 13:25 ` [PATCH 1/2] regulator: gpio: " Jerome Neanne
@ 2022-09-29 13:25 ` Jerome Neanne
  2022-09-29 15:52 ` [PATCH 0/2] Add input_supply support in gpio_regulator_config Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jerome Neanne @ 2022-09-29 13:25 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt
  Cc: linux-kernel, devicetree, khilman, msp, Jerome Neanne

This is same scheme as fixed-regulator.

Without that property used, the parent regulator can be shut down (if not an always on).
Thus leading to inappropriate behavior:
On am62-SP-SK this fix is required to avoid tps65219 ldo1 (SDMMC rail) to be shut down after boot completion.

Signed-off-by: Jerome Neanne <jneanne@baylibre.com>
---
 .../devicetree/bindings/regulator/gpio-regulator.yaml          | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml b/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
index f7e3d8fd3b..6c3371d706 100644
--- a/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
@@ -85,6 +85,9 @@ properties:
       - current
     default: voltage
 
+  vin-supply:
+    description: Input supply phandle.
+
 required:
   - compatible
   - regulator-name
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Add input_supply support in gpio_regulator_config
  2022-09-29 13:25 [PATCH 0/2] Add input_supply support in gpio_regulator_config Jerome Neanne
  2022-09-29 13:25 ` [PATCH 1/2] regulator: gpio: " Jerome Neanne
  2022-09-29 13:25 ` [PATCH 2/2] dt-bindings: gpio-regulator: add vin-supply property support Jerome Neanne
@ 2022-09-29 15:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-09-29 15:52 UTC (permalink / raw)
  To: krzysztof.kozlowski+dt, lgirdwood, Jerome Neanne, robh+dt
  Cc: linux-kernel, khilman, msp, devicetree

On Thu, 29 Sep 2022 15:25:24 +0200, Jerome Neanne wrote:
> This is simillar needs and implementation as fixed-regulator.
> Used to extract regulator parent from the device tree.
> 
> Provide implementation and bindings for vin-supply property.
> 
> Jerome Neanne (2):
>   regulator: gpio: Add input_supply support in gpio_regulator_config
>   dt-bindings: gpio-regulator: add vin-supply property support
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: gpio: Add input_supply support in gpio_regulator_config
      commit: adfdfcbdbd32b356323a3db6d3a683270051a7e6
[2/2] dt-bindings: gpio-regulator: add vin-supply property support
      commit: 392cc0a4a0c4b25534f3148b192f18be468f67bd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-29 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 13:25 [PATCH 0/2] Add input_supply support in gpio_regulator_config Jerome Neanne
2022-09-29 13:25 ` [PATCH 1/2] regulator: gpio: " Jerome Neanne
2022-09-29 13:25 ` [PATCH 2/2] dt-bindings: gpio-regulator: add vin-supply property support Jerome Neanne
2022-09-29 15:52 ` [PATCH 0/2] Add input_supply support in gpio_regulator_config Mark Brown

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).