Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / include / linux / regulator / consumer.h
index 801bf77..ebd7472 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
  *
- * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
+ * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -35,6 +35,8 @@
 #ifndef __LINUX_REGULATOR_CONSUMER_H_
 #define __LINUX_REGULATOR_CONSUMER_H_
 
+#include <linux/device.h>
+
 /*
  * Regulator operating modes.
  *
@@ -87,7 +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_FAIL                   0x08
 #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;
 
@@ -123,6 +129,8 @@ struct regulator_bulk_data {
 /* regulator get and put */
 struct regulator *__must_check regulator_get(struct device *dev,
                                             const char *id);
+struct regulator *__must_check regulator_get_exclusive(struct device *dev,
+                                                      const char *id);
 void regulator_put(struct regulator *regulator);
 
 /* regulator output control and status */
@@ -140,6 +148,10 @@ int regulator_bulk_disable(int num_consumers,
 void regulator_bulk_free(int num_consumers,
                         struct regulator_bulk_data *consumers);
 
+int regulator_count_voltages(struct regulator *regulator);
+int regulator_list_voltage(struct regulator *regulator, unsigned selector);
+int regulator_is_supported_voltage(struct regulator *regulator,
+                                  int min_uV, int max_uV);
 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
 int regulator_get_voltage(struct regulator *regulator);
 int regulator_set_current_limit(struct regulator *regulator,
@@ -171,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
 {
        /* Nothing except the stubbed out regulator API should be
         * looking at the value except to check if it is an error
-        * value so the actual return value doesn't matter.
+        * value. Drivers are free to handle NULL specifically by
+        * skipping all regulator API calls, but they don't have to.
+        * Drivers which don't, should make sure they properly handle
+        * corner cases of the API, such as regulator_get_voltage()
+        * returning 0.
         */
-       return (struct regulator *)id;
+       return NULL;
 }
 static inline void regulator_put(struct regulator *regulator)
 {