diff options
author | Marc Reilly <marc@cpdesign.com.au> | 2012-03-15 21:11:43 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-01 06:55:20 -0400 |
commit | d939fb9a78b4743bc4bc3cc415894ed42050c5cc (patch) | |
tree | 74980bd7c634676da11abb41f87447b50d3a4163 /drivers/base/regmap/internal.h | |
parent | ea279fc5619e2541a0c28196b0fa06447d9ad026 (diff) |
regmap: Use pad_bits and reg_bits when determining register format.
This change combines any padding bits into the register address bits when
determining register format handlers to use the next byte-divisible
register size.
A reg_shift member is introduced to the regmap struct to enable fixup
of the reg format.
Format handlers now take an extra parameter specifying the number of
bits to shift the value by.
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/internal.h')
-rw-r--r-- | drivers/base/regmap/internal.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index fcafc5b2e651..606b83d75458 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -26,8 +26,8 @@ struct regmap_format { | |||
26 | size_t val_bytes; | 26 | size_t val_bytes; |
27 | void (*format_write)(struct regmap *map, | 27 | void (*format_write)(struct regmap *map, |
28 | unsigned int reg, unsigned int val); | 28 | unsigned int reg, unsigned int val); |
29 | void (*format_reg)(void *buf, unsigned int reg); | 29 | void (*format_reg)(void *buf, unsigned int reg, unsigned int shift); |
30 | void (*format_val)(void *buf, unsigned int val); | 30 | void (*format_val)(void *buf, unsigned int val, unsigned int shift); |
31 | unsigned int (*parse_val)(void *buf); | 31 | unsigned int (*parse_val)(void *buf); |
32 | }; | 32 | }; |
33 | 33 | ||
@@ -52,6 +52,9 @@ struct regmap { | |||
52 | u8 read_flag_mask; | 52 | u8 read_flag_mask; |
53 | u8 write_flag_mask; | 53 | u8 write_flag_mask; |
54 | 54 | ||
55 | /* number of bits to (left) shift the reg value when formatting*/ | ||
56 | int reg_shift; | ||
57 | |||
55 | /* regcache specific members */ | 58 | /* regcache specific members */ |
56 | const struct regcache_ops *cache_ops; | 59 | const struct regcache_ops *cache_ops; |
57 | enum regcache_type cache_type; | 60 | enum regcache_type cache_type; |