diff options
author | Mark Brown <broonie@linaro.org> | 2014-06-02 17:07:42 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-02 17:07:42 +0100 |
commit | ef98ae45e6b3ea17d3ed27cec9afdd7e46f916ae (patch) | |
tree | 2e6073737a0b056842d9137314c2ab43db75d862 /drivers/base/regmap/regmap.c | |
parent | 522168d178208ff821b9bc37ffcd2442b80f6e6d (diff) | |
parent | b42261078a91db8a8307db42cad41a619077d1df (diff) | |
download | blackbird-op-linux-ef98ae45e6b3ea17d3ed27cec9afdd7e46f916ae.tar.gz blackbird-op-linux-ef98ae45e6b3ea17d3ed27cec9afdd7e46f916ae.zip |
Merge remote-tracking branch 'regmap/topic/smbus' into regmap-next
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r-- | drivers/base/regmap/regmap.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 2615cc180d35..74d8c0672cf6 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -35,10 +35,14 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, unsigned int mask, unsigned int val, bool *change); +static int _regmap_bus_reg_read(void *context, unsigned int reg, + unsigned int *val); static int _regmap_bus_read(void *context, unsigned int reg, unsigned int *val); static int _regmap_bus_formatted_write(void *context, unsigned int reg, unsigned int val); +static int _regmap_bus_reg_write(void *context, unsigned int reg, + unsigned int val); static int _regmap_bus_raw_write(void *context, unsigned int reg, unsigned int val); @@ -537,6 +541,12 @@ struct regmap *regmap_init(struct device *dev, map->defer_caching = false; goto skip_format_initialization; + } else if (!bus->read || !bus->write) { + map->reg_read = _regmap_bus_reg_read; + map->reg_write = _regmap_bus_reg_write; + + map->defer_caching = false; + goto skip_format_initialization; } else { map->reg_read = _regmap_bus_read; } @@ -1336,6 +1346,14 @@ static int _regmap_bus_formatted_write(void *context, unsigned int reg, return ret; } +static int _regmap_bus_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct regmap *map = context; + + return map->bus->reg_write(map->bus_context, reg, val); +} + static int _regmap_bus_raw_write(void *context, unsigned int reg, unsigned int val) { @@ -1980,6 +1998,14 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, return ret; } +static int _regmap_bus_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct regmap *map = context; + + return map->bus->reg_read(map->bus_context, reg, val); +} + static int _regmap_bus_read(void *context, unsigned int reg, unsigned int *val) { |