- regulator-microvolt-offset: Offset applied to voltages to compensate for voltage drops
- regulator-min-microamp: smallest current consumers may set
- regulator-max-microamp: largest current consumers may set
+++++ - regulator-input-current-limit-microamp: maximum input current regulator allows
- regulator-always-on: boolean, regulator should never be disabled
- regulator-boot-on: bootloader/firmware enabled regulator
- regulator-allow-bypass: allow the regulator to go into bypass mode
- <name>-supply: phandle to the parent supply/regulator node
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
For hardware which supports disabling ramp rate, it should be explicitly
-- --- intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
++ +++ initialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
rail to reach the target voltage, plus/minus whatever tolerance the board
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.
+++++ - regulator-soft-start: Enable soft start so that voltage ramps slowly
- regulator-state-mem sub-root node for Suspend-to-RAM mode
: suspend to memory, the device goes to sleep, but all data stored in memory,
only some external interrupt can wake the device.
- regulator-initial-mode: initial operating mode. The set of possible operating
modes depends on the capabilities of every hardware so each device binding
documentation explains which values the regulator supports.
+++++ - regulator-system-load: Load in uA present on regulator that is not captured by
+++++ any consumer request.
+++++ - regulator-pull-down: Enable pull down resistor when the regulator is disabled.
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
list_for_each_entry(sibling, &rdev->consumer_list, list)
current_uA += sibling->uA_load;
+++++ current_uA += rdev->constraints->system_load;
+++++
if (rdev->desc->ops->set_load) {
/* set the optimum mode for our new total regulator load */
err = rdev->desc->ops->set_load(rdev, current_uA);
static void print_constraints(struct regulator_dev *rdev)
{
struct regulation_constraints *constraints = rdev->constraints;
----- char buf[80] = "";
+++++ char buf[160] = "";
+++++ size_t len = sizeof(buf) - 1;
int count = 0;
int ret;
if (constraints->min_uV && constraints->max_uV) {
if (constraints->min_uV == constraints->max_uV)
----- count += sprintf(buf + count, "%d mV ",
----- constraints->min_uV / 1000);
+++++ count += scnprintf(buf + count, len - count, "%d mV ",
+++++ constraints->min_uV / 1000);
else
----- count += sprintf(buf + count, "%d <--> %d mV ",
----- constraints->min_uV / 1000,
----- constraints->max_uV / 1000);
+++++ count += scnprintf(buf + count, len - count,
+++++ "%d <--> %d mV ",
+++++ constraints->min_uV / 1000,
+++++ constraints->max_uV / 1000);
}
if (!constraints->min_uV ||
constraints->min_uV != constraints->max_uV) {
ret = _regulator_get_voltage(rdev);
if (ret > 0)
----- count += sprintf(buf + count, "at %d mV ", ret / 1000);
+++++ count += scnprintf(buf + count, len - count,
+++++ "at %d mV ", ret / 1000);
}
if (constraints->uV_offset)
----- count += sprintf(buf, "%dmV offset ",
----- constraints->uV_offset / 1000);
+++++ count += scnprintf(buf + count, len - count, "%dmV offset ",
+++++ constraints->uV_offset / 1000);
if (constraints->min_uA && constraints->max_uA) {
if (constraints->min_uA == constraints->max_uA)
----- count += sprintf(buf + count, "%d mA ",
----- constraints->min_uA / 1000);
+++++ count += scnprintf(buf + count, len - count, "%d mA ",
+++++ constraints->min_uA / 1000);
else
----- count += sprintf(buf + count, "%d <--> %d mA ",
----- constraints->min_uA / 1000,
----- constraints->max_uA / 1000);
+++++ count += scnprintf(buf + count, len - count,
+++++ "%d <--> %d mA ",
+++++ constraints->min_uA / 1000,
+++++ constraints->max_uA / 1000);
}
if (!constraints->min_uA ||
constraints->min_uA != constraints->max_uA) {
ret = _regulator_get_current_limit(rdev);
if (ret > 0)
----- count += sprintf(buf + count, "at %d mA ", ret / 1000);
+++++ count += scnprintf(buf + count, len - count,
+++++ "at %d mA ", ret / 1000);
}
if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
----- count += sprintf(buf + count, "fast ");
+++++ count += scnprintf(buf + count, len - count, "fast ");
if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL)
----- count += sprintf(buf + count, "normal ");
+++++ count += scnprintf(buf + count, len - count, "normal ");
if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE)
----- count += sprintf(buf + count, "idle ");
+++++ count += scnprintf(buf + count, len - count, "idle ");
if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
----- count += sprintf(buf + count, "standby");
+++++ count += scnprintf(buf + count, len - count, "standby");
if (!count)
----- sprintf(buf, "no parameters");
+++++ scnprintf(buf, len, "no parameters");
rdev_dbg(rdev, "%s\n", buf);
if (ret != 0)
goto out;
+++++ if (rdev->constraints->ilim_uA && ops->set_input_current_limit) {
+++++ ret = ops->set_input_current_limit(rdev,
+++++ rdev->constraints->ilim_uA);
+++++ if (ret < 0) {
+++++ rdev_err(rdev, "failed to set input limit\n");
+++++ goto out;
+++++ }
+++++ }
+++++
/* do we need to setup our suspend state */
if (rdev->constraints->initial_state) {
ret = suspend_prepare(rdev, rdev->constraints->initial_state);
}
}
+++++ if (rdev->constraints->pull_down && ops->set_pull_down) {
+++++ ret = ops->set_pull_down(rdev);
+++++ if (ret < 0) {
+++++ rdev_err(rdev, "failed to set pull down\n");
+++++ goto out;
+++++ }
+++++ }
+++++
+++++ if (rdev->constraints->soft_start && ops->set_soft_start) {
+++++ ret = ops->set_soft_start(rdev);
+++++ if (ret < 0) {
+++++ rdev_err(rdev, "failed to set soft start\n");
+++++ goto out;
+++++ }
+++++ }
+++++
print_constraints(rdev);
return 0;
out:
if (regulator->supply_name == NULL)
goto overflow_err;
----- err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
+++++ err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj,
buf);
if (err) {
----- rdev_warn(rdev, "could not add device link %s err %d\n",
+++++ rdev_dbg(rdev, "could not add device link %s err %d\n",
dev->kobj.name, err);
/* non-fatal */
}
if (!of_property_read_u32(np, "regulator-max-microamp", &pval))
constraints->max_uA = pval;
+++++ if (!of_property_read_u32(np, "regulator-input-current-limit-microamp",
+++++ &pval))
+++++ constraints->ilim_uA = pval;
+++++
/* Current change possible? */
if (constraints->min_uA != constraints->max_uA)
constraints->valid_ops_mask |= REGULATOR_CHANGE_CURRENT;
if (!constraints->always_on) /* status change should be possible. */
constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;
+++++ constraints->pull_down = of_property_read_bool(np, "regulator-pull-down");
+++++
if (of_property_read_bool(np, "regulator-allow-bypass"))
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
if (!ret)
constraints->enable_time = pval;
+++++ constraints->soft_start = of_property_read_bool(np,
+++++ "regulator-soft-start");
+++++
if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
if (desc && desc->of_map_mode) {
ret = desc->of_map_mode(pval);
}
}
+++++ if (!of_property_read_u32(np, "regulator-system-load", &pval))
+++++ constraints->system_load = pval;
+++++
for (i = 0; i < ARRAY_SIZE(regulator_states); i++) {
switch (i) {
case PM_SUSPEND_MEM:
case PM_SUSPEND_STANDBY:
default:
continue;
----- };
+++++ }
suspend_np = of_get_child_by_name(np, regulator_states[i]);
if (!suspend_np || !suspend_state)