Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12a5146b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull regmap updates from Mark Brown:
 "This is a relatively busy release for regmap, though not busy in the
  grand scheme of things, with the addition of support for I3C from
  Vitor Soares and a few small fixes and cleanups"

* tag 'regmap-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: select CONFIG_REGMAP while REGMAP_SCCB is set
  regmap: lzo: Switch to bitmap_zalloc()
  regmap: fix bulk writes on paged registers
  regmap: add i3c bus support
  regmap: debugfs: Fix memory leak in regmap_debugfs_init
parents 2ec98f56 aaccf386
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@
# subsystems should select the appropriate symbols.
# subsystems should select the appropriate symbols.


config REGMAP
config REGMAP
	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SCCB || REGMAP_I3C)
	select IRQ_DOMAIN if REGMAP_IRQ
	select IRQ_DOMAIN if REGMAP_IRQ
	bool
	bool


@@ -49,3 +49,7 @@ config REGMAP_SOUNDWIRE
config REGMAP_SCCB
config REGMAP_SCCB
	tristate
	tristate
	depends on I2C
	depends on I2C

config REGMAP_I3C
	tristate
	depends on I3C
+1 −0
Original line number Original line Diff line number Diff line
@@ -16,3 +16,4 @@ obj-$(CONFIG_REGMAP_IRQ) += regmap-irq.o
obj-$(CONFIG_REGMAP_W1) += regmap-w1.o
obj-$(CONFIG_REGMAP_W1) += regmap-w1.o
obj-$(CONFIG_REGMAP_SOUNDWIRE) += regmap-sdw.o
obj-$(CONFIG_REGMAP_SOUNDWIRE) += regmap-sdw.o
obj-$(CONFIG_REGMAP_SCCB) += regmap-sccb.o
obj-$(CONFIG_REGMAP_SCCB) += regmap-sccb.o
obj-$(CONFIG_REGMAP_I3C) += regmap-i3c.o
+3 −5
Original line number Original line Diff line number Diff line
@@ -148,20 +148,18 @@ static int regcache_lzo_init(struct regmap *map)
	 * that register.
	 * that register.
	 */
	 */
	bmp_size = map->num_reg_defaults_raw;
	bmp_size = map->num_reg_defaults_raw;
	sync_bmp = kmalloc_array(BITS_TO_LONGS(bmp_size), sizeof(long),
	sync_bmp = bitmap_zalloc(bmp_size, GFP_KERNEL);
				 GFP_KERNEL);
	if (!sync_bmp) {
	if (!sync_bmp) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto err;
		goto err;
	}
	}
	bitmap_zero(sync_bmp, bmp_size);


	/* allocate the lzo blocks and initialize them */
	/* allocate the lzo blocks and initialize them */
	for (i = 0; i < blkcount; i++) {
	for (i = 0; i < blkcount; i++) {
		lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
		lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
					GFP_KERNEL);
					GFP_KERNEL);
		if (!lzo_blocks[i]) {
		if (!lzo_blocks[i]) {
			kfree(sync_bmp);
			bitmap_free(sync_bmp);
			ret = -ENOMEM;
			ret = -ENOMEM;
			goto err;
			goto err;
		}
		}
@@ -213,7 +211,7 @@ static int regcache_lzo_exit(struct regmap *map)
	 * only once.
	 * only once.
	 */
	 */
	if (lzo_blocks[0])
	if (lzo_blocks[0])
		kfree(lzo_blocks[0]->sync_bmp);
		bitmap_free(lzo_blocks[0]->sync_bmp);
	for (i = 0; i < blkcount; i++) {
	for (i = 0; i < blkcount; i++) {
		if (lzo_blocks[i]) {
		if (lzo_blocks[i]) {
			kfree(lzo_blocks[i]->wmem);
			kfree(lzo_blocks[i]->wmem);
+2 −0
Original line number Original line Diff line number Diff line
@@ -579,6 +579,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
	}
	}


	if (!strcmp(name, "dummy")) {
	if (!strcmp(name, "dummy")) {
		kfree(map->debugfs_name);

		map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
		map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
						dummy_index);
						dummy_index);
		name = map->debugfs_name;
		name = map->debugfs_name;
+60 −0
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018 Synopsys, Inc. and/or its affiliates.

#include <linux/regmap.h>
#include <linux/i3c/device.h>
#include <linux/i3c/master.h>
#include <linux/module.h>

static int regmap_i3c_write(void *context, const void *data, size_t count)
{
	struct device *dev = context;
	struct i3c_device *i3c = dev_to_i3cdev(dev);
	struct i3c_priv_xfer xfers[] = {
		{
			.rnw = false,
			.len = count,
			.data.out = data,
		},
	};

	return i3c_device_do_priv_xfers(i3c, xfers, 1);
}

static int regmap_i3c_read(void *context,
			   const void *reg, size_t reg_size,
			   void *val, size_t val_size)
{
	struct device *dev = context;
	struct i3c_device *i3c = dev_to_i3cdev(dev);
	struct i3c_priv_xfer xfers[2];

	xfers[0].rnw = false;
	xfers[0].len = reg_size;
	xfers[0].data.out = reg;

	xfers[1].rnw = true;
	xfers[1].len = val_size;
	xfers[1].data.in = val;

	return i3c_device_do_priv_xfers(i3c, xfers, 2);
}

static struct regmap_bus regmap_i3c = {
	.write = regmap_i3c_write,
	.read = regmap_i3c_read,
};

struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
				      const struct regmap_config *config,
				      struct lock_class_key *lock_key,
				      const char *lock_name)
{
	return __devm_regmap_init(&i3c->dev, &regmap_i3c, &i3c->dev, config,
				  lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__devm_regmap_init_i3c);

MODULE_AUTHOR("Vitor Soares <vitor.soares@synopsys.com>");
MODULE_DESCRIPTION("Regmap I3C Module");
MODULE_LICENSE("GPL v2");
Loading