Commit 2e7a9515 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull regmap updates from Mark Brown:
 "The big thing this release is a big cleanup of the interrupt code from
  Aidan MacDonald, plus a few new API updates:

   - Rework of the interrupt code, making it much simpler and easier to
     extend

   - Support for device specific update bits operations with devices
     that otherwise use bitstream interfaces

   - Support for bit operations on fields as well as whole registers"

* tag 'regmap-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: permit to set reg_update_bits with bulk implementation
  regmap: add WARN_ONCE when invalid mask is provided to regmap_field_init()
  regmap-irq: Fix bug in regmap_irq_get_irq_reg_linear()
  regmap: cache: Add extra parameter check in regcache_init
  regmap-irq: Deprecate the not_fixed_stride flag
  regmap-irq: Add get_irq_reg() callback
  regmap-irq: Fix inverted handling of unmask registers
  regmap-irq: Deprecate type registers and virtual registers
  regmap-irq: Introduce config registers for irq types
  regmap-irq: Refactor checks for status bulk read support
  regmap-irq: Remove mask_writeonly and regmap_irq_update_bits()
  regmap-irq: Remove inappropriate uses of regmap_irq_update_bits()
  regmap-irq: Remove an unnecessary restriction on type_in_mask
  regmap-irq: Cleanup sizeof(...) use in memory allocation
  regmap-irq: Remove unused type_reg_stride field
  regmap-irq: Convert bool bitfields to unsigned int
  regmap: Don't warn about cache only mode for devices with no cache
  regmap: provide regmap_field helpers for simple bit operations
  regmap: cache: Fix syntax errors in comments
parents 7d0d3fa7 739f872e
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -133,6 +133,12 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
		return -EINVAL;
	}

	if (config->num_reg_defaults && !config->reg_defaults) {
		dev_err(map->dev,
			"Register defaults number are set without the reg!\n");
		return -EINVAL;
	}

	for (i = 0; i < config->num_reg_defaults; i++)
		if (config->reg_defaults[i].reg % map->reg_stride)
			return -EINVAL;
@@ -495,7 +501,8 @@ EXPORT_SYMBOL_GPL(regcache_drop_region);
void regcache_cache_only(struct regmap *map, bool enable)
{
	map->lock(map->lock_arg);
	WARN_ON(map->cache_bypass && enable);
	WARN_ON(map->cache_type != REGCACHE_NONE &&
		map->cache_bypass && enable);
	map->cache_only = enable;
	trace_regmap_cache_only(map, enable);
	map->unlock(map->lock_arg);
@@ -531,7 +538,7 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty);
 * @enable: flag if changes should not be written to the cache
 *
 * When a register map is marked with the cache bypass option, writes
 * to the register map API will only update the hardware and not the
 * to the register map API will only update the hardware and not
 * the cache directly.  This is useful when syncing the cache back to
 * the hardware.
 */
+295 −137

File changed.

Preview size limit exceeded, changes collapsed.

+27 −0
Original line number Diff line number Diff line
@@ -882,6 +882,8 @@ struct regmap *__regmap_init(struct device *dev,

	if (config && config->read && config->write) {
		map->reg_read  = _regmap_bus_read;
		if (config->reg_update_bits)
			map->reg_update_bits = config->reg_update_bits;

		/* Bulk read/write */
		map->read = config->read;
@@ -1298,6 +1300,9 @@ static void regmap_field_init(struct regmap_field *rm_field,
	rm_field->reg = reg_field.reg;
	rm_field->shift = reg_field.lsb;
	rm_field->mask = GENMASK(reg_field.msb, reg_field.lsb);

	WARN_ONCE(rm_field->mask == 0, "invalid empty mask defined\n");

	rm_field->id_size = reg_field.id_size;
	rm_field->id_offset = reg_field.id_offset;
}
@@ -2218,6 +2223,28 @@ int regmap_field_update_bits_base(struct regmap_field *field,
}
EXPORT_SYMBOL_GPL(regmap_field_update_bits_base);

/**
 * regmap_field_test_bits() - Check if all specified bits are set in a
 *                            register field.
 *
 * @field: Register field to operate on
 * @bits: Bits to test
 *
 * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the
 * tested bits is not set and 1 if all tested bits are set.
 */
int regmap_field_test_bits(struct regmap_field *field, unsigned int bits)
{
	unsigned int val, ret;

	ret = regmap_field_read(field, &val);
	if (ret)
		return ret;

	return (val & bits) == bits;
}
EXPORT_SYMBOL_GPL(regmap_field_test_bits);

/**
 * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a
 *                                    register field with port ID
+109 −32

File changed.

Preview size limit exceeded, changes collapsed.