]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MLK-10058-2 regulator: consumer: define pre_xxx event macros
authorRichard Zhu <Richard.Zhu@freescale.com>
Thu, 25 Dec 2014 06:28:06 +0000 (14:28 +0800)
committerRichard Zhu <Richard.Zhu@freescale.com>
Mon, 19 Jan 2015 01:01:09 +0000 (09:01 +0800)
Some gpc operations are mandatory required when
iMX6SX PCIe PHY is powered on/off.
use the notify framwork to encapsulate the
pre-operations in gpc driver
- add two pre-xxx macros into consumer.h
- kick off the pre-xxx events in enable/disalbe call back.

Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
drivers/regulator/core.c
include/linux/regulator/consumer.h

index afca1bc24f262251abf3352d2e09d6452959805b..6100a6ca30084aba4f9b54044501e47407d77ed7 100644 (file)
@@ -1750,6 +1750,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
 {
        int ret, delay;
 
+       _notifier_call_chain(rdev, REGULATOR_EVENT_PRE_ENABLE, NULL);
        /* Query before enabling in case configuration dependent.  */
        ret = _regulator_get_enable_time(rdev);
        if (ret >= 0) {
@@ -1892,6 +1893,7 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
 {
        int ret;
 
+       _notifier_call_chain(rdev, REGULATOR_EVENT_PRE_DISABLE, NULL);
        trace_regulator_disable(rdev_get_name(rdev));
 
        if (rdev->ena_pin) {
index e530681bea7049cfa818e66acea0bf863952d281..2cd6d993b4a29f7d5716777ba5a60cff3032b90c 100644 (file)
@@ -105,6 +105,8 @@ struct notifier_block;
 #define REGULATOR_EVENT_FORCE_DISABLE          0x20
 #define REGULATOR_EVENT_VOLTAGE_CHANGE         0x40
 #define REGULATOR_EVENT_DISABLE                0x80
+#define REGULATOR_EVENT_PRE_DISABLE            0x100
+#define REGULATOR_EVENT_PRE_ENABLE             0x200
 
 struct regulator;