| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * fixed.h | 
 | 3 |  * | 
 | 4 |  * Copyright 2008 Wolfson Microelectronics PLC. | 
 | 5 |  * | 
 | 6 |  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | 
 | 7 |  * | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 8 |  * Copyright (c) 2009 Nokia Corporation | 
 | 9 |  * Roger Quadros <ext-roger.quadros@nokia.com> | 
 | 10 |  * | 
| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 11 |  * This program is free software; you can redistribute it and/or | 
 | 12 |  * modify it under the terms of the GNU General Public License as | 
 | 13 |  * published by the Free Software Foundation; either version 2 of the | 
 | 14 |  * License, or (at your option) any later version. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #ifndef __REGULATOR_FIXED_H | 
 | 18 | #define __REGULATOR_FIXED_H | 
 | 19 |  | 
| Mark Brown | bcf3402 | 2009-01-19 13:37:04 +0000 | [diff] [blame] | 20 | struct regulator_init_data; | 
 | 21 |  | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 22 | /** | 
 | 23 |  * struct fixed_voltage_config - fixed_voltage_config structure | 
 | 24 |  * @supply_name:	Name of the regulator supply | 
| Laxman Dewangan | 6be5bfc | 2012-07-05 18:12:01 +0530 | [diff] [blame] | 25 |  * @input_supply:	Name of the input regulator supply | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 26 |  * @microvolts:		Output voltage of regulator | 
 | 27 |  * @gpio:		GPIO to use for enable control | 
 | 28 |  * 			set to -EINVAL if not used | 
| Adrian Hunter | eda79a3 | 2010-01-12 12:25:13 +0200 | [diff] [blame] | 29 |  * @startup_delay:	Start-up time in microseconds | 
| Laxman Dewangan | a4d9f17 | 2012-03-07 15:58:33 +0530 | [diff] [blame] | 30 |  * @gpio_is_open_drain: Gpio pin is open drain or normal type. | 
 | 31 |  *			If it is open drain type then HIGH will be set | 
 | 32 |  *			through PULL-UP with setting gpio as input | 
 | 33 |  *			and low will be set as gpio-output with driven | 
 | 34 |  *			to low. For non-open-drain case, the gpio will | 
 | 35 |  *			will be in output and drive to low/high accordingly. | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 36 |  * @enable_high:	Polarity of enable GPIO | 
 | 37 |  *			1 = Active high, 0 = Active low | 
 | 38 |  * @enabled_at_boot:	Whether regulator has been enabled at | 
 | 39 |  * 			boot or not. 1 = Yes, 0 = No | 
 | 40 |  * 			This is used to keep the regulator at | 
 | 41 |  * 			the default state | 
 | 42 |  * @init_data:		regulator_init_data | 
 | 43 |  * | 
 | 44 |  * This structure contains fixed voltage regulator configuration | 
 | 45 |  * information that must be passed by platform code to the fixed | 
 | 46 |  * voltage regulator driver. | 
 | 47 |  */ | 
| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 48 | struct fixed_voltage_config { | 
 | 49 | 	const char *supply_name; | 
| Laxman Dewangan | 6be5bfc | 2012-07-05 18:12:01 +0530 | [diff] [blame] | 50 | 	const char *input_supply; | 
| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 51 | 	int microvolts; | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 52 | 	int gpio; | 
| Adrian Hunter | eda79a3 | 2010-01-12 12:25:13 +0200 | [diff] [blame] | 53 | 	unsigned startup_delay; | 
| Laxman Dewangan | a4d9f17 | 2012-03-07 15:58:33 +0530 | [diff] [blame] | 54 | 	unsigned gpio_is_open_drain:1; | 
| Roger Quadros | 86d9884 | 2009-08-06 19:37:29 +0300 | [diff] [blame] | 55 | 	unsigned enable_high:1; | 
 | 56 | 	unsigned enabled_at_boot:1; | 
| Mark Brown | bcf3402 | 2009-01-19 13:37:04 +0000 | [diff] [blame] | 57 | 	struct regulator_init_data *init_data; | 
| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 58 | }; | 
 | 59 |  | 
| Sascha Hauer | 613330a | 2012-03-03 12:40:02 +0100 | [diff] [blame] | 60 | struct regulator_consumer_supply; | 
 | 61 |  | 
 | 62 | #if IS_ENABLED(CONFIG_REGULATOR) | 
| Guennadi Liakhovetski | dfad84a | 2012-06-19 17:43:56 +0200 | [diff] [blame] | 63 | struct platform_device *regulator_register_always_on(int id, const char *name, | 
| Guennadi Liakhovetski | 15719cc | 2012-06-19 17:44:39 +0200 | [diff] [blame] | 64 | 		struct regulator_consumer_supply *supplies, int num_supplies, int uv); | 
| Sascha Hauer | 613330a | 2012-03-03 12:40:02 +0100 | [diff] [blame] | 65 | #else | 
| Guennadi Liakhovetski | dfad84a | 2012-06-19 17:43:56 +0200 | [diff] [blame] | 66 | static inline struct platform_device *regulator_register_always_on(int id, const char *name, | 
| Guennadi Liakhovetski | 15719cc | 2012-06-19 17:44:39 +0200 | [diff] [blame] | 67 | 		struct regulator_consumer_supply *supplies, int num_supplies, int uv) | 
| Sascha Hauer | 613330a | 2012-03-03 12:40:02 +0100 | [diff] [blame] | 68 | { | 
 | 69 | 	return NULL; | 
 | 70 | } | 
 | 71 | #endif | 
 | 72 |  | 
| Guennadi Liakhovetski | dfad84a | 2012-06-19 17:43:56 +0200 | [diff] [blame] | 73 | #define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \ | 
| Guennadi Liakhovetski | 15719cc | 2012-06-19 17:44:39 +0200 | [diff] [blame] | 74 | 						"fixed-dummy", s, ns, 0) | 
| Guennadi Liakhovetski | dfad84a | 2012-06-19 17:43:56 +0200 | [diff] [blame] | 75 |  | 
| Mark Brown | 48d335b | 2008-04-30 15:50:21 +0100 | [diff] [blame] | 76 | #endif |