mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 14:52:34 +00:00
regulator: Add pull down support
Some regulators need to be configured to pull down a resistor when the regulator is disabled. Add an op (set_pull_down) and a DT property + constraint to support this. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
22a10bca28
commit
23c779b9f9
5 changed files with 18 additions and 0 deletions
|
@ -39,6 +39,7 @@ Optional properties:
|
||||||
documentation explains which values the regulator supports.
|
documentation explains which values the regulator supports.
|
||||||
- regulator-system-load: Load in uA present on regulator that is not captured by
|
- regulator-system-load: Load in uA present on regulator that is not captured by
|
||||||
any consumer request.
|
any consumer request.
|
||||||
|
- regulator-pull-down: Enable pull down resistor when the regulator is disabled.
|
||||||
|
|
||||||
Deprecated properties:
|
Deprecated properties:
|
||||||
- regulator-compatible: If a regulator chip contains multiple
|
- regulator-compatible: If a regulator chip contains multiple
|
||||||
|
|
|
@ -1051,6 +1051,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_constraints(rdev);
|
print_constraints(rdev);
|
||||||
return 0;
|
return 0;
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -67,6 +67,8 @@ static void of_get_regulation_constraints(struct device_node *np,
|
||||||
if (!constraints->always_on) /* status change should be possible. */
|
if (!constraints->always_on) /* status change should be possible. */
|
||||||
constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;
|
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"))
|
if (of_property_read_bool(np, "regulator-allow-bypass"))
|
||||||
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
|
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,9 @@ struct regulator_linear_range {
|
||||||
* @set_suspend_mode: Set the operating mode for the regulator when the
|
* @set_suspend_mode: Set the operating mode for the regulator when the
|
||||||
* system is suspended.
|
* system is suspended.
|
||||||
*
|
*
|
||||||
|
* @set_pull_down: Configure the regulator to pull down when the regulator
|
||||||
|
* is disabled.
|
||||||
|
*
|
||||||
* This struct describes regulator operations which can be implemented by
|
* This struct describes regulator operations which can be implemented by
|
||||||
* regulator chip drivers.
|
* regulator chip drivers.
|
||||||
*/
|
*/
|
||||||
|
@ -187,6 +190,8 @@ struct regulator_ops {
|
||||||
|
|
||||||
/* set regulator suspend operating mode (defined in consumer.h) */
|
/* set regulator suspend operating mode (defined in consumer.h) */
|
||||||
int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
|
int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
|
||||||
|
|
||||||
|
int (*set_pull_down) (struct regulator_dev *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct regulator_state {
|
||||||
* applied.
|
* applied.
|
||||||
* @apply_uV: Apply the voltage constraint when initialising.
|
* @apply_uV: Apply the voltage constraint when initialising.
|
||||||
* @ramp_disable: Disable ramp delay when initialising or when setting voltage.
|
* @ramp_disable: Disable ramp delay when initialising or when setting voltage.
|
||||||
|
* @pull_down: Enable pull down when regulator is disabled.
|
||||||
*
|
*
|
||||||
* @input_uV: Input voltage for regulator when supplied by another regulator.
|
* @input_uV: Input voltage for regulator when supplied by another regulator.
|
||||||
*
|
*
|
||||||
|
@ -141,6 +142,7 @@ struct regulation_constraints {
|
||||||
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
|
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
|
||||||
unsigned apply_uV:1; /* apply uV constraint if min == max */
|
unsigned apply_uV:1; /* apply uV constraint if min == max */
|
||||||
unsigned ramp_disable:1; /* disable ramp delay */
|
unsigned ramp_disable:1; /* disable ramp delay */
|
||||||
|
unsigned pull_down:1; /* pull down resistor when regulator off */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue