Skip to content

Commit 2f288ef

Browse files
committed
Merge branch 'topic/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-next
2 parents 9a8f5e0 + d9a861c commit 2f288ef

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎Documentation/power/regulator/regulator.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Drivers can register a regulator by calling :-
1212

1313
struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
1414
struct device *dev, struct regulator_init_data *init_data,
15-
void *driver_data);
15+
void *driver_data, struct device_node *of_node);
1616

1717
This will register the regulators capabilities and operations to the regulator
1818
core.

‎drivers/regulator/fixed.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ of_get_fixed_voltage_config(struct device *dev)
6464
if (!config)
6565
return NULL;
6666

67-
config->init_data = of_get_regulator_init_data(dev);
67+
config->init_data = of_get_regulator_init_data(dev, dev->of_node);
6868
if (!config->init_data)
6969
return NULL;
7070

‎drivers/regulator/of_regulator.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ static void of_get_regulation_constraints(struct device_node *np,
3434
/* Voltage change possible? */
3535
if (constraints->min_uV != constraints->max_uV)
3636
constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
37+
/* Only one voltage? Then make sure it's set. */
38+
if (constraints->min_uV == constraints->max_uV)
39+
constraints->apply_uV = true;
3740

3841
uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL);
3942
if (uV_offset)
@@ -66,18 +69,19 @@ static void of_get_regulation_constraints(struct device_node *np,
6669
* tree node, returns a pointer to the populated struture or NULL if memory
6770
* alloc fails.
6871
*/
69-
struct regulator_init_data *of_get_regulator_init_data(struct device *dev)
72+
struct regulator_init_data *of_get_regulator_init_data(struct device *dev,
73+
struct device_node *node)
7074
{
7175
struct regulator_init_data *init_data;
7276

73-
if (!dev->of_node)
77+
if (!node)
7478
return NULL;
7579

7680
init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL);
7781
if (!init_data)
7882
return NULL; /* Out of memory? */
7983

80-
of_get_regulation_constraints(dev->of_node, &init_data);
84+
of_get_regulation_constraints(node, &init_data);
8185
return init_data;
8286
}
8387
EXPORT_SYMBOL_GPL(of_get_regulator_init_data);

‎include/linux/regulator/of_regulator.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
#if defined(CONFIG_OF)
1010
extern struct regulator_init_data
11-
*of_get_regulator_init_data(struct device *dev);
11+
*of_get_regulator_init_data(struct device *dev,
12+
struct device_node *node);
1213
#else
1314
static inline struct regulator_init_data
14-
*of_get_regulator_init_data(struct device *dev)
15+
*of_get_regulator_init_data(struct device *dev,
16+
struct device_node *node)
1517
{
1618
return NULL;
1719
}

0 commit comments

Comments
 (0)