diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/regmap.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 02d84e24b7c2..75981d0b57dc 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -23,6 +23,7 @@ struct irq_domain; | |||
23 | struct spi_device; | 23 | struct spi_device; |
24 | struct regmap; | 24 | struct regmap; |
25 | struct regmap_range_cfg; | 25 | struct regmap_range_cfg; |
26 | struct regmap_field; | ||
26 | 27 | ||
27 | /* An enum of all the supported cache types */ | 28 | /* An enum of all the supported cache types */ |
28 | enum regcache_type { | 29 | enum regcache_type { |
@@ -394,10 +395,15 @@ bool regmap_can_raw_write(struct regmap *map); | |||
394 | int regcache_sync(struct regmap *map); | 395 | int regcache_sync(struct regmap *map); |
395 | int regcache_sync_region(struct regmap *map, unsigned int min, | 396 | int regcache_sync_region(struct regmap *map, unsigned int min, |
396 | unsigned int max); | 397 | unsigned int max); |
398 | int regcache_drop_region(struct regmap *map, unsigned int min, | ||
399 | unsigned int max); | ||
397 | void regcache_cache_only(struct regmap *map, bool enable); | 400 | void regcache_cache_only(struct regmap *map, bool enable); |
398 | void regcache_cache_bypass(struct regmap *map, bool enable); | 401 | void regcache_cache_bypass(struct regmap *map, bool enable); |
399 | void regcache_mark_dirty(struct regmap *map); | 402 | void regcache_mark_dirty(struct regmap *map); |
400 | 403 | ||
404 | bool regmap_check_range_table(struct regmap *map, unsigned int reg, | ||
405 | const struct regmap_access_table *table); | ||
406 | |||
401 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | 407 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, |
402 | int num_regs); | 408 | int num_regs); |
403 | 409 | ||
@@ -412,6 +418,36 @@ bool regmap_reg_in_ranges(unsigned int reg, | |||
412 | unsigned int nranges); | 418 | unsigned int nranges); |
413 | 419 | ||
414 | /** | 420 | /** |
421 | * Description of an register field | ||
422 | * | ||
423 | * @reg: Offset of the register within the regmap bank | ||
424 | * @lsb: lsb of the register field. | ||
425 | * @reg: msb of the register field. | ||
426 | */ | ||
427 | struct reg_field { | ||
428 | unsigned int reg; | ||
429 | unsigned int lsb; | ||
430 | unsigned int msb; | ||
431 | }; | ||
432 | |||
433 | #define REG_FIELD(_reg, _lsb, _msb) { \ | ||
434 | .reg = _reg, \ | ||
435 | .lsb = _lsb, \ | ||
436 | .msb = _msb, \ | ||
437 | } | ||
438 | |||
439 | struct regmap_field *regmap_field_alloc(struct regmap *regmap, | ||
440 | struct reg_field reg_field); | ||
441 | void regmap_field_free(struct regmap_field *field); | ||
442 | |||
443 | struct regmap_field *devm_regmap_field_alloc(struct device *dev, | ||
444 | struct regmap *regmap, struct reg_field reg_field); | ||
445 | void devm_regmap_field_free(struct device *dev, struct regmap_field *field); | ||
446 | |||
447 | int regmap_field_read(struct regmap_field *field, unsigned int *val); | ||
448 | int regmap_field_write(struct regmap_field *field, unsigned int val); | ||
449 | |||
450 | /** | ||
415 | * Description of an IRQ for the generic regmap irq_chip. | 451 | * Description of an IRQ for the generic regmap irq_chip. |
416 | * | 452 | * |
417 | * @reg_offset: Offset of the status/mask register within the bank | 453 | * @reg_offset: Offset of the status/mask register within the bank |
@@ -562,6 +598,13 @@ static inline int regcache_sync_region(struct regmap *map, unsigned int min, | |||
562 | return -EINVAL; | 598 | return -EINVAL; |
563 | } | 599 | } |
564 | 600 | ||
601 | static inline int regcache_drop_region(struct regmap *map, unsigned int min, | ||
602 | unsigned int max) | ||
603 | { | ||
604 | WARN_ONCE(1, "regmap API is disabled"); | ||
605 | return -EINVAL; | ||
606 | } | ||
607 | |||
565 | static inline void regcache_cache_only(struct regmap *map, bool enable) | 608 | static inline void regcache_cache_only(struct regmap *map, bool enable) |
566 | { | 609 | { |
567 | WARN_ONCE(1, "regmap API is disabled"); | 610 | WARN_ONCE(1, "regmap API is disabled"); |