regulator: Add 'start-up time' to fixed voltage regulators
authorAdrian Hunter <adrian.hunter@nokia.com>
Tue, 12 Jan 2010 10:25:13 +0000 (12:25 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 3 Mar 2010 14:49:23 +0000 (14:49 +0000)
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>
drivers/regulator/fixed.c
include/linux/regulator/fixed.h

index f9f516a3028aa219a9dee0b397fc7e85fd54888d..ee3e7eb97b1c9155c5a731b296df93d7c1acc3d4 100644 (file)
 #include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
 #include <linux/gpio.h>
+#include <linux/delay.h>
 
 struct fixed_voltage_data {
        struct regulator_desc desc;
        struct regulator_dev *dev;
        int microvolts;
        int gpio;
+       unsigned startup_delay;
        unsigned enable_high:1;
        unsigned is_enabled:1;
 };
@@ -48,6 +50,8 @@ static int fixed_voltage_enable(struct regulator_dev *dev)
        if (gpio_is_valid(data->gpio)) {
                gpio_set_value_cansleep(data->gpio, data->enable_high);
                data->is_enabled = 1;
+               if (data->startup_delay)
+                       udelay(data->startup_delay);
        }
 
        return 0;
@@ -117,6 +121,7 @@ static int regulator_fixed_voltage_probe(struct platform_device *pdev)
 
        drvdata->microvolts = config->microvolts;
        drvdata->gpio = config->gpio;
+       drvdata->startup_delay = config->startup_delay;
 
        if (gpio_is_valid(config->gpio)) {
                drvdata->enable_high = config->enable_high;
index e94a4a1c7c8a705d6f0887f9d82cd7cef57f723f..ffd7d508e726f7d191296dac71254372b591d348 100644 (file)
@@ -25,6 +25,7 @@ struct regulator_init_data;
  * @microvolts:                Output voltage of regulator
  * @gpio:              GPIO to use for enable control
  *                     set to -EINVAL if not used
+ * @startup_delay:     Start-up time in microseconds
  * @enable_high:       Polarity of enable GPIO
  *                     1 = Active high, 0 = Active low
  * @enabled_at_boot:   Whether regulator has been enabled at
@@ -41,6 +42,7 @@ struct fixed_voltage_config {
        const char *supply_name;
        int microvolts;
        int gpio;
+       unsigned startup_delay;
        unsigned enable_high:1;
        unsigned enabled_at_boot:1;
        struct regulator_init_data *init_data;