diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-09 14:11:24 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-09 14:11:24 -0400 |
commit | 4ae7335dae2d9378a594bdb0845c55f370516864 (patch) | |
tree | 2e7f26595d0ed7f9f9c3601c028fed0cbe2d9ec6 /include | |
parent | 694741471b8df3734e01ecae7650be60ec111c2c (diff) | |
parent | 069af897f9a3f70248d4a7ba3d3d439f7cd66d92 (diff) |
Merge branch 'topic/interface' of git://opensource.wolfsonmicro.com/regmap into for-3.2
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/regmap.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 60a65cd7e1a0..003c05349ae5 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -20,9 +20,61 @@ | |||
20 | struct i2c_client; | 20 | struct i2c_client; |
21 | struct spi_device; | 21 | struct spi_device; |
22 | 22 | ||
23 | /** | ||
24 | * Default value for a register. We use an array of structs rather | ||
25 | * than a simple array as many modern devices have very sparse | ||
26 | * register maps. | ||
27 | * | ||
28 | * @reg: Register address. | ||
29 | * @def: Register default value. | ||
30 | */ | ||
31 | struct reg_default { | ||
32 | unsigned int reg; | ||
33 | unsigned int def; | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * Configuration for the register map of a device. | ||
38 | * | ||
39 | * @reg_bits: Number of bits in a register address, mandatory. | ||
40 | * @val_bits: Number of bits in a register value, mandatory. | ||
41 | * | ||
42 | * @writeable_reg: Optional callback returning true if the register | ||
43 | * can be written to. | ||
44 | * @readable_reg: Optional callback returning true if the register | ||
45 | * can be read from. | ||
46 | * @volatile_reg: Optional callback returning true if the register | ||
47 | * value can't be cached. | ||
48 | * @precious_reg: Optional callback returning true if the rgister | ||
49 | * should not be read outside of a call from the driver | ||
50 | * (eg, a clear on read interrupt status register). | ||
51 | * | ||
52 | * @max_register: Optional, specifies the maximum valid register index. | ||
53 | * @reg_defaults: Power on reset values for registers (for use with | ||
54 | * register cache support). | ||
55 | * @num_reg_defaults: Number of elements in reg_defaults. | ||
56 | * | ||
57 | * @read_flag_mask: Mask to be set in the top byte of the register when doing | ||
58 | * a read. | ||
59 | * @write_flag_mask: Mask to be set in the top byte of the register when doing | ||
60 | * a write. If both read_flag_mask and write_flag_mask are | ||
61 | * empty the regmap_bus default masks are used. | ||
62 | */ | ||
23 | struct regmap_config { | 63 | struct regmap_config { |
24 | int reg_bits; | 64 | int reg_bits; |
25 | int val_bits; | 65 | int val_bits; |
66 | |||
67 | bool (*writeable_reg)(struct device *dev, unsigned int reg); | ||
68 | bool (*readable_reg)(struct device *dev, unsigned int reg); | ||
69 | bool (*volatile_reg)(struct device *dev, unsigned int reg); | ||
70 | bool (*precious_reg)(struct device *dev, unsigned int reg); | ||
71 | |||
72 | unsigned int max_register; | ||
73 | struct reg_default *reg_defaults; | ||
74 | int num_reg_defaults; | ||
75 | |||
76 | u8 read_flag_mask; | ||
77 | u8 write_flag_mask; | ||
26 | }; | 78 | }; |
27 | 79 | ||
28 | typedef int (*regmap_hw_write)(struct device *dev, const void *data, | 80 | typedef int (*regmap_hw_write)(struct device *dev, const void *data, |