Loading drivers/regulator/core.c +34 −0 Original line number Diff line number Diff line Loading @@ -2661,6 +2661,40 @@ int regulator_list_hardware_vsel(struct regulator *regulator, } EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel); /** * regulator_list_corner_voltage - return the maximum voltage in microvolts that * can be physically configured for the regulator when operating at the * specified voltage corner * @regulator: regulator source * @corner: voltage corner value * Context: can sleep * * This function can be used for regulators which allow scaling between * different voltage corners as opposed to be different absolute voltages. The * absolute voltage for a given corner may vary part-to-part or for a given part * at runtime based upon various factors. * * Returns a voltage corresponding to the specified voltage corner or a negative * errno if the corner value can't be used on this system. */ int regulator_list_corner_voltage(struct regulator *regulator, int corner) { struct regulator_dev *rdev = regulator->rdev; int ret; if (corner < rdev->constraints->min_uV || corner > rdev->constraints->max_uV || !rdev->desc->ops->list_corner_voltage) return -EINVAL; mutex_lock(&rdev->mutex); ret = rdev->desc->ops->list_corner_voltage(rdev, corner); mutex_unlock(&rdev->mutex); return ret; } EXPORT_SYMBOL(regulator_list_corner_voltage); /** * regulator_get_linear_step - return the voltage step size between VSEL values * @regulator: regulator source Loading include/linux/regulator/consumer.h +6 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ void regulator_bulk_free(int num_consumers, int regulator_count_voltages(struct regulator *regulator); int regulator_list_voltage(struct regulator *regulator, unsigned selector); int regulator_list_corner_voltage(struct regulator *regulator, int corner); int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV); unsigned int regulator_get_linear_step(struct regulator *regulator); Loading Loading @@ -578,6 +579,11 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s return -EINVAL; } static inline int regulator_list_corner_voltage(struct regulator *regulator, int corner) { return -EINVAL; } #endif static inline int regulator_set_voltage_triplet(struct regulator *regulator, Loading include/linux/regulator/driver.h +5 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,10 @@ struct regulator_linear_range { * if the selector indicates a voltage that is unusable on this system; * or negative errno. Selectors range from zero to one less than * regulator_desc.n_voltages. Voltages may be reported in any order. * @list_corner_voltage: Return the maximum voltage in microvolts that * that can be physically configured for the regulator when operating at * the specified voltage corner or a negative errno if the corner value * can't be used on this system. * * @set_current_limit: Configure a limit for a current-limited regulator. * The driver should select the current closest to max_uA. Loading Loading @@ -144,6 +148,7 @@ struct regulator_ops { /* enumerate supported voltages */ int (*list_voltage) (struct regulator_dev *, unsigned selector); int (*list_corner_voltage)(struct regulator_dev *, int corner); /* get/set regulator voltage */ int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, Loading Loading
drivers/regulator/core.c +34 −0 Original line number Diff line number Diff line Loading @@ -2661,6 +2661,40 @@ int regulator_list_hardware_vsel(struct regulator *regulator, } EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel); /** * regulator_list_corner_voltage - return the maximum voltage in microvolts that * can be physically configured for the regulator when operating at the * specified voltage corner * @regulator: regulator source * @corner: voltage corner value * Context: can sleep * * This function can be used for regulators which allow scaling between * different voltage corners as opposed to be different absolute voltages. The * absolute voltage for a given corner may vary part-to-part or for a given part * at runtime based upon various factors. * * Returns a voltage corresponding to the specified voltage corner or a negative * errno if the corner value can't be used on this system. */ int regulator_list_corner_voltage(struct regulator *regulator, int corner) { struct regulator_dev *rdev = regulator->rdev; int ret; if (corner < rdev->constraints->min_uV || corner > rdev->constraints->max_uV || !rdev->desc->ops->list_corner_voltage) return -EINVAL; mutex_lock(&rdev->mutex); ret = rdev->desc->ops->list_corner_voltage(rdev, corner); mutex_unlock(&rdev->mutex); return ret; } EXPORT_SYMBOL(regulator_list_corner_voltage); /** * regulator_get_linear_step - return the voltage step size between VSEL values * @regulator: regulator source Loading
include/linux/regulator/consumer.h +6 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ void regulator_bulk_free(int num_consumers, int regulator_count_voltages(struct regulator *regulator); int regulator_list_voltage(struct regulator *regulator, unsigned selector); int regulator_list_corner_voltage(struct regulator *regulator, int corner); int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV); unsigned int regulator_get_linear_step(struct regulator *regulator); Loading Loading @@ -578,6 +579,11 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s return -EINVAL; } static inline int regulator_list_corner_voltage(struct regulator *regulator, int corner) { return -EINVAL; } #endif static inline int regulator_set_voltage_triplet(struct regulator *regulator, Loading
include/linux/regulator/driver.h +5 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,10 @@ struct regulator_linear_range { * if the selector indicates a voltage that is unusable on this system; * or negative errno. Selectors range from zero to one less than * regulator_desc.n_voltages. Voltages may be reported in any order. * @list_corner_voltage: Return the maximum voltage in microvolts that * that can be physically configured for the regulator when operating at * the specified voltage corner or a negative errno if the corner value * can't be used on this system. * * @set_current_limit: Configure a limit for a current-limited regulator. * The driver should select the current closest to max_uA. Loading Loading @@ -144,6 +148,7 @@ struct regulator_ops { /* enumerate supported voltages */ int (*list_voltage) (struct regulator_dev *, unsigned selector); int (*list_corner_voltage)(struct regulator_dev *, int corner); /* get/set regulator voltage */ int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, Loading