diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/regmap.h | 116 | ||||
-rw-r--r-- | include/trace/events/regmap.h | 36 |
2 files changed, 152 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4a957fdb46f..56ca477d509 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -19,6 +19,7 @@ | |||
19 | struct module; | 19 | struct module; |
20 | struct i2c_client; | 20 | struct i2c_client; |
21 | struct spi_device; | 21 | struct spi_device; |
22 | struct regmap; | ||
22 | 23 | ||
23 | /* An enum of all the supported cache types */ | 24 | /* An enum of all the supported cache types */ |
24 | enum regcache_type { | 25 | enum regcache_type { |
@@ -40,10 +41,13 @@ struct reg_default { | |||
40 | unsigned int def; | 41 | unsigned int def; |
41 | }; | 42 | }; |
42 | 43 | ||
44 | #ifdef CONFIG_REGMAP | ||
45 | |||
43 | /** | 46 | /** |
44 | * Configuration for the register map of a device. | 47 | * Configuration for the register map of a device. |
45 | * | 48 | * |
46 | * @reg_bits: Number of bits in a register address, mandatory. | 49 | * @reg_bits: Number of bits in a register address, mandatory. |
50 | * @pad_bits: Number of bits of padding between register and value. | ||
47 | * @val_bits: Number of bits in a register value, mandatory. | 51 | * @val_bits: Number of bits in a register value, mandatory. |
48 | * | 52 | * |
49 | * @writeable_reg: Optional callback returning true if the register | 53 | * @writeable_reg: Optional callback returning true if the register |
@@ -74,6 +78,7 @@ struct reg_default { | |||
74 | */ | 78 | */ |
75 | struct regmap_config { | 79 | struct regmap_config { |
76 | int reg_bits; | 80 | int reg_bits; |
81 | int pad_bits; | ||
77 | int val_bits; | 82 | int val_bits; |
78 | 83 | ||
79 | bool (*writeable_reg)(struct device *dev, unsigned int reg); | 84 | bool (*writeable_reg)(struct device *dev, unsigned int reg); |
@@ -208,4 +213,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
208 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); | 213 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); |
209 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); | 214 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); |
210 | 215 | ||
216 | #else | ||
217 | |||
218 | /* | ||
219 | * These stubs should only ever be called by generic code which has | ||
220 | * regmap based facilities, if they ever get called at runtime | ||
221 | * something is going wrong and something probably needs to select | ||
222 | * REGMAP. | ||
223 | */ | ||
224 | |||
225 | static inline int regmap_write(struct regmap *map, unsigned int reg, | ||
226 | unsigned int val) | ||
227 | { | ||
228 | WARN_ONCE(1, "regmap API is disabled"); | ||
229 | return -EINVAL; | ||
230 | } | ||
231 | |||
232 | static inline int regmap_raw_write(struct regmap *map, unsigned int reg, | ||
233 | const void *val, size_t val_len) | ||
234 | { | ||
235 | WARN_ONCE(1, "regmap API is disabled"); | ||
236 | return -EINVAL; | ||
237 | } | ||
238 | |||
239 | static inline int regmap_bulk_write(struct regmap *map, unsigned int reg, | ||
240 | const void *val, size_t val_count) | ||
241 | { | ||
242 | WARN_ONCE(1, "regmap API is disabled"); | ||
243 | return -EINVAL; | ||
244 | } | ||
245 | |||
246 | static inline int regmap_read(struct regmap *map, unsigned int reg, | ||
247 | unsigned int *val) | ||
248 | { | ||
249 | WARN_ONCE(1, "regmap API is disabled"); | ||
250 | return -EINVAL; | ||
251 | } | ||
252 | |||
253 | static inline int regmap_raw_read(struct regmap *map, unsigned int reg, | ||
254 | void *val, size_t val_len) | ||
255 | { | ||
256 | WARN_ONCE(1, "regmap API is disabled"); | ||
257 | return -EINVAL; | ||
258 | } | ||
259 | |||
260 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | ||
261 | void *val, size_t val_count) | ||
262 | { | ||
263 | WARN_ONCE(1, "regmap API is disabled"); | ||
264 | return -EINVAL; | ||
265 | } | ||
266 | |||
267 | static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | ||
268 | unsigned int mask, unsigned int val) | ||
269 | { | ||
270 | WARN_ONCE(1, "regmap API is disabled"); | ||
271 | return -EINVAL; | ||
272 | } | ||
273 | |||
274 | static inline int regmap_update_bits_check(struct regmap *map, | ||
275 | unsigned int reg, | ||
276 | unsigned int mask, unsigned int val, | ||
277 | bool *change) | ||
278 | { | ||
279 | WARN_ONCE(1, "regmap API is disabled"); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | |||
283 | static inline int regmap_get_val_bytes(struct regmap *map) | ||
284 | { | ||
285 | WARN_ONCE(1, "regmap API is disabled"); | ||
286 | return -EINVAL; | ||
287 | } | ||
288 | |||
289 | static inline int regcache_sync(struct regmap *map) | ||
290 | { | ||
291 | WARN_ONCE(1, "regmap API is disabled"); | ||
292 | return -EINVAL; | ||
293 | } | ||
294 | |||
295 | static inline int regcache_sync_region(struct regmap *map, unsigned int min, | ||
296 | unsigned int max) | ||
297 | { | ||
298 | WARN_ONCE(1, "regmap API is disabled"); | ||
299 | return -EINVAL; | ||
300 | } | ||
301 | |||
302 | static inline void regcache_cache_only(struct regmap *map, bool enable) | ||
303 | { | ||
304 | WARN_ONCE(1, "regmap API is disabled"); | ||
305 | } | ||
306 | |||
307 | static inline void regcache_cache_bypass(struct regmap *map, bool enable) | ||
308 | { | ||
309 | WARN_ONCE(1, "regmap API is disabled"); | ||
310 | } | ||
311 | |||
312 | static inline void regcache_mark_dirty(struct regmap *map) | ||
313 | { | ||
314 | WARN_ONCE(1, "regmap API is disabled"); | ||
315 | } | ||
316 | |||
317 | static inline int regmap_register_patch(struct regmap *map, | ||
318 | const struct reg_default *regs, | ||
319 | int num_regs) | ||
320 | { | ||
321 | WARN_ONCE(1, "regmap API is disabled"); | ||
322 | return -EINVAL; | ||
323 | } | ||
324 | |||
325 | #endif | ||
326 | |||
211 | #endif | 327 | #endif |
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h index 12fbf43524e..d69738280ff 100644 --- a/include/trace/events/regmap.h +++ b/include/trace/events/regmap.h | |||
@@ -139,6 +139,42 @@ TRACE_EVENT(regcache_sync, | |||
139 | __get_str(type), __get_str(status)) | 139 | __get_str(type), __get_str(status)) |
140 | ); | 140 | ); |
141 | 141 | ||
142 | DECLARE_EVENT_CLASS(regmap_bool, | ||
143 | |||
144 | TP_PROTO(struct device *dev, bool flag), | ||
145 | |||
146 | TP_ARGS(dev, flag), | ||
147 | |||
148 | TP_STRUCT__entry( | ||
149 | __string( name, dev_name(dev) ) | ||
150 | __field( int, flag ) | ||
151 | ), | ||
152 | |||
153 | TP_fast_assign( | ||
154 | __assign_str(name, dev_name(dev)); | ||
155 | __entry->flag = flag; | ||
156 | ), | ||
157 | |||
158 | TP_printk("%s flag=%d", __get_str(name), | ||
159 | (int)__entry->flag) | ||
160 | ); | ||
161 | |||
162 | DEFINE_EVENT(regmap_bool, regmap_cache_only, | ||
163 | |||
164 | TP_PROTO(struct device *dev, bool flag), | ||
165 | |||
166 | TP_ARGS(dev, flag) | ||
167 | |||
168 | ); | ||
169 | |||
170 | DEFINE_EVENT(regmap_bool, regmap_cache_bypass, | ||
171 | |||
172 | TP_PROTO(struct device *dev, bool flag), | ||
173 | |||
174 | TP_ARGS(dev, flag) | ||
175 | |||
176 | ); | ||
177 | |||
142 | #endif /* _TRACE_REGMAP_H */ | 178 | #endif /* _TRACE_REGMAP_H */ |
143 | 179 | ||
144 | /* This part must be outside protection */ | 180 | /* This part must be outside protection */ |