aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-15 06:23:30 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-16 14:52:03 -0400
commit4ab5b3d92c863e55fa28cc41a7b005b7ae87afee (patch)
treeb4a57df2df36e334fbdab58e3e6b626a996312c5 /include
parent65b19ce6c223287ac95bbc22b12ef5a2738472d1 (diff)
regulator: core: Provide regmap based voltage_sel operations
Since the voltage selector operations are intended to directly map a bitfield in the device register map into regulator API operations the code for implementing them is usually very standard we can save some code by providing standard implementations for devices using the regmap API. Drivers using regmap can pass their regmap in in the regmap_config struct, set vsel_reg and vsel_mask in their regulator_desc and then use regulator_{get,set}_voltage_sel_regmap in their ops. This saves a small amount of code from each driver. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/regulator/driver.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 2e753731217b..d1c238970a6e 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -164,6 +164,9 @@ enum regulator_type {
164 * @irq: Interrupt number for the regulator. 164 * @irq: Interrupt number for the regulator.
165 * @type: Indicates if the regulator is a voltage or current regulator. 165 * @type: Indicates if the regulator is a voltage or current regulator.
166 * @owner: Module providing the regulator, used for refcounting. 166 * @owner: Module providing the regulator, used for refcounting.
167
168 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
169 * @vsel_mask: Mask for register bitfield used for selector
167 */ 170 */
168struct regulator_desc { 171struct regulator_desc {
169 const char *name; 172 const char *name;
@@ -174,6 +177,9 @@ struct regulator_desc {
174 int irq; 177 int irq;
175 enum regulator_type type; 178 enum regulator_type type;
176 struct module *owner; 179 struct module *owner;
180
181 unsigned int vsel_reg;
182 unsigned int vsel_mask;
177}; 183};
178 184
179/** 185/**
@@ -250,6 +256,9 @@ int rdev_get_id(struct regulator_dev *rdev);
250 256
251int regulator_mode_to_status(unsigned int); 257int regulator_mode_to_status(unsigned int);
252 258
259int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
260int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
261
253void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 262void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
254 263
255#endif 264#endif