Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302144
b: refs/heads/master
c: a4d9f17
h: refs/heads/master
v: v3
  • Loading branch information
Laxman Dewangan authored and Mark Brown committed Apr 2, 2012
1 parent 04905db commit ef5cc66
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1cf4f65e1eb17bc8768d822755780588e42cf37
refs/heads/master: a4d9f179cc788b7f4b735d32c2e4a3b2562e8240
23 changes: 11 additions & 12 deletions trunk/drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->startup_delay = config->startup_delay;

if (gpio_is_valid(config->gpio)) {
int gpio_flag;
drvdata->enable_high = config->enable_high;

/* FIXME: Remove below print warning
Expand All @@ -219,27 +220,25 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
dev_warn(&pdev->dev,
"using GPIO 0 for regulator enable control\n");

ret = gpio_request(config->gpio, config->supply_name);
if (ret) {
dev_err(&pdev->dev,
"Could not obtain regulator enable GPIO %d: %d\n",
config->gpio, ret);
goto err_name;
}

/* set output direction without changing state
/*
* set output direction without changing state
* to prevent glitch
*/
drvdata->is_enabled = config->enabled_at_boot;
ret = drvdata->is_enabled ?
config->enable_high : !config->enable_high;
gpio_flag = ret ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;

if (config->gpio_is_open_drain)
gpio_flag |= GPIOF_OPEN_DRAIN;

ret = gpio_direction_output(config->gpio, ret);
ret = gpio_request_one(config->gpio, gpio_flag,
config->supply_name);
if (ret) {
dev_err(&pdev->dev,
"Could not configure regulator enable GPIO %d direction: %d\n",
"Could not obtain regulator enable GPIO %d: %d\n",
config->gpio, ret);
goto err_gpio;
goto err_name;
}

drvdata->desc.ops = &fixed_voltage_gpio_ops;
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/regulator/fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ struct regulator_init_data;
* @gpio: GPIO to use for enable control
* set to -EINVAL if not used
* @startup_delay: Start-up time in microseconds
* @gpio_is_open_drain: Gpio pin is open drain or normal type.
* If it is open drain type then HIGH will be set
* through PULL-UP with setting gpio as input
* and low will be set as gpio-output with driven
* to low. For non-open-drain case, the gpio will
* will be in output and drive to low/high accordingly.
* @enable_high: Polarity of enable GPIO
* 1 = Active high, 0 = Active low
* @enabled_at_boot: Whether regulator has been enabled at
Expand All @@ -43,6 +49,7 @@ struct fixed_voltage_config {
int microvolts;
int gpio;
unsigned startup_delay;
unsigned gpio_is_open_drain:1;
unsigned enable_high:1;
unsigned enabled_at_boot:1;
struct regulator_init_data *init_data;
Expand Down

0 comments on commit ef5cc66

Please sign in to comment.