Skip to contentSkip to conversation

regulator: fixed: add off-on-delay-us

PATCH New Peng Fan 1 participant 3 messages Oct 29, 2019

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

cover regulator: fixed: add off-on-delay-us

From: Peng Fan <[email protected]>

Depends on board design, the gpio controlled fixed regulator might connect with a large capacitance. It needs time to be truly off when disabling the regulator. If the delay is not enought, the voltage might not drop to the expected value, such as 0, then the regulator might have been always enabled. So introduce off-on-delay-us property and add the support in fixed regualtor driver.

Peng Fan (2):
dt-bindings: regulator: fixed: add off-on-delay-us property
regulator: fixed: add off-on-delay

 Documentation/devicetree/bindings/regulator/fixed-regulator.yaml | 4 ++++
 drivers/regulator/fixed.c                                        | 2 ++
 include/linux/regulator/fixed.h                                  | 1 +
 3 files changed, 7 insertions(+)
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 1/2 dt-bindings: regulator: fixed: add off-on-delay-us property

From: Peng Fan <[email protected]>

When disabling a fixed regulator, it may take some time to let the voltage drop to the expected value, such as zero. If not delay enough time, the regulator might have been always enabled.

---
 Documentation/devicetree/bindings/regulator/fixed-regulator.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/regulator/fixed-regulator.yaml +4 -0
index a78150c47aa2..954130a8ccbe 100644
@@ -50,6 +50,10 @@ properties:
     description: startup time in microseconds
     $ref: /schemas/types.yaml#/definitions/uint32
 
+  off-on-delay-us:
+    description: off delay time in microseconds
+    $ref: /schemas/types.yaml#/definitions/uint32
+
   enable-active-high:
     description:
       Polarity of GPIO is Active high. If this property is missing,
Signature · 1 line
2.16.4
author
#2 lore raw

PATCH 2/2 regulator: fixed: add off-on-delay

In reply to Peng Fan

From: Peng Fan <[email protected]>

Depends on board design, the gpio controlling regulator may connects with a big capacitance. When need off, it takes some time to let the regulator to be truly off. If not add enough delay, the regulator might have always been on, so introduce off-on-delay to handle such case.

---

V1:
There is a checkpatch warning "
Prefer 'unsigned int' to bare use of 'unsigned' ", so I use unsigned int for off_on_delay.

 drivers/regulator/fixed.c       | 2 ++
 include/linux/regulator/fixed.h | 1 +
 2 files changed, 3 insertions(+)
drivers/regulator/fixed.c +2 -0
index d90a6fd8cbc7..5dbdc41743f3 100644
@@ -123,6 +123,7 @@ of_get_fixed_voltage_config(struct device *dev,
 		config->enabled_at_boot = true;
 
 	of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
+	of_property_read_u32(np, "off-on-delay-us", &config->off_on_delay);
 
 	if (of_find_property(np, "vin-supply", NULL))
 		config->input_supply = "vin";
@@ -190,6 +191,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
 	}
 
 	drvdata->desc.enable_time = config->startup_delay;
+	drvdata->desc.off_on_delay = config->off_on_delay;
 
 	if (config->input_supply) {
 		drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
include/linux/regulator/fixed.h +1 -0
index d44ce5f18a56..623a5c574782 100644
@@ -36,6 +36,7 @@ struct fixed_voltage_config {
 	const char *input_supply;
 	int microvolts;
 	unsigned startup_delay;
+	unsigned int off_on_delay;
 	unsigned enabled_at_boot:1;
 	struct regulator_init_data *init_data;
 };
Signature · 1 line
2.16.4