aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 63e30ef096e2..2209de0ceabc 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,
35 unsigned int mask, unsigned int val, 35 unsigned int mask, unsigned int val,
36 bool *change); 36 bool *change);
37 37
38static int _regmap_bus_reg_read(void *context, unsigned int reg,
39 unsigned int *val);
38static int _regmap_bus_read(void *context, unsigned int reg, 40static int _regmap_bus_read(void *context, unsigned int reg,
39 unsigned int *val); 41 unsigned int *val);
40static int _regmap_bus_formatted_write(void *context, unsigned int reg, 42static int _regmap_bus_formatted_write(void *context, unsigned int reg,
41 unsigned int val); 43 unsigned int val);
44static int _regmap_bus_reg_write(void *context, unsigned int reg,
45 unsigned int val);
42static int _regmap_bus_raw_write(void *context, unsigned int reg, 46static int _regmap_bus_raw_write(void *context, unsigned int reg,
43 unsigned int val); 47 unsigned int val);
44 48
@@ -495,6 +499,12 @@ struct regmap *regmap_init(struct device *dev,
495 499
496 map->defer_caching = false; 500 map->defer_caching = false;
497 goto skip_format_initialization; 501 goto skip_format_initialization;
502 } else if (!bus->read || !bus->write) {
503 map->reg_read = _regmap_bus_reg_read;
504 map->reg_write = _regmap_bus_reg_write;
505
506 map->defer_caching = false;
507 goto skip_format_initialization;
498 } else { 508 } else {
499 map->reg_read = _regmap_bus_read; 509 map->reg_read = _regmap_bus_read;
500 } 510 }
@@ -1284,6 +1294,14 @@ static int _regmap_bus_formatted_write(void *context, unsigned int reg,
1284 return ret; 1294 return ret;
1285} 1295}
1286 1296
1297static int _regmap_bus_reg_write(void *context, unsigned int reg,
1298 unsigned int val)
1299{
1300 struct regmap *map = context;
1301
1302 return map->bus->reg_write(map->bus_context, reg, val);
1303}
1304
1287static int _regmap_bus_raw_write(void *context, unsigned int reg, 1305static int _regmap_bus_raw_write(void *context, unsigned int reg,
1288 unsigned int val) 1306 unsigned int val)
1289{ 1307{
@@ -1925,6 +1943,14 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
1925 return ret; 1943 return ret;
1926} 1944}
1927 1945
1946static int _regmap_bus_reg_read(void *context, unsigned int reg,
1947 unsigned int *val)
1948{
1949 struct regmap *map = context;
1950
1951 return map->bus->reg_read(map->bus_context, reg, val);
1952}
1953
1928static int _regmap_bus_read(void *context, unsigned int reg, 1954static int _regmap_bus_read(void *context, unsigned int reg,
1929 unsigned int *val) 1955 unsigned int *val)
1930{ 1956{