aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-27 09:14:38 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-03 15:29:27 -0400
commit65f735082de35aa4d44e8d0afe862798d0e09e29 (patch)
tree9ffdc83c3a0971fb853685503243cdd4dfd752a7 /include/linux/regulator
parent5c5659d0a22ec4f947ef4faa3055767572f15e74 (diff)
regulator: core: Add core support for GPIO controlled enable lines
It is very common for regulators to support having their enable signal controlled by a GPIO. Since there are a bunch of fiddly things to get right like handling the operations when the enable signal is tied to a rail and it's just replicated code add support for this to the core. Drivers should set ena_gpio in their config if they have a GPIO control, using ena_gpio_flags to specify any flags (including GPIOF_OUT_INIT_ for the initial state) and ena_gpio_invert if the GPIO is active low. The core will then override any enable and disable operations the driver has and instead control the specified GPIO. This will in the future also allow us to further extend the core by identifying when several enable signals have been tied together and handling this properly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r--include/linux/regulator/driver.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 176bd433558..b1b7b8b43ec 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -220,6 +220,9 @@ struct regulator_desc {
220 * @of_node: OpenFirmware node to parse for device tree bindings (may be 220 * @of_node: OpenFirmware node to parse for device tree bindings (may be
221 * NULL). 221 * NULL).
222 * @regmap: regmap to use for core regmap helpers 222 * @regmap: regmap to use for core regmap helpers
223 * @ena_gpio: GPIO controlling regulator enable.
224 * @ena_gpio_invert: Sense for GPIO enable control.
225 * @ena_gpio_flags: Flags to use when calling gpio_request_one()
223 */ 226 */
224struct regulator_config { 227struct regulator_config {
225 struct device *dev; 228 struct device *dev;
@@ -227,6 +230,10 @@ struct regulator_config {
227 void *driver_data; 230 void *driver_data;
228 struct device_node *of_node; 231 struct device_node *of_node;
229 struct regmap *regmap; 232 struct regmap *regmap;
233
234 int ena_gpio;
235 unsigned int ena_gpio_invert:1;
236 unsigned int ena_gpio_flags;
230}; 237};
231 238
232/* 239/*
@@ -265,6 +272,10 @@ struct regulator_dev {
265 void *reg_data; /* regulator_dev data */ 272 void *reg_data; /* regulator_dev data */
266 273
267 struct dentry *debugfs; 274 struct dentry *debugfs;
275
276 int ena_gpio;
277 unsigned int ena_gpio_invert:1;
278 unsigned int ena_gpio_state:1;
268}; 279};
269 280
270struct regulator_dev * 281struct regulator_dev *