aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/regulator/driver.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2014-09-09 23:13:57 +0100
committerMark Brown <broonie@kernel.org>2014-09-10 12:00:53 +0100
commita0c7b164ad115ec0556dc0904ee2218cbc5cedfa (patch)
treecf4f1e10eb3ec1ca72fc044d213b5be6f6124bb8 /include/linux/regulator/driver.h
parentLinux 3.17-rc1 (diff)
downloadwireguard-linux-a0c7b164ad115ec0556dc0904ee2218cbc5cedfa.tar.xz
wireguard-linux-a0c7b164ad115ec0556dc0904ee2218cbc5cedfa.zip
regulator: of: Provide simplified DT parsing method
Currently regulator drivers which support DT all repeat very similar code to supply a list of known regulator identifiers to be matched with DT, convert that to platform data which is then matched up with the regulators as they are registered. This is both fiddly to get right and for devices which can use the standard helpers to provide their operations is the main source of code in the driver. Since this code is essentially identical for most drivers we can factor it out into the core, moving the identifiers in the match table into the regulator descriptors and also allowing drivers to pass in the name of the subnode to search. When a driver provides an of_match string for the regulator the core will attempt to use that to obtain init_data, allowing the driver to remove all explicit code for DT parsing and simply provide data instead. The current code leaks the phandles for the child nodes, this will be addressed incrementally and makes no practical difference for FDT anyway as the DT data structures are never freed. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/linux/regulator/driver.h')
-rw-r--r--include/linux/regulator/driver.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index bbe03a1924c0..c35f5f97a147 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -203,6 +203,8 @@ enum regulator_type {
*
* @name: Identifying name for the regulator.
* @supply_name: Identifying the regulator supply
+ * @of_match: Name used to identify regulator in DT.
+ * @regulators_node: Name of node containing regulator definitions in DT.
* @id: Numerical identifier for the regulator.
* @ops: Regulator operations table.
* @irq: Interrupt number for the regulator.
@@ -242,6 +244,8 @@ enum regulator_type {
struct regulator_desc {
const char *name;
const char *supply_name;
+ const char *of_match;
+ const char *regulators_node;
int id;
bool continuous_voltage_range;
unsigned n_voltages;