diff options
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r-- | include/linux/regmap.h | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 690276a642cf..eb93921cdd30 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -23,9 +23,8 @@ struct spi_device; | |||
23 | /* An enum of all the supported cache types */ | 23 | /* An enum of all the supported cache types */ |
24 | enum regcache_type { | 24 | enum regcache_type { |
25 | REGCACHE_NONE, | 25 | REGCACHE_NONE, |
26 | REGCACHE_INDEXED, | ||
27 | REGCACHE_RBTREE, | 26 | REGCACHE_RBTREE, |
28 | REGCACHE_LZO | 27 | REGCACHE_COMPRESSED |
29 | }; | 28 | }; |
30 | 29 | ||
31 | /** | 30 | /** |
@@ -83,7 +82,7 @@ struct regmap_config { | |||
83 | bool (*precious_reg)(struct device *dev, unsigned int reg); | 82 | bool (*precious_reg)(struct device *dev, unsigned int reg); |
84 | 83 | ||
85 | unsigned int max_register; | 84 | unsigned int max_register; |
86 | struct reg_default *reg_defaults; | 85 | const struct reg_default *reg_defaults; |
87 | unsigned int num_reg_defaults; | 86 | unsigned int num_reg_defaults; |
88 | enum regcache_type cache_type; | 87 | enum regcache_type cache_type; |
89 | const void *reg_defaults_raw; | 88 | const void *reg_defaults_raw; |
@@ -129,6 +128,8 @@ struct regmap *regmap_init_spi(struct spi_device *dev, | |||
129 | const struct regmap_config *config); | 128 | const struct regmap_config *config); |
130 | 129 | ||
131 | void regmap_exit(struct regmap *map); | 130 | void regmap_exit(struct regmap *map); |
131 | int regmap_reinit_cache(struct regmap *map, | ||
132 | const struct regmap_config *config); | ||
132 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 133 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
133 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 134 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
134 | const void *val, size_t val_len); | 135 | const void *val, size_t val_len); |
@@ -139,9 +140,61 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | |||
139 | size_t val_count); | 140 | size_t val_count); |
140 | int regmap_update_bits(struct regmap *map, unsigned int reg, | 141 | int regmap_update_bits(struct regmap *map, unsigned int reg, |
141 | unsigned int mask, unsigned int val); | 142 | unsigned int mask, unsigned int val); |
143 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | ||
144 | unsigned int mask, unsigned int val, | ||
145 | bool *change); | ||
142 | 146 | ||
143 | int regcache_sync(struct regmap *map); | 147 | int regcache_sync(struct regmap *map); |
144 | void regcache_cache_only(struct regmap *map, bool enable); | 148 | void regcache_cache_only(struct regmap *map, bool enable); |
145 | void regcache_cache_bypass(struct regmap *map, bool enable); | 149 | void regcache_cache_bypass(struct regmap *map, bool enable); |
150 | void regcache_mark_dirty(struct regmap *map); | ||
151 | |||
152 | /** | ||
153 | * Description of an IRQ for the generic regmap irq_chip. | ||
154 | * | ||
155 | * @reg_offset: Offset of the status/mask register within the bank | ||
156 | * @mask: Mask used to flag/control the register. | ||
157 | */ | ||
158 | struct regmap_irq { | ||
159 | unsigned int reg_offset; | ||
160 | unsigned int mask; | ||
161 | }; | ||
162 | |||
163 | /** | ||
164 | * Description of a generic regmap irq_chip. This is not intended to | ||
165 | * handle every possible interrupt controller, but it should handle a | ||
166 | * substantial proportion of those that are found in the wild. | ||
167 | * | ||
168 | * @name: Descriptive name for IRQ controller. | ||
169 | * | ||
170 | * @status_base: Base status register address. | ||
171 | * @mask_base: Base mask register address. | ||
172 | * @ack_base: Base ack address. If zero then the chip is clear on read. | ||
173 | * | ||
174 | * @num_regs: Number of registers in each control bank. | ||
175 | * @irqs: Descriptors for individual IRQs. Interrupt numbers are | ||
176 | * assigned based on the index in the array of the interrupt. | ||
177 | * @num_irqs: Number of descriptors. | ||
178 | */ | ||
179 | struct regmap_irq_chip { | ||
180 | const char *name; | ||
181 | |||
182 | unsigned int status_base; | ||
183 | unsigned int mask_base; | ||
184 | unsigned int ack_base; | ||
185 | |||
186 | int num_regs; | ||
187 | |||
188 | const struct regmap_irq *irqs; | ||
189 | int num_irqs; | ||
190 | }; | ||
191 | |||
192 | struct regmap_irq_chip_data; | ||
193 | |||
194 | int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | ||
195 | int irq_base, struct regmap_irq_chip *chip, | ||
196 | struct regmap_irq_chip_data **data); | ||
197 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); | ||
198 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); | ||
146 | 199 | ||
147 | #endif | 200 | #endif |