2 * internal.h -- Voltage/Current Regulator framework internal code
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
5 * Copyright 2008 SlimLogic Ltd.
7 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
16 #ifndef __REGULATOR_INTERNAL_H
17 #define __REGULATOR_INTERNAL_H
19 #include <linux/suspend.h>
21 #define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1)
23 struct regulator_voltage
{
31 * One for each consumer device.
32 * @voltage - a voltage array for each state of runtime, i.e.:
41 struct list_head list
;
42 unsigned int always_on
:1;
43 unsigned int bypass
:1;
45 struct regulator_voltage voltage
[REGULATOR_STATES_NUM
];
46 const char *supply_name
;
47 struct device_attribute dev_attr
;
48 struct regulator_dev
*rdev
;
49 struct dentry
*debugfs
;
52 extern struct class regulator_class
;
54 static inline struct regulator_dev
*dev_to_rdev(struct device
*dev
)
56 return container_of(dev
, struct regulator_dev
, dev
);
59 struct regulator_dev
*of_find_regulator_by_node(struct device_node
*np
);
62 struct regulator_init_data
*regulator_of_get_init_data(struct device
*dev
,
63 const struct regulator_desc
*desc
,
64 struct regulator_config
*config
,
65 struct device_node
**node
);
67 static inline struct regulator_init_data
*
68 regulator_of_get_init_data(struct device
*dev
,
69 const struct regulator_desc
*desc
,
70 struct regulator_config
*config
,
71 struct device_node
**node
)
77 enum regulator_get_type
{
84 struct regulator
*_regulator_get(struct device
*dev
, const char *id
,
85 enum regulator_get_type get_type
);