diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-05-03 09:17:01 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-05-03 09:17:01 +0200 |
commit | 53ba4f2fa73225113a488584df0d85d3cba52943 (patch) | |
tree | d85b984d9818abc3ccc0237eb53b710d9e96c39e /drivers/regulator/fixed.c | |
parent | lockstat: Make lockstat counting per cpu (diff) | |
parent | Linux 2.6.34-rc6 (diff) | |
download | linux-53ba4f2fa73225113a488584df0d85d3cba52943.tar.xz linux-53ba4f2fa73225113a488584df0d85d3cba52943.zip |
Merge commit 'v2.6.34-rc6' into core/locking
Diffstat (limited to 'drivers/regulator/fixed.c')
-rw-r--r-- | drivers/regulator/fixed.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index f9f516a3028a..2fe9d99c9f23 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -24,14 +24,17 @@ #include <linux/regulator/driver.h> #include <linux/regulator/fixed.h> #include <linux/gpio.h> +#include <linux/delay.h> +#include <linux/slab.h> struct fixed_voltage_data { struct regulator_desc desc; struct regulator_dev *dev; int microvolts; int gpio; - unsigned enable_high:1; - unsigned is_enabled:1; + unsigned startup_delay; + bool enable_high; + bool is_enabled; }; static int fixed_voltage_is_enabled(struct regulator_dev *dev) @@ -47,7 +50,7 @@ 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; + data->is_enabled = true; } return 0; @@ -59,12 +62,19 @@ static int fixed_voltage_disable(struct regulator_dev *dev) if (gpio_is_valid(data->gpio)) { gpio_set_value_cansleep(data->gpio, !data->enable_high); - data->is_enabled = 0; + data->is_enabled = false; } return 0; } +static int fixed_voltage_enable_time(struct regulator_dev *dev) +{ + struct fixed_voltage_data *data = rdev_get_drvdata(dev); + + return data->startup_delay; +} + static int fixed_voltage_get_voltage(struct regulator_dev *dev) { struct fixed_voltage_data *data = rdev_get_drvdata(dev); @@ -87,11 +97,12 @@ static struct regulator_ops fixed_voltage_ops = { .is_enabled = fixed_voltage_is_enabled, .enable = fixed_voltage_enable, .disable = fixed_voltage_disable, + .enable_time = fixed_voltage_enable_time, .get_voltage = fixed_voltage_get_voltage, .list_voltage = fixed_voltage_list_voltage, }; -static int regulator_fixed_voltage_probe(struct platform_device *pdev) +static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) { struct fixed_voltage_config *config = pdev->dev.platform_data; struct fixed_voltage_data *drvdata; @@ -117,6 +128,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; @@ -163,7 +175,7 @@ static int regulator_fixed_voltage_probe(struct platform_device *pdev) /* Regulator without GPIO control is considered * always enabled */ - drvdata->is_enabled = 1; + drvdata->is_enabled = true; } drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, @@ -191,7 +203,7 @@ err: return ret; } -static int regulator_fixed_voltage_remove(struct platform_device *pdev) +static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) { struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); @@ -205,10 +217,11 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev) } static struct platform_driver regulator_fixed_voltage_driver = { - .probe = regulator_fixed_voltage_probe, - .remove = regulator_fixed_voltage_remove, + .probe = reg_fixed_voltage_probe, + .remove = __devexit_p(reg_fixed_voltage_remove), .driver = { .name = "reg-fixed-voltage", + .owner = THIS_MODULE, }, }; |