summaryrefslogtreecommitdiff
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-06-30 12:40:03 +0100
committerMark Brown <broonie@linaro.org>2013-06-30 12:40:03 +0100
commit7bc8c4c37aea74332b16ffb5412a8ad355d508ce (patch)
treeca37bdf59d25c68fe97a3894184aba79c4f1aa87 /include/linux/regmap.h
parentad4f496b445eac30bb6ddc72599bf6dd73529cd2 (diff)
parent539fde59ebc615bcb9af373af8947e866dc072c7 (diff)
Merge remote-tracking branch 'regmap/topic/field' into regmap-next
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;
struct spi_device;
struct regmap;
struct regmap_range_cfg;
+struct regmap_field;
/* An enum of all the supported cache types */
enum regcache_type {
@@ -417,6 +418,36 @@ bool regmap_reg_in_ranges(unsigned int reg,
unsigned int nranges);
/**
+ * Description of an register field
+ *
+ * @reg: Offset of the register within the regmap bank
+ * @lsb: lsb of the register field.
+ * @reg: msb of the register field.
+ */
+struct reg_field {
+ unsigned int reg;
+ unsigned int lsb;
+ unsigned int msb;
+};
+
+#define REG_FIELD(_reg, _lsb, _msb) { \
+ .reg = _reg, \
+ .lsb = _lsb, \
+ .msb = _msb, \
+ }
+
+struct regmap_field *regmap_field_alloc(struct regmap *regmap,
+ struct reg_field reg_field);
+void regmap_field_free(struct regmap_field *field);
+
+struct regmap_field *devm_regmap_field_alloc(struct device *dev,
+ struct regmap *regmap, struct reg_field reg_field);
+void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
+
+int regmap_field_read(struct regmap_field *field, unsigned int *val);
+int regmap_field_write(struct regmap_field *field, unsigned int val);
+
+/**
* Description of an IRQ for the generic regmap irq_chip.
*
* @reg_offset: Offset of the status/mask register within the bank