regulator: core: Allow drivers to pass in a regmap
Since many regulators use regmap for register I/O and since there's quite a few very common patterns in the code allow drivers to pass in a regmap to the core for use in generic code. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
This commit is contained in:
Родитель
9f29c9e30b
Коммит
65b19ce6c2
|
@ -24,6 +24,7 @@
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
#include <linux/regulator/of_regulator.h>
|
#include <linux/regulator/of_regulator.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/regulator/driver.h>
|
#include <linux/regulator/driver.h>
|
||||||
|
@ -2877,6 +2878,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
||||||
rdev->reg_data = config->driver_data;
|
rdev->reg_data = config->driver_data;
|
||||||
rdev->owner = regulator_desc->owner;
|
rdev->owner = regulator_desc->owner;
|
||||||
rdev->desc = regulator_desc;
|
rdev->desc = regulator_desc;
|
||||||
|
rdev->regmap = config->regmap;
|
||||||
INIT_LIST_HEAD(&rdev->consumer_list);
|
INIT_LIST_HEAD(&rdev->consumer_list);
|
||||||
INIT_LIST_HEAD(&rdev->list);
|
INIT_LIST_HEAD(&rdev->list);
|
||||||
BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
|
BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
|
|
||||||
|
struct regmap;
|
||||||
struct regulator_dev;
|
struct regulator_dev;
|
||||||
struct regulator_init_data;
|
struct regulator_init_data;
|
||||||
|
|
||||||
|
@ -187,12 +188,14 @@ struct regulator_desc {
|
||||||
* @driver_data: private regulator data
|
* @driver_data: private regulator data
|
||||||
* @of_node: OpenFirmware node to parse for device tree bindings (may be
|
* @of_node: OpenFirmware node to parse for device tree bindings (may be
|
||||||
* NULL).
|
* NULL).
|
||||||
|
* @regmap: regmap to use for core regmap helpers
|
||||||
*/
|
*/
|
||||||
struct regulator_config {
|
struct regulator_config {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
const struct regulator_init_data *init_data;
|
const struct regulator_init_data *init_data;
|
||||||
void *driver_data;
|
void *driver_data;
|
||||||
struct device_node *of_node;
|
struct device_node *of_node;
|
||||||
|
struct regmap *regmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -223,6 +226,7 @@ struct regulator_dev {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct regulation_constraints *constraints;
|
struct regulation_constraints *constraints;
|
||||||
struct regulator *supply; /* for tree */
|
struct regulator *supply; /* for tree */
|
||||||
|
struct regmap *regmap;
|
||||||
|
|
||||||
struct delayed_work disable_work;
|
struct delayed_work disable_work;
|
||||||
int deferred_disables;
|
int deferred_disables;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче