Commit e126edec authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

regmap: add regmap_fields_update_bits_base()

This patch adds new regmap_fields_update_bits_base() which is using
regmap_update_bits_base().
Current regmap_fields_xxx() can be merged into it by macro.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 721ed64d
...@@ -1716,6 +1716,38 @@ int regmap_field_update_bits_base(struct regmap_field *field, ...@@ -1716,6 +1716,38 @@ int regmap_field_update_bits_base(struct regmap_field *field,
} }
EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);
/**
* regmap_fields_update_bits_base():
* Perform a read/modify/write cycle on the register field
* with change, async, force option
*
* @field: Register field to write to
* @id: port ID
* @mask: Bitmask to change
* @val: Value to be written
* @change: Boolean indicating if a write was done
* @async: Boolean indicating asynchronously
* @force: Boolean indicating use force update
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
unsigned int mask, unsigned int val,
bool *change, bool async, bool force)
{
if (id >= field->id_size)
return -EINVAL;
mask = (mask << field->shift) & field->mask;
return regmap_update_bits_base(field->regmap,
field->reg + (field->id_offset * id),
mask, val << field->shift,
change, async, force);
}
EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base);
/** /**
* regmap_fields_write(): Write a value to a single register field with port ID * regmap_fields_write(): Write a value to a single register field with port ID
* *
......
...@@ -788,6 +788,9 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id, ...@@ -788,6 +788,9 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id,
unsigned int *val); unsigned int *val);
int regmap_fields_update_bits(struct regmap_field *field, unsigned int id, int regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
unsigned int mask, unsigned int val); unsigned int mask, unsigned int val);
int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
unsigned int mask, unsigned int val,
bool *change, bool async, bool force);
/** /**
* Description of an IRQ for the generic regmap irq_chip. * Description of an IRQ for the generic regmap irq_chip.
...@@ -966,6 +969,15 @@ static inline int regmap_field_update_bits_base(struct regmap_field *field, ...@@ -966,6 +969,15 @@ static inline int regmap_field_update_bits_base(struct regmap_field *field,
return -EINVAL; return -EINVAL;
} }
static inline int regmap_fields_update_bits_base(struct regmap_field *field,
unsigned int id,
unsigned int mask, unsigned int val,
bool *change, bool async, bool force)
{
WARN_ONCE(1, "regmap API is disabled");
return -EINVAL;
}
static inline int regmap_get_val_bytes(struct regmap *map) static inline int regmap_get_val_bytes(struct regmap *map)
{ {
WARN_ONCE(1, "regmap API is disabled"); WARN_ONCE(1, "regmap API is disabled");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment