regulator: core: add support for active discharge enable/disable property
Laxman Dewangan [Thu, 29 Oct 2015 09:06:24 +0000 (14:06 +0530)]
Add regulator DT property to add support for configuring the rail's
active discharge enable/disable forcefully. If properties are absent
then it will be POR default.

Change-Id: Ia3a99c6e9aec37ef2824e169e1ae99884163bc25
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/824694
(cherry picked from commit eff460b9d82bd634da66625d05451fae5385d80c)
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/825309
GVS: Gerrit_Virtual_Submit

Documentation/devicetree/bindings/regulator/regulator.txt
drivers/regulator/of_regulator.c
include/linux/regulator/machine.h

index 46b379c..676deff 100644 (file)
@@ -21,6 +21,11 @@ Optional properties:
 -regulator-disable-on-shutdown: Disable regulator on system shutdown.
 -regulator-disable-on-suspend: Disable regulator on system suspend. This is
  applicable for always ON rail.
+-regulator-enable-active-discharge: Boolean, to enable active discharge.
+-regulator-disable-active-discharge: Boolean, to disable active discharge.
+ Both active discharge enable and disable can not be possible together.
+ Also absence of these properties will leave the configuration as POR default.
+
 
 Deprecated properties:
 - regulator-compatible: If a regulator chip contains multiple
index 254d5ac..2f2ebff 100644 (file)
@@ -116,6 +116,11 @@ static void of_get_regulation_constraints(struct device_node *np,
        if (constraints->min_uA != constraints->max_uA)
                constraints->valid_ops_mask |= REGULATOR_CHANGE_CURRENT;
 
+       constraints->enable_active_discharge = of_property_read_bool(np,
+                                       "regulator-enable-active-discharge");
+       constraints->disable_active_discharge = of_property_read_bool(np,
+                                       "regulator-disable-active-discharge");
+
        if (of_find_property(np, "regulator-boot-on", NULL))
                constraints->boot_on = true;
 
index 272c7f0..0005df6 100644 (file)
@@ -87,6 +87,12 @@ struct regulator_state {
  *           started.  If the regulator is not enabled by the hardware or
  *           bootloader then it will be enabled when the constraints are
  *           applied.
+ * @enable_active_discharge: Enable active discharge.
+ * @disable_active_discharge: Disable active discharge.
+ *         Both enable_active_discharge and disable_active_discharge can not
+ *         be set together. if both are flase then POR default will be the
+ *         option.
+ *
  * @apply_uV: Apply the voltage constraint when initialising.
  *
  * @input_uV: Input voltage for regulator when supplied by another regulator.
@@ -159,6 +165,8 @@ struct regulation_constraints {
        unsigned disable_parent_after_enable:1; /* SW based overcurrent protection */
        unsigned disable_on_suspend:1; /* Disable rail on suspend */
        unsigned disable_on_shutdown:1; /* Disable rail on shutdown */
+       unsigned enable_active_discharge:1;
+       unsigned disable_active_discharge:1;
 };
 
 /**