]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00274473-1 regulator: add more notifier events
authorAnson Huang <b20788@freescale.com>
Thu, 8 Aug 2013 21:05:38 +0000 (17:05 -0400)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:13 +0000 (10:06 +0200)
Some hardware modules need strict flows according
to regulator's enable/disable, such as for i.MX6
SOC's PU regulator, there is another power gate
in GPC module, it needs to disable PU modules' clock
before PU regulator is disabled and need to enable
clock right after PU regulator is enabled, then it
can do GPC's power gate operation.

So we need to add REGULATOR_EVENT_PRE_DISABLE and
REGULATOR_EVENT_ENABLE for regulator's notifier events.

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

index 4c1f999041dd1fe74433d7769e18fc3cde7d7804..dac9fa3623980797c042aa74346ba21944723015 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright 2007, 2008 Wolfson Microelectronics PLC.
  * Copyright 2008 SlimLogic Ltd.
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
@@ -1822,6 +1823,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
        }
 
        trace_regulator_enable_complete(rdev_get_name(rdev));
+       _notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE, NULL);
 
        return 0;
 }
@@ -1899,6 +1901,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 14ec18d5e18b80e5adc47f0842b625e57c6918f7..48ab02c773729e628ac3dda88aa29bac5b3a5c0d 100644 (file)
@@ -2,6 +2,7 @@
  * consumer.h -- SoC Regulator consumer support.
  *
  * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
@@ -105,6 +106,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_ENABLE                 0x200
 
 struct regulator;