diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-03 19:50:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-09 07:37:09 -0400 |
commit | c172708d38a401b2f3f841dfcd862b469fa0b670 (patch) | |
tree | 75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /include/linux/regulator | |
parent | 1474e4dbcae04125ed6e503eadcef266846f4675 (diff) |
regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.
The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r-- | include/linux/regulator/driver.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 1dcdf00e0db2..4f529ed48d4c 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -148,10 +148,12 @@ enum regulator_type { | |||
148 | }; | 148 | }; |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * struct regulator_desc - Regulator descriptor | 151 | * struct regulator_desc - Static regulator descriptor |
152 | * | 152 | * |
153 | * Each regulator registered with the core is described with a structure of | 153 | * Each regulator registered with the core is described with a |
154 | * this type. | 154 | * structure of this type and a struct regulator_config. This |
155 | * structure contains the non-varying parts of the regulator | ||
156 | * description. | ||
155 | * | 157 | * |
156 | * @name: Identifying name for the regulator. | 158 | * @name: Identifying name for the regulator. |
157 | * @supply_name: Identifying the regulator supply | 159 | * @supply_name: Identifying the regulator supply |
@@ -173,6 +175,26 @@ struct regulator_desc { | |||
173 | struct module *owner; | 175 | struct module *owner; |
174 | }; | 176 | }; |
175 | 177 | ||
178 | /** | ||
179 | * struct regulator_config - Dynamic regulator descriptor | ||
180 | * | ||
181 | * Each regulator registered with the core is described with a | ||
182 | * structure of this type and a struct regulator_desc. This structure | ||
183 | * contains the runtime variable parts of the regulator description. | ||
184 | * | ||
185 | * @dev: struct device for the regulator | ||
186 | * @init_data: platform provided init data, passed through by driver | ||
187 | * @driver_data: private regulator data | ||
188 | * @of_node: OpenFirmware node to parse for device tree bindings (may be | ||
189 | * NULL). | ||
190 | */ | ||
191 | struct regulator_config { | ||
192 | struct device *dev; | ||
193 | const struct regulator_init_data *init_data; | ||
194 | void *driver_data; | ||
195 | struct device_node *of_node; | ||
196 | }; | ||
197 | |||
176 | /* | 198 | /* |
177 | * struct regulator_dev | 199 | * struct regulator_dev |
178 | * | 200 | * |
@@ -212,8 +234,7 @@ struct regulator_dev { | |||
212 | 234 | ||
213 | struct regulator_dev * | 235 | struct regulator_dev * |
214 | regulator_register(const struct regulator_desc *regulator_desc, | 236 | regulator_register(const struct regulator_desc *regulator_desc, |
215 | struct device *dev, const struct regulator_init_data *init_data, | 237 | const struct regulator_config *config); |
216 | void *driver_data, struct device_node *of_node); | ||
217 | void regulator_unregister(struct regulator_dev *rdev); | 238 | void regulator_unregister(struct regulator_dev *rdev); |
218 | 239 | ||
219 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 240 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |