regulator: Add helpers for low-level register access

Add helper functions that allow regulator consumers to obtain low-level
details about the regulator hardware, like the voltage selector register
address and such. These details can be useful when configuring hardware
or firmware that want to do low-level access to regulators, with no
involvement from the kernel.

The use-case for Tegra is a voltage-controlled oscillator clocksource
which has control logic to change the supply voltage via I2C to achieve
a desired output clock rate.

Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Tuomas Tynkkynen
2014-07-21 18:38:48 +03:00
committed by Mark Brown
parent 7171511eae
commit 04eca28cde
3 changed files with 132 additions and 0 deletions

View File

@@ -37,6 +37,7 @@
struct device;
struct notifier_block;
struct regmap;
/*
* Regulator operating modes.
@@ -215,6 +216,13 @@ int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
int regulator_allow_bypass(struct regulator *regulator, bool allow);
struct regmap *regulator_get_regmap(struct regulator *regulator);
int regulator_get_hardware_vsel_register(struct regulator *regulator,
unsigned *vsel_reg,
unsigned *vsel_mask);
int regulator_list_hardware_vsel(struct regulator *regulator,
unsigned selector);
/* regulator notifier block */
int regulator_register_notifier(struct regulator *regulator,
struct notifier_block *nb);
@@ -452,6 +460,24 @@ static inline int regulator_allow_bypass(struct regulator *regulator,
return 0;
}
struct regmap *regulator_get_regmap(struct regulator *regulator)
{
return ERR_PTR(-EOPNOTSUPP);
}
int regulator_get_hardware_vsel_register(struct regulator *regulator,
unsigned *vsel_reg,
unsigned *vsel_mask)
{
return -EOPNOTSUPP;
}
int regulator_list_hardware_vsel(struct regulator *regulator,
unsigned selector)
{
return -EOPNOTSUPP;
}
static inline int regulator_register_notifier(struct regulator *regulator,
struct notifier_block *nb)
{