Skip to content

Commit eda79a3

Browse files
Adrian HunterLiam Girdwood
authored andcommitted
regulator: Add 'start-up time' to fixed voltage regulators
Add a field to specify a delay for the start-up time of a fixed voltage regulator. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
1 parent 75c8ac2 commit eda79a3

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/regulator/fixed.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
#include <linux/regulator/driver.h>
2525
#include <linux/regulator/fixed.h>
2626
#include <linux/gpio.h>
27+
#include <linux/delay.h>
2728

2829
struct fixed_voltage_data {
2930
struct regulator_desc desc;
3031
struct regulator_dev *dev;
3132
int microvolts;
3233
int gpio;
34+
unsigned startup_delay;
3335
unsigned enable_high:1;
3436
unsigned is_enabled:1;
3537
};
@@ -48,6 +50,8 @@ static int fixed_voltage_enable(struct regulator_dev *dev)
4850
if (gpio_is_valid(data->gpio)) {
4951
gpio_set_value_cansleep(data->gpio, data->enable_high);
5052
data->is_enabled = 1;
53+
if (data->startup_delay)
54+
udelay(data->startup_delay);
5155
}
5256

5357
return 0;
@@ -117,6 +121,7 @@ static int regulator_fixed_voltage_probe(struct platform_device *pdev)
117121

118122
drvdata->microvolts = config->microvolts;
119123
drvdata->gpio = config->gpio;
124+
drvdata->startup_delay = config->startup_delay;
120125

121126
if (gpio_is_valid(config->gpio)) {
122127
drvdata->enable_high = config->enable_high;

‎include/linux/regulator/fixed.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct regulator_init_data;
2525
* @microvolts: Output voltage of regulator
2626
* @gpio: GPIO to use for enable control
2727
* set to -EINVAL if not used
28+
* @startup_delay: Start-up time in microseconds
2829
* @enable_high: Polarity of enable GPIO
2930
* 1 = Active high, 0 = Active low
3031
* @enabled_at_boot: Whether regulator has been enabled at
@@ -41,6 +42,7 @@ struct fixed_voltage_config {
4142
const char *supply_name;
4243
int microvolts;
4344
int gpio;
45+
unsigned startup_delay;
4446
unsigned enable_high:1;
4547
unsigned enabled_at_boot:1;
4648
struct regulator_init_data *init_data;

0 commit comments

Comments
 (0)