From 6219929f5f82708309b3054ec7db6cb6e3ee47d5 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Mon, 9 Jan 2012 20:27:41 +0530 Subject: regulator: TPS62360: Add tps62360 regulator driver The regulator module consists of 1 DCDC. The output voltage is configurable and is meant for supply power to the core voltage of Soc. Signed-off-by: Laxman Dewangan Signed-off-by: Mark Brown --- include/linux/regulator/tps62360.h | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 include/linux/regulator/tps62360.h (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h new file mode 100644 index 00000000000..6a5c1b2c751 --- /dev/null +++ b/include/linux/regulator/tps62360.h @@ -0,0 +1,57 @@ +/* + * tps62360.h -- TI tps62360 + * + * Interface for regulator driver for TI TPS62360 Processor core supply + * + * Copyright (C) 2012 NVIDIA Corporation + + * Author: Laxman Dewangan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef __LINUX_REGULATOR_TPS62360_H +#define __LINUX_REGULATOR_TPS62360_H + +#include + +/* + * struct tps62360_regulator_platform_data - tps62360 regulator platform data. + * + * @reg_init_data: The regulator init data. + * @en_force_pwm: Enable force pwm or not. + * @en_discharge: Enable discharge the output capacitor via internal + * register. + * @en_internal_pulldn: internal pull down enable or not. + * @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with + * fixed logic. + * @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with + * fixed logic. + * @vsel0_def_state: Default state of vsel0. 1 if it is high else 0. + * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. + */ +struct tps62360_regulator_platform_data { + struct regulator_init_data reg_init_data; + bool en_force_pwm; + bool en_discharge; + bool en_internal_pulldn; + int vsel0_gpio; + int vsel1_gpio; + int vsel0_def_state; + int vsel1_def_state; +}; + +#endif /* __LINUX_REGULATOR_TPS62360_H */ -- cgit v1.2.3 From 070b9079226d4f3e3e7c9f4eb81f2e02e7d99572 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Mon, 16 Jan 2012 19:39:58 -0800 Subject: regulator: Add devm_regulator_get() Add a resource managed regulator_get() to simplify regulator usage in drivers. This allows driver authors to "get and forget" about their regulators by automatically calling regulator_put() when the driver is detached. [Fixed up a couple of coding style issues -- broonie] Signed-off-by: Stephen Boyd Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0edfc..bcfe1065876 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -132,6 +132,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 devm_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); @@ -200,6 +202,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, */ return NULL; } + +static inline struct regulator *__must_check +devm_regulator_get(struct device *dev, const char *id) +{ + return NULL; +} + static inline void regulator_put(struct regulator *regulator) { } -- cgit v1.2.3 From d5ad34f7cb8b23ab165cabef69577a2a20d53195 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 20 Jan 2012 20:09:18 +0000 Subject: regulator: Implement devm_regulator_free() Allow consumers to free regulators allocated using devm_regulator_get() if they need to. This will not normally be required. Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index bcfe1065876..60c2f996d89 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -137,6 +137,7 @@ struct regulator *__must_check devm_regulator_get(struct device *dev, struct regulator *__must_check regulator_get_exclusive(struct device *dev, const char *id); void regulator_put(struct regulator *regulator); +void devm_regulator_free(struct regulator *regulator); /* regulator output control and status */ int regulator_enable(struct regulator *regulator); -- cgit v1.2.3 From e6e740304aa2a49ef09497e6c0bb906ed7987f6b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 20 Jan 2012 20:10:08 +0000 Subject: regulator: Provide devm_regulator_bulk_get() Allow drivers to benefit from both the bulk APIs and managed resources simultaneously. Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 60c2f996d89..35c42834ba3 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -148,6 +148,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms); int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers); +int devm_regulator_bulk_get(struct device *dev, int num_consumers, + struct regulator_bulk_data *consumers); int regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers); int regulator_bulk_disable(int num_consumers, -- cgit v1.2.3 From e24abd6ec6c2dabccb825dc41d1725bc496b3a54 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 27 Jan 2012 12:55:28 +0800 Subject: regulator: Add empty devm_regulator_bulk_get for !CONFIG_REGULATOR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes below build error if CONFIG_REGULATOR is disabled. CC sound/soc/codecs/wm5100.o sound/soc/codecs/wm5100.c: In function ‘wm5100_i2c_probe’: sound/soc/codecs/wm5100.c:2462: error: implicit declaration of function ‘devm_regulator_bulk_get’ make[3]: *** [sound/soc/codecs/wm5100.o] Error 1 make[2]: *** [sound/soc/codecs] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2 Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 35c42834ba3..cef8f04efc3 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -249,6 +249,12 @@ static inline int regulator_bulk_get(struct device *dev, return 0; } +static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers, + struct regulator_bulk_data *consumers) +{ + return 0; +} + static inline int regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers) { -- cgit v1.2.3 From 2950c4bbf397fc7d3d778a97c32bba0e955b47fe Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 29 Jan 2012 17:52:37 +0800 Subject: regulator: Add devm_regulator_put in consumer.h Commit d5ad34f7cb "regulator: Implement devm_regulator_free()" actually implements devm_regulator_put. Thus rename devm_regulator_free to devm_regulator_put. Also add empty devm_regulator_put for !CONFIG_REGULATOR Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- include/linux/regulator/consumer.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index cef8f04efc3..b6c8d717c7e 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -137,7 +137,7 @@ struct regulator *__must_check devm_regulator_get(struct device *dev, struct regulator *__must_check regulator_get_exclusive(struct device *dev, const char *id); void regulator_put(struct regulator *regulator); -void devm_regulator_free(struct regulator *regulator); +void devm_regulator_put(struct regulator *regulator); /* regulator output control and status */ int regulator_enable(struct regulator *regulator); @@ -216,6 +216,10 @@ static inline void regulator_put(struct regulator *regulator) { } +static inline void devm_regulator_put(struct regulator *regulator) +{ +} + static inline int regulator_enable(struct regulator *regulator) { return 0; -- cgit v1.2.3 From 737f360d5bef5e01c6cfa755dca0b449a154c1e0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 2 Feb 2012 00:10:51 +0000 Subject: regulator: Remove support for supplies specified by struct device This has been deprecated for a very long time now. Signed-off-by: Mark Brown Reviewed-by: Linus Walleij Acked-by: Liam Girdwood --- include/linux/regulator/machine.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index f3f13fd5868..7abb1609331 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -139,12 +139,10 @@ struct regulation_constraints { * make struct device available late such as I2C and is the preferred * form. * - * @dev: Device structure for the consumer. * @dev_name: Result of dev_name() for the consumer. * @supply: Name for the supply. */ struct regulator_consumer_supply { - struct device *dev; /* consumer */ const char *dev_name; /* dev_name() for consumer */ const char *supply; /* consumer supply - e.g. "vcc" */ }; -- cgit v1.2.3 From fde297bb4d8075229b8985e9d4f96d32339a8e68 Mon Sep 17 00:00:00 2001 From: "Kim, Milo" Date: Thu, 16 Feb 2012 22:41:32 -0800 Subject: regulator: fix wrong header name in description The 'mode' is defined in consumer.h. * patch base version : linux-3.2.4 Signed-off-by: Milo(Woogyom) Kim Signed-off-by: Mark Brown --- include/linux/regulator/driver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4214b9a9d1c..aeaf3a73da2 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -104,7 +104,7 @@ struct regulator_ops { int (*disable) (struct regulator_dev *); int (*is_enabled) (struct regulator_dev *); - /* get/set regulator operating mode (defined in regulator.h) */ + /* get/set regulator operating mode (defined in consumer.h) */ int (*set_mode) (struct regulator_dev *, unsigned int mode); unsigned int (*get_mode) (struct regulator_dev *); @@ -135,7 +135,7 @@ struct regulator_ops { int (*set_suspend_enable) (struct regulator_dev *); int (*set_suspend_disable) (struct regulator_dev *); - /* set regulator suspend operating mode (defined in regulator.h) */ + /* set regulator suspend operating mode (defined in consumer.h) */ int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); }; -- cgit v1.2.3 From 247514344492a0cf602317d2089bab1301922624 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Mon, 20 Feb 2012 22:50:42 -0800 Subject: regulator: Remove ifdefs for debugfs code If CONFIG_DEBUG_FS=y debugfs functions will never return an ERR_PTR. Instead they'll return NULL. The intent is to remove ifdefs in calling code. Update the code to reflect this. We gain an extra dentry pointer per struct regulator and struct regulator_dev but that should be ok because most distros have debugfs compiled in anyway. Signed-off-by: Stephen Boyd Signed-off-by: Mark Brown --- include/linux/regulator/driver.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index aeaf3a73da2..fa8b55b8191 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -207,9 +207,7 @@ struct regulator_dev { void *reg_data; /* regulator_dev data */ -#ifdef CONFIG_DEBUG_FS struct dentry *debugfs; -#endif }; struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, -- cgit v1.2.3 From 613330a0f73b2698b2210ea89092eb56635fc5d8 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sat, 3 Mar 2012 12:40:02 +0100 Subject: regulator: provide a helper for registering a fixed regulator Some devices require a regulator to work, but boards may not have a software controllable regulator for this device. Provide a helper function to make it simpler for these boards to register a fixed regulator as a dummy regulator. Signed-off-by: Sascha Hauer Signed-off-by: Mark Brown --- include/linux/regulator/fixed.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/linux/regulator') diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index ffd7d508e72..936a7d8c11a 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h @@ -48,4 +48,17 @@ struct fixed_voltage_config { struct regulator_init_data *init_data; }; +struct regulator_consumer_supply; + +#if IS_ENABLED(CONFIG_REGULATOR) +struct platform_device *regulator_register_fixed(int id, + struct regulator_consumer_supply *supplies, int num_supplies); +#else +static inline struct platform_device *regulator_register_fixed(int id, + struct regulator_consumer_supply *supplies, int num_supplies) +{ + return NULL; +} +#endif + #endif -- cgit v1.2.3