Commit 8d7d3972 authored by Tuomas Tynkkynen's avatar Tuomas Tynkkynen Committed by Mark Brown

regmap: Add regmap_get_device

Add a new function regmap_get_device to obtain the underlying struct
device from a regmap.
Signed-off-by: default avatarTuomas Tynkkynen <ttynkkynen@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 7171511e
...@@ -1073,6 +1073,18 @@ struct regmap *dev_get_regmap(struct device *dev, const char *name) ...@@ -1073,6 +1073,18 @@ struct regmap *dev_get_regmap(struct device *dev, const char *name)
} }
EXPORT_SYMBOL_GPL(dev_get_regmap); EXPORT_SYMBOL_GPL(dev_get_regmap);
/**
* regmap_get_device(): Obtain the device from a regmap
*
* @map: Register map to operate on.
*
* Returns the underlying device that the regmap has been created for.
*/
struct device *regmap_get_device(struct regmap *map)
{
return map->dev;
}
static int _regmap_select_page(struct regmap *map, unsigned int *reg, static int _regmap_select_page(struct regmap *map, unsigned int *reg,
struct regmap_range_node *range, struct regmap_range_node *range,
unsigned int val_num) unsigned int val_num)
......
...@@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map); ...@@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map);
int regmap_reinit_cache(struct regmap *map, int regmap_reinit_cache(struct regmap *map,
const struct regmap_config *config); const struct regmap_config *config);
struct regmap *dev_get_regmap(struct device *dev, const char *name); struct regmap *dev_get_regmap(struct device *dev, const char *name);
struct device *regmap_get_device(struct regmap *map);
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
int regmap_raw_write(struct regmap *map, unsigned int reg, int regmap_raw_write(struct regmap *map, unsigned int reg,
...@@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev, ...@@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev,
return NULL; return NULL;
} }
static inline struct device *regmap_get_device(struct regmap *map)
{
WARN_ONCE(1, "regmap API is disabled");
return -EINVAL;
}
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment