summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-03-25 01:58:42 +0300
committerMark Brown <broonie@kernel.org>2023-03-27 03:42:37 +0300
commitf18ee501e233a2b830a0c84a2e780ab02d946c04 (patch)
tree6fb284a776a1655dda42cee619a2eca2852d421a /drivers
parent2d38e8615a21e264042870f811247d5c52c27f4e (diff)
downloadlinux-f18ee501e233a2b830a0c84a2e780ab02d946c04.tar.xz
regmap: Support paging for buses with reg_read()/reg_write()
We don't currently support paging for regmaps where the I/O happens through bus provided reg_read() and reg_write() operatons, we simply ignore the range since nothing is wired up properly. Wire things up. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230324-regmap-reg-read-write-page-v1-1-1fbc0dac67ae@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/regmap/regmap.c18
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, &reg, 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, &reg, range, 1);
+ if (ret != 0)
+ return ret;
+ }
reg = regmap_reg_addr(map, reg);
return map->bus->reg_read(map->bus_context, reg, val);