Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323369
b: refs/heads/master
c: 13511de
h: refs/heads/master
i:
  323367: 09d0495
v: v3
  • Loading branch information
Stephen Warren authored and Mark Brown committed Sep 25, 2012
1 parent c91a549 commit 779534d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b26e48308feaf428efb917f8de217797bfedb26
refs/heads/master: 13511def87b9f68697a0fc4c64ddacece585a471
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ Optional properties:
- regulator-boot-on: bootloader/firmware enabled regulator
- <name>-supply: phandle to the parent supply/regulator node
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)

Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
regulators, and if the chip's binding contains a child node that
describes each regulator, then this property indicates which regulator
this child node is intended to configure.
this child node is intended to configure. If this property is missing,
the node's name will be used instead.

Example:

Expand Down
25 changes: 12 additions & 13 deletions trunk/drivers/regulator/of_regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,18 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev,
EXPORT_SYMBOL_GPL(of_get_regulator_init_data);

/**
* of_regulator_match - extract regulator init data when node
* property "regulator-compatible" matches with the regulator name.
* of_regulator_match - extract multiple regulator init data from device tree.
* @dev: device requesting the data
* @node: parent device node of the regulators
* @matches: match table for the regulators
* @num_matches: number of entries in match table
*
* This function uses a match table specified by the regulator driver and
* looks up the corresponding init data in the device tree if
* regulator-compatible matches. Note that the match table is modified
* This function uses a match table specified by the regulator driver to
* parse regulator init data from the device tree. @node is expected to
* contain a set of child nodes, each providing the init data for one
* regulator. The data parsed from a child node will be matched to a regulator
* based on either the deprecated property regulator-compatible if present,
* or otherwise the child node's name. Note that the match table is modified
* in place.
*
* Returns the number of matches found or a negative error code on failure.
Expand All @@ -112,26 +114,23 @@ int of_regulator_match(struct device *dev, struct device_node *node,
{
unsigned int count = 0;
unsigned int i;
const char *regulator_comp;
const char *name;
struct device_node *child;

if (!dev || !node)
return -EINVAL;

for_each_child_of_node(node, child) {
regulator_comp = of_get_property(child,
name = of_get_property(child,
"regulator-compatible", NULL);
if (!regulator_comp) {
dev_err(dev, "regulator-compatible is missing for node %s\n",
child->name);
continue;
}
if (!name)
name = child->name;
for (i = 0; i < num_matches; i++) {
struct of_regulator_match *match = &matches[i];
if (match->of_node)
continue;

if (strcmp(match->name, regulator_comp))
if (strcmp(match->name, name))
continue;

match->init_data =
Expand Down

0 comments on commit 779534d

Please sign in to comment.