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') diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h new file mode 100644 index 000000000000..6a5c1b2c751e --- /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.1 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') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0edfc4..bcfe10658763 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.1 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') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index bcfe10658763..60c2f996d895 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.1 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') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 60c2f996d895..35c42834ba3d 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.1 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') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 35c42834ba3d..cef8f04efc34 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.1 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') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index cef8f04efc34..b6c8d717c7ec 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.1 From 1e0c66f49762fa1866ab20b1feb6e86a9aa4838f Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Sat, 28 Jan 2012 15:07:57 +0530 Subject: regulator: tps65910: Sleep control through external inputs Add support for sleep controls of different regulator through external inputs EN1, EN2 or EN3. Each regulator's output will be active when its external input is high and turns to OFF/Low power mode when its external input is low. The configuration parameters for sleep control is provided through board specific platform data. Signed-off-by: Laxman Dewangan Signed-off-by: Mark Brown --- include/linux/mfd/tps65910.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index d0cb12eba402..fa6c6bf7a54d 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -768,6 +768,13 @@ /* Max number of TPS65910/11 regulators */ #define TPS65910_NUM_REGS 13 +/* External sleep controls through EN1/EN2/EN3 inputs*/ +#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1 +#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2 +#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4 +/* TPS65911 names the EN3 signal as SLEEP */ +#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x4 + /** * struct tps65910_board * Board platform data may be used to initialize regulators. @@ -779,6 +786,7 @@ struct tps65910_board { int irq_base; int vmbch_threshold; int vmbch2_threshold; + unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; }; -- cgit v1.2.1 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') diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index f3f13fd5868f..7abb16093312 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.1 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') diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4214b9a9d1c9..aeaf3a73da2b 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.1 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') diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index aeaf3a73da2b..fa8b55b8191c 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.1 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') diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index ffd7d508e726..936a7d8c11a9 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.1 From 63bfff4e20211b464cbea6e79e5fd36df227c154 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Thu, 16 Feb 2012 12:27:52 +0200 Subject: regulator: twl4030: add support for external voltage get/set This is needed for SMPS regulators, which use the OMAP voltage processor for voltage get/set functions instead of the normal I2C channel. For this purpose, regulator_init_data->driver_data contents are expanded, it is now a struct which contains function pointers for the set/get voltage operations, a data pointer for these, and the previously used features bitmask. Signed-off-by: Tero Kristo Acked-by: Samuel Ortiz [for the MFD part] Signed-off-by: Mark Brown --- include/linux/i2c/twl.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 78d3465251d6..08a82d314f24 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -749,6 +749,13 @@ struct twl4030_platform_data { struct regulator_init_data *vio6025; }; +struct twl_regulator_driver_data { + int (*set_voltage)(void *data, int target_uV); + int (*get_voltage)(void *data); + void *data; + unsigned long features; +}; + /*----------------------------------------------------------------------*/ int twl4030_sih_setup(int module); -- cgit v1.2.1 From 34a38440689b06a515104d668494e0ff8a4e1537 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Tue, 28 Feb 2012 15:09:10 +0530 Subject: regulator: twl6030: add support for vdd1, vdd2 and vdd3 regulators vdd1 and vdd2 are now common regulators for twl4030 and twl6030. Also added vdd3 as a new regulator for twl6030. twl6030 vdd1...vdd3 smps regulator voltages can only be controlled through the smartreflex voltage channel, thus the support for the voltage_get and set is minimal and requires external controller. Signed-off-by: Tero Kristo Signed-off-by: Rajendra Nayak Acked-by: Samuel Ortiz Signed-off-by: Mark Brown --- include/linux/i2c/twl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 08a82d314f24..f66c0311e448 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -712,6 +712,9 @@ struct twl4030_platform_data { struct regulator_init_data *vaux1; struct regulator_init_data *vaux2; struct regulator_init_data *vaux3; + struct regulator_init_data *vdd1; + struct regulator_init_data *vdd2; + struct regulator_init_data *vdd3; /* TWL4030 LDO regulators */ struct regulator_init_data *vpll1; struct regulator_init_data *vpll2; @@ -720,8 +723,6 @@ struct twl4030_platform_data { struct regulator_init_data *vsim; struct regulator_init_data *vaux4; struct regulator_init_data *vio; - struct regulator_init_data *vdd1; - struct regulator_init_data *vdd2; struct regulator_init_data *vintana1; struct regulator_init_data *vintana2; struct regulator_init_data *vintdig; -- cgit v1.2.1 From 46eda3e96a65b378041c79c51ff2e02009f7e2d0 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 28 Feb 2012 15:09:13 +0530 Subject: mfd: twl-core: regulator configuration for twl6030 V1V8, V2V1 SMPS To be able to attach consumers to these supplies from board files we need to have regulator_init_data for them. Signed-off-by: Peter Ujfalusi Signed-off-by: Rajendra Nayak Signed-off-by: Mark Brown --- include/linux/i2c/twl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index f66c0311e448..7fcab23c59ce 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -734,6 +734,8 @@ struct twl4030_platform_data { struct regulator_init_data *vcxio; struct regulator_init_data *vusb; struct regulator_init_data *clk32kg; + struct regulator_init_data *v1v8; + struct regulator_init_data *v2v1; /* TWL6025 LDO regulators */ struct regulator_init_data *ldo1; struct regulator_init_data *ldo2; -- cgit v1.2.1 From f30b0716feaedc0cf432ed8eca82c46104d64c0d Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Wed, 7 Mar 2012 18:21:49 +0530 Subject: regulator: tps65910: Sleep off rails when ext sleep configured Keep the rails OFF in sleep mode only when the rails are controlled by external sleep control. The devices tps65910 and tps65911, both has the sleep input. The tps65911's sleep input is not same as tps65910's EN3 and hence taking care of SLEEP input as separate external sleep control input. Signed-off-by: Laxman Dewangan Signed-off-by: Mark Brown --- include/linux/mfd/tps65910.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index fa6c6bf7a54d..76700b5eee92 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -768,12 +768,11 @@ /* Max number of TPS65910/11 regulators */ #define TPS65910_NUM_REGS 13 -/* External sleep controls through EN1/EN2/EN3 inputs*/ +/* External sleep controls through EN1/EN2/EN3/SLEEP inputs */ #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1 #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2 #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4 -/* TPS65911 names the EN3 signal as SLEEP */ -#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x4 +#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8 /** * struct tps65910_board -- cgit v1.2.1