diff options
-rw-r--r-- | drivers/base/regmap/regmap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index a4e4367648bf..473b65b102db 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1945,6 +1945,15 @@ static int _regmap_bus_reg_write(void *context, unsigned int reg, unsigned int val) { struct regmap *map = context; + struct regmap_range_node *range; + int ret; + + range = _regmap_range_lookup(map, reg); + if (range) { + ret = _regmap_select_page(map, ®, range, 1); + if (ret != 0) + return ret; + } reg = regmap_reg_addr(map, reg); return map->bus->reg_write(map->bus_context, reg, val); @@ -2842,6 +2851,15 @@ static int _regmap_bus_reg_read(void *context, unsigned int reg, unsigned int *val) { struct regmap *map = context; + struct regmap_range_node *range; + int ret; + + range = _regmap_range_lookup(map, reg); + if (range) { + ret = _regmap_select_page(map, ®, range, 1); + if (ret != 0) + return ret; + } reg = regmap_reg_addr(map, reg); return map->bus->reg_read(map->bus_context, reg, val); |