summaryrefslogtreecommitdiff
path: root/include/linux/regulator/driver.h
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2019-02-28 16:40:13 +0300
committerMark Brown <broonie@kernel.org>2019-03-04 02:45:27 +0300
commita32e0c773b5f233b0589dbb621bb2b9681dbfec3 (patch)
tree00e56d9c6df3f2042609d508935030f6cc369f93 /include/linux/regulator/driver.h
parent35d838ff98bc57c882eb610393c6b68455d3d9fe (diff)
downloadlinux-a32e0c773b5f233b0589dbb621bb2b9681dbfec3.tar.xz
regulator: core: Add set/get_current_limit helpers for regmap users
By setting curr_table, n_current_limits, csel_reg and csel_mask, the regmap users can use regulator_set_current_limit_regmap and regulator_get_current_limit_regmap for set/get_current_limit callbacks. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/regulator/driver.h')
-rw-r--r--include/linux/regulator/driver.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index b9557c9623b5..377da2357118 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -264,6 +264,7 @@ enum regulator_type {
* @continuous_voltage_range: Indicates if the regulator can set any
* voltage within constrains range.
* @n_voltages: Number of selectors available for ops.list_voltage().
+ * @n_current_limits: Number of selectors available for current limits
*
* @min_uV: Voltage given by the lowest selector (if linear mapping)
* @uV_step: Voltage increase with each selector (if linear mapping)
@@ -278,6 +279,7 @@ enum regulator_type {
* @n_linear_ranges: Number of entries in the @linear_ranges (and in
* linear_range_selectors if used) table(s).
* @volt_table: Voltage mapping table (if table based mapping)
+ * @curr_table: Current limit mapping table (if table based mapping)
*
* @vsel_range_reg: Register for range selector when using pickable ranges
* and regulator_regmap_X_voltage_X_pickable functions.
@@ -333,6 +335,7 @@ struct regulator_desc {
int id;
unsigned int continuous_voltage_range:1;
unsigned n_voltages;
+ unsigned int n_current_limits;
const struct regulator_ops *ops;
int irq;
enum regulator_type type;
@@ -351,6 +354,7 @@ struct regulator_desc {
int n_linear_ranges;
const unsigned int *volt_table;
+ const unsigned int *curr_table;
unsigned int vsel_range_reg;
unsigned int vsel_range_mask;
@@ -534,6 +538,9 @@ int regulator_set_pull_down_regmap(struct regulator_dev *rdev);
int regulator_set_active_discharge_regmap(struct regulator_dev *rdev,
bool enable);
+int regulator_set_current_limit_regmap(struct regulator_dev *rdev,
+ int min_uA, int max_uA);
+int regulator_get_current_limit_regmap(struct regulator_dev *rdev);
void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
void regulator_lock(struct regulator_dev *rdev);