aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r--include/linux/regmap.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index d6f3221e29d4..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 {
@@ -417,6 +418,36 @@ bool regmap_reg_in_ranges(unsigned int reg,
417 unsigned int nranges); 418 unsigned int nranges);
418 419
419/** 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/**
420 * Description of an IRQ for the generic regmap irq_chip. 451 * Description of an IRQ for the generic regmap irq_chip.
421 * 452 *
422 * @reg_offset: Offset of the status/mask register within the bank 453 * @reg_offset: Offset of the status/mask register within the bank