Skip to contentSkip to conversation

regulator: core: add support for configuring turn-on time through constraints

PATCH Applied Laxman Dewangan 3 participants 3 messages Sep 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 regulator: core: add support for configuring turn-on time through constraints

The turn-on time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value.

The driver provides the enable-time as per datasheet.

Add support for configure the enable ramp time through regulator constraints so that regulator core can take this value for enable time for that regulator.

---
Changes from V1:
- Change property name to regulator-enable-ramp-delay and add more details in DT doc.
- add the valid pointer check for constraints before accessing it.

Changes from V2:
- Rephrase the descripton of property regulator-enable-ramp-delay. Changes from V3:
- Use the description provided by Stephen to describe regulator-enable-ramp-delay.

 .../devicetree/bindings/regulator/regulator.txt    |    5 +++++
 drivers/regulator/core.c                           |    2 ++
 drivers/regulator/of_regulator.c                   |    6 ++++++
 include/linux/regulator/machine.h                  |    2 ++
 4 files changed, 15 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/regulator/regulator.txt +5 -0
index 2bd8f09..e2c7f1e 100644
@@ -14,6 +14,11 @@ Optional properties:
 - regulator-ramp-delay: ramp delay for regulator(in uV/uS)
   For hardwares which support disabling ramp rate, it should be explicitly
   intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
+- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
+  rail to reach the target voltage, plus/minus whatever tolerance the board
+  design requires. This property describes the total system ramp time
+  required due to the combination of internal ramping of the regulator itself,
+  and board design issues such as trace capacitance and load on the supply.
 
 Deprecated properties:
 - regulator-compatible: If a regulator chip contains multiple
drivers/regulator/core.c +2 -0
index b698e2b..4eefcc3 100644
@@ -1167,6 +1167,8 @@ overflow_err:
 
 static int _regulator_get_enable_time(struct regulator_dev *rdev)
 {
+	if (rdev->constraints && rdev->constraints->enable_time)
+		return rdev->constraints->enable_time;
 	if (!rdev->desc->ops->enable_time)
 		return rdev->desc->enable_time;
 	return rdev->desc->ops->enable_time(rdev);
drivers/regulator/of_regulator.c +6 -0
index 7827384..ea4f36f 100644
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
 	const __be32 *min_uA, *max_uA, *ramp_delay;
 	struct property *prop;
 	struct regulation_constraints *constraints = &(*init_data)->constraints;
+	int ret;
+	u32 pval;
 
 	constraints->name = of_get_property(np, "regulator-name", NULL);
 
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
 		else
 			constraints->ramp_disable = true;
 	}
+
+	ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
+	if (!ret)
+		constraints->enable_time = pval;
 }
 
 /**
include/linux/regulator/machine.h +2 -0
index a9f7c55..730e638 100644
@@ -95,6 +95,7 @@ struct regulator_state {
  * @initial_state: Suspend state to set by default.
  * @initial_mode: Mode to set at startup.
  * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
+ * @enable_time: Turn-on time of the rails (unit: microseconds)
  */
 struct regulation_constraints {
 
@@ -129,6 +130,7 @@ struct regulation_constraints {
 	unsigned int initial_mode;
 
 	unsigned int ramp_delay;
+	unsigned int enable_time;
 
 	/* constraint flags */
 	unsigned always_on:1;	/* regulator never off when system is on */
Signature · 1 line
1.7.1.1
Acked-by on v4 1/1
#1 lore raw
Quoted 10 lines · Laxman Dewangan

The turn-on time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value.

The driver provides the enable-time as per datasheet.

Add support for configure the enable ramp time through regulator constraints so that regulator core can take this value for enable time for that regulator.

The binding,

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
In reply to Laxman Dewangan
Quoted 4 lines · Laxman Dewangan

The turn-on time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value.

Applied, thanks.