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

Unverified Commit 757b6528 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'regmap/topic/const', 'regmap/topic/flat',...

Merge remote-tracking branches 'regmap/topic/const', 'regmap/topic/flat', 'regmap/topic/hwspinlock' and 'regmap/topic/nolock' into regmap-next
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,9 +16,17 @@ Required properties:
Optional property:
- reg-io-width: the size (in bytes) of the IO accesses that should be
  performed on the device.
- hwlocks: reference to a phandle of a hardware spinlock provider node.

Examples:
gpr: iomuxc-gpr@20e0000 {
	compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
	reg = <0x020e0000 0x38>;
	hwlocks = <&hwlock1 1>;
};

hwlock1: hwspinlock@40500000 {
	...
	reg = <0x40500000 0x1000>;
	#hwlock-cells = <1>;
};
+0 −4
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
config REGMAP
	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
	select IRQ_DOMAIN if REGMAP_IRQ
	select REGMAP_HWSPINLOCK if HWSPINLOCK=y
	bool

config REGCACHE_COMPRESSED
@@ -38,6 +37,3 @@ config REGMAP_MMIO

config REGMAP_IRQ
	bool

config REGMAP_HWSPINLOCK
	bool
+8 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ struct regmap {
	int async_ret;

#ifdef CONFIG_DEBUG_FS
	bool debugfs_disable;
	struct dentry *debugfs;
	const char *debugfs_name;

@@ -215,10 +216,17 @@ struct regmap_field {
extern void regmap_debugfs_initcall(void);
extern void regmap_debugfs_init(struct regmap *map, const char *name);
extern void regmap_debugfs_exit(struct regmap *map);

static inline void regmap_debugfs_disable(struct regmap *map)
{
	map->debugfs_disable = true;
}

#else
static inline void regmap_debugfs_initcall(void) { }
static inline void regmap_debugfs_init(struct regmap *map, const char *name) { }
static inline void regmap_debugfs_exit(struct regmap *map) { }
static inline void regmap_debugfs_disable(struct regmap *map) { }
#endif

/* regcache core declarations */
+10 −5
Original line number Diff line number Diff line
@@ -37,9 +37,12 @@ static int regcache_flat_init(struct regmap *map)

	cache = map->cache;

	for (i = 0; i < map->num_reg_defaults; i++)
		cache[regcache_flat_get_index(map, map->reg_defaults[i].reg)] =
				map->reg_defaults[i].def;
	for (i = 0; i < map->num_reg_defaults; i++) {
		unsigned int reg = map->reg_defaults[i].reg;
		unsigned int index = regcache_flat_get_index(map, reg);

		cache[index] = map->reg_defaults[i].def;
	}

	return 0;
}
@@ -56,8 +59,9 @@ static int regcache_flat_read(struct regmap *map,
			      unsigned int reg, unsigned int *value)
{
	unsigned int *cache = map->cache;
	unsigned int index = regcache_flat_get_index(map, reg);

	*value = cache[regcache_flat_get_index(map, reg)];
	*value = cache[index];

	return 0;
}
@@ -66,8 +70,9 @@ static int regcache_flat_write(struct regmap *map, unsigned int reg,
			       unsigned int value)
{
	unsigned int *cache = map->cache;
	unsigned int index = regcache_flat_get_index(map, reg);

	cache[regcache_flat_get_index(map, reg)] = value;
	cache[index] = value;

	return 0;
}
+12 −0
Original line number Diff line number Diff line
@@ -529,6 +529,18 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
	struct regmap_range_node *range_node;
	const char *devname = "dummy";

	/*
	 * Userspace can initiate reads from the hardware over debugfs.
	 * Normally internal regmap structures and buffers are protected with
	 * a mutex or a spinlock, but if the regmap owner decided to disable
	 * all locking mechanisms, this is no longer the case. For safety:
	 * don't create the debugfs entries if locking is disabled.
	 */
	if (map->debugfs_disable) {
		dev_dbg(map->dev, "regmap locking disabled - not creating debugfs entries\n");
		return;
	}

	/* If we don't have the debugfs root yet, postpone init */
	if (!regmap_debugfs_root) {
		struct regmap_debugfs_node *node;
Loading