regulator: core: add API to get min/max voltage for rails

Add API to get min/max rail voltage configured from platform for
given rails. This will help to set the pad voltage based on platform
specific power tree.

bug 200083043

Change-Id: I054734ca2a25b5c830525e27ab22e43534f67351
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/712001
(cherry picked from commit c0d1de0da091132d037e1bb32f2ee09b5c00369b)
Reviewed-on: http://git-master/r/1119836
Signed-off-by: Thomas Makin <halorocker89@gmail.com>
This commit is contained in:
Laxman Dewangan authored and Thomas Makin committed 2026-10-05 12:47:07 -05:00
1 parent b1f8d8dc78
commit 9652725d15
2 files changed
+33

No files matched your search

+31
View File
@@ -4837,6 +4837,37 @@ int regulator_get_voltage(struct regulator *regulator)
}
EXPORT_SYMBOL_GPL(regulator_get_voltage);
/**
* regulator_get_constraint_voltages - get platform specific constraint voltage,
* @regulator: regulator source
* @min_uV: Minimum microvolts.
* @max_uV: Maximum microvolts.
*
* This returns the current regulator voltage in uV.
*
* NOTE: If the regulator is disabled it will return the voltage value. This
* function should not be used to determine regulator state.
*/
int regulator_get_constraint_voltages(struct regulator *regulator,
int *min_uV, int *max_uV)
{
struct regulator_dev *rdev = regulator->rdev;
if (rdev->desc && rdev->desc->fixed_uV && rdev->desc->n_voltages == 1) {
*min_uV = rdev->desc->fixed_uV;
*max_uV = rdev->desc->fixed_uV;
return 0;
}
if (rdev->constraints) {
*min_uV = rdev->constraints->min_uV;
*max_uV = rdev->constraints->max_uV;
return 0;
}
return -EINVAL;
}
EXPORT_SYMBOL_GPL(regulator_get_constraint_voltages);
/**
* regulator_set_current_limit - set regulator output current limit
* @regulator: regulator source
+2
View File
@@ -229,6 +229,8 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
int regulator_set_voltage_time(struct regulator *regulator,
int old_uV, int new_uV);
int regulator_get_voltage(struct regulator *regulator);
int regulator_get_constraint_voltages(struct regulator *regulator,
int *min_uV, int *max_uV);
int regulator_sync_voltage(struct regulator *regulator);
int regulator_set_current_limit(struct regulator *regulator,
int min_uA, int max_uA);