regmap: add helper for per-port regfield initialization
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 27 May 2020 23:41:03 +0000 (02:41 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 29 May 2020 12:44:30 +0000 (13:44 +0100)
Similar to the standalone regfields, add an initializer for the users
who need to set .id_size and .id_offset in order to use the
regmap_fields_update_bits_base API.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20200527234113.2491988-2-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/regmap.h

index 40b0716..87703d1 100644 (file)
@@ -1134,6 +1134,14 @@ struct reg_field {
                                .msb = _msb,    \
                                }
 
+#define REG_FIELD_ID(_reg, _lsb, _msb, _size, _offset) {       \
+                               .reg = _reg,                    \
+                               .lsb = _lsb,                    \
+                               .msb = _msb,                    \
+                               .id_size = _size,               \
+                               .id_offset = _offset,           \
+                               }
+
 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
                struct reg_field reg_field);
 void regmap_field_free(struct regmap_field *field);