]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
regulator: Add notifier event on regulator disable
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 1 Dec 2009 21:12:27 +0000 (21:12 +0000)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 3 Mar 2010 14:49:23 +0000 (14:49 +0000)
The intended use case is for drivers which disable regulators to save
power but need to do some work to restore the hardware state when
restarting.  If the supplies are not actually disabled due to board
limits or sharing with other active devices this notifier allows the
driver to avoid unneeded reinitialisation, particularly when used with
runtime PM.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c
include/linux/regulator/consumer.h

index b60a4c9f8f1680153e7c66c9c6fb5c72ec022dac..6d2ce8a05331411caa34c3293d701902e6c86399 100644 (file)
@@ -1341,6 +1341,9 @@ static int _regulator_disable(struct regulator_dev *rdev)
                                       __func__, rdev_get_name(rdev));
                                return ret;
                        }
+
+                       _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
+                                            NULL);
                }
 
                /* decrease our supplies ref count and disable if required */
@@ -1399,8 +1402,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
                        return ret;
                }
                /* notify other consumers that power has been forced off */
-               _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE,
-                       NULL);
+               _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
+                       REGULATOR_EVENT_DISABLE, NULL);
        }
 
        /* decrease our supplies ref count and disable if required */
index 030d92255c7a09b8fd6175f93e0a1862b96c21a5..28c9fd020d3992669435ed8767e522e2f48b76b1 100644 (file)
@@ -89,8 +89,9 @@
  * REGULATION_OUT Regulator output is out of regulation.
  * FAIL           Regulator output has failed.
  * OVER_TEMP      Regulator over temp.
- * FORCE_DISABLE  Regulator shut down by software.
+ * FORCE_DISABLE  Regulator forcibly shut down by software.
  * VOLTAGE_CHANGE Regulator voltage changed.
+ * DISABLE        Regulator was disabled.
  *
  * NOTE: These events can be OR'ed together when passed into handler.
  */
 #define REGULATOR_EVENT_OVER_TEMP              0x10
 #define REGULATOR_EVENT_FORCE_DISABLE          0x20
 #define REGULATOR_EVENT_VOLTAGE_CHANGE         0x40
+#define REGULATOR_EVENT_DISABLE                0x80
 
 struct regulator;