Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312553
b: refs/heads/master
c: 6f0b2c6
h: refs/heads/master
i:
  312551: a29b09b
v: v3
  • Loading branch information
Yadwinder Singh Brar authored and Mark Brown committed Jun 17, 2012
1 parent 26c44be commit 83696c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 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: b5fb77e0188dc85630b395eb0faddc4987be6ddb
refs/heads/master: 6f0b2c696ca340cc2da381fe693fda3f8fdb2149
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Optional properties:
- regulator-always-on: boolean, regulator should never be disabled
- regulator-boot-on: bootloader/firmware enabled regulator
- <name>-supply: phandle to the parent supply/regulator node
- regulator-ramp-delay: ramp delay for regulator(in mV/uS)

Example:

Expand Down
23 changes: 19 additions & 4 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}

if (rdev->constraints->ramp_delay && ops->set_ramp_delay) {
ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay);
if (ret < 0) {
rdev_err(rdev, "failed to set ramp_delay\n");
goto out;
}
}

print_constraints(rdev);
return 0;
out:
Expand Down Expand Up @@ -2296,10 +2304,17 @@ int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{
if (rdev->desc->ramp_delay && rdev->desc->uV_step)
return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector),
rdev->desc->ramp_delay * 1000);
if (rdev->desc->uV_step) {
if (rdev->constraints->ramp_delay)
return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector),
rdev->constraints->ramp_delay * 1000);
if (rdev->desc->ramp_delay)
return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector),
rdev->desc->ramp_delay * 1000);
rdev_warn(rdev, "ramp_delay not set\n");
}
return 0;
}

Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/regulator/of_regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void of_get_regulation_constraints(struct device_node *np,
struct regulator_init_data **init_data)
{
const __be32 *min_uV, *max_uV, *uV_offset;
const __be32 *min_uA, *max_uA;
const __be32 *min_uA, *max_uA, *ramp_delay;
struct regulation_constraints *constraints = &(*init_data)->constraints;

constraints->name = of_get_property(np, "regulator-name", NULL);
Expand Down Expand Up @@ -60,6 +60,10 @@ static void of_get_regulation_constraints(struct device_node *np,
constraints->always_on = true;
else /* status change should be possible if not always on. */
constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;

ramp_delay = of_get_property(np, "regulator-ramp-delay", NULL);
if (ramp_delay)
constraints->min_uV = be32_to_cpu(*ramp_delay);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/regulator/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ enum regulator_status {
*
* @enable_time: Time taken for the regulator voltage output voltage to
* stabilise after being enabled, in microseconds.
* @set_ramp_delay: Set the ramp delay for the regulator. The driver should
* select ramp delay equal to or less than(closest) ramp_delay.
* @set_voltage_time_sel: Time taken for the regulator voltage output voltage
* to stabilise after being set to a new value, in microseconds.
* The function provides the from and to voltage selector, the
Expand Down Expand Up @@ -113,6 +115,7 @@ struct regulator_ops {

/* Time taken to enable or set voltage on the regulator */
int (*enable_time) (struct regulator_dev *);
int (*set_ramp_delay) (struct regulator_dev *, int ramp_delay);
int (*set_voltage_time_sel) (struct regulator_dev *,
unsigned int old_selector,
unsigned int new_selector);
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/regulator/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct regulator_state {
* mode.
* @initial_state: Suspend state to set by default.
* @initial_mode: Mode to set at startup.
* @ramp_delay: Time to settle down after voltage change (unit: mV/us)
*/
struct regulation_constraints {

Expand Down Expand Up @@ -125,6 +126,8 @@ struct regulation_constraints {
/* mode to set on startup */
unsigned int initial_mode;

unsigned int ramp_delay;

/* constraint flags */
unsigned always_on:1; /* regulator never off when system is on */
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
Expand Down

0 comments on commit 83696c5

Please sign in to comment.