aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-15 07:37:47 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-16 14:52:42 -0400
commitcd6dffb4c6c476f5787f4df3eda7ecb16e25780d (patch)
tree1f9676804e187eb731e5008e0d2d9ca67bd1ef54 /include/linux/regulator
parent633b6fcd5a70bacbb770136f2938a8be855bbea8 (diff)
regulator: core: Provide standard enable operations for regmap users
Since the enable(), disable() and is_enabled() operations for most regmap based regulators come down to reading and updating a single register bit we can factor out the code and allow these drivers to just define which bit to update using the enable_reg and enable_mask fields in their desc and then use operations provided by the core. As well as the code saving this opens the door to future optimisation of the bulk operations - if the core can realise that we are updating a single register for multiple regulators then it should be able to combine these updates into a single physical operation. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'include/linux/regulator')
-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 d1c238970a6e..8160bc87be28 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -167,6 +167,8 @@ enum regulator_type {
167 167
168 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ 168 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
169 * @vsel_mask: Mask for register bitfield used for selector 169 * @vsel_mask: Mask for register bitfield used for selector
170 * @enable_reg: Register for control when using regmap enable/disable ops
171 * @enable_mask: Mask for control when using regmap enable/disable ops
170 */ 172 */
171struct regulator_desc { 173struct regulator_desc {
172 const char *name; 174 const char *name;
@@ -180,6 +182,8 @@ struct regulator_desc {
180 182
181 unsigned int vsel_reg; 183 unsigned int vsel_reg;
182 unsigned int vsel_mask; 184 unsigned int vsel_mask;
185 unsigned int enable_reg;
186 unsigned int enable_mask;
183}; 187};
184 188
185/** 189/**
@@ -258,6 +262,9 @@ int regulator_mode_to_status(unsigned int);
258 262
259int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); 263int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
260int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); 264int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
265int regulator_is_enabled_regmap(struct regulator_dev *rdev);
266int regulator_enable_regmap(struct regulator_dev *rdev);
267int regulator_disable_regmap(struct regulator_dev *rdev);
261 268
262void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 269void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
263 270