diff options
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r-- | include/linux/regmap.h | 31 |
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; | |||
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 { |
@@ -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 | */ | ||
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 | /** | ||
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 |