2 * driver.h -- SoC Regulator driver support.
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * Regulator Driver Interface.
15 #ifndef __LINUX_REGULATOR_DRIVER_H_
16 #define __LINUX_REGULATOR_DRIVER_H_
18 #include <linux/device.h>
19 #include <linux/regulator/consumer.h>
21 struct regulator_constraints;
25 * struct regulator_ops - regulator operations.
27 * This struct describes regulator operations.
29 struct regulator_ops {
31 /* get/set regulator voltage */
32 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
33 int (*get_voltage) (struct regulator_dev *);
35 /* get/set regulator current */
36 int (*set_current_limit) (struct regulator_dev *,
37 int min_uA, int max_uA);
38 int (*get_current_limit) (struct regulator_dev *);
40 /* enable/disable regulator */
41 int (*enable) (struct regulator_dev *);
42 int (*disable) (struct regulator_dev *);
43 int (*is_enabled) (struct regulator_dev *);
45 /* get/set regulator operating mode (defined in regulator.h) */
46 int (*set_mode) (struct regulator_dev *, unsigned int mode);
47 unsigned int (*get_mode) (struct regulator_dev *);
49 /* get most efficient regulator operating mode for load */
50 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
51 int output_uV, int load_uA);
53 /* the operations below are for configuration of regulator state when
54 * it's parent PMIC enters a global STANBY/HIBERNATE state */
56 /* set regulator suspend voltage */
57 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
59 /* enable/disable regulator in suspend state */
60 int (*set_suspend_enable) (struct regulator_dev *);
61 int (*set_suspend_disable) (struct regulator_dev *);
63 /* set regulator suspend operating mode (defined in regulator.h) */
64 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
68 * Regulators can either control voltage or current.
76 * struct regulator_desc - Regulator descriptor
79 struct regulator_desc {
82 struct regulator_ops *ops;
84 enum regulator_type type;
89 struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
91 void regulator_unregister(struct regulator_dev *rdev);
93 int regulator_notifier_call_chain(struct regulator_dev *rdev,
94 unsigned long event, void *data);
96 void *rdev_get_drvdata(struct regulator_dev *rdev);
97 int rdev_get_id(struct regulator_dev *rdev);