aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/regmap.h43
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;
23struct spi_device; 23struct spi_device;
24struct regmap; 24struct regmap;
25struct regmap_range_cfg; 25struct regmap_range_cfg;
26struct regmap_field;
26 27
27/* An enum of all the supported cache types */ 28/* An enum of all the supported cache types */
28enum regcache_type { 29enum regcache_type {
@@ -394,10 +395,15 @@ bool regmap_can_raw_write(struct regmap *map);
394int regcache_sync(struct regmap *map); 395int regcache_sync(struct regmap *map);
395int regcache_sync_region(struct regmap *map, unsigned int min, 396int regcache_sync_region(struct regmap *map, unsigned int min,
396 unsigned int max); 397 unsigned int max);
398int regcache_drop_region(struct regmap *map, unsigned int min,
399 unsigned int max);
397void regcache_cache_only(struct regmap *map, bool enable); 400void regcache_cache_only(struct regmap *map, bool enable);
398void regcache_cache_bypass(struct regmap *map, bool enable); 401void regcache_cache_bypass(struct regmap *map, bool enable);
399void regcache_mark_dirty(struct regmap *map); 402void regcache_mark_dirty(struct regmap *map);
400 403
404bool regmap_check_range_table(struct regmap *map, unsigned int reg,
405 const struct regmap_access_table *table);
406
401int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 407int 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 */
427struct 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
439struct regmap_field *regmap_field_alloc(struct regmap *regmap,
440 struct reg_field reg_field);
441void regmap_field_free(struct regmap_field *field);
442
443struct regmap_field *devm_regmap_field_alloc(struct device *dev,
444 struct regmap *regmap, struct reg_field reg_field);
445void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
446
447int regmap_field_read(struct regmap_field *field, unsigned int *val);
448int 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
601static 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
565static inline void regcache_cache_only(struct regmap *map, bool enable) 608static 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");