Commit 0fc81f37 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regmap-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap updates from Mark Brown:
 "This is a much quieter release than the past few, there's one small
  API addition that I noticed a user for in ALSA and a bunch of
  cleanups:

   - Provide an interface for determining if a register is present in
     the cache and add a user of it in ALSA.

   - Full support for dynamic allocations, following the temporary
     bodges that were done as fixes in the previous release.

   - Remove the unused and questionably working 64 bit support"

* tag 'regmap-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: Fix the type used for a bitmap pointer
  regmap: Remove dynamic allocation warnings for rbtree and maple
  regmap: rbtree: Use alloc_flags for memory allocations
  regmap: maple: Use alloc_flags for memory allocations
  regmap: Reject fast_io regmap configurations with RBTREE and MAPLE caches
  ALSA: hda: Use regcache_reg_cached() rather than open coding
  regmap: Provide test for regcache_reg_present()
  regmap: Let users check if a register is cached
  regmap: Provide user selectable option to enable regmap
  regmap: mmio: Remove unused 64-bit support code
  regmap: cache: Revert "Add 64-bit mode support"
  regmap: Revert "add 64-bit mode support" and Co.
parents c35c486c 5d481ddb
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# subsystems should select the appropriate symbols. # subsystems should select the appropriate symbols.
config REGMAP config REGMAP
bool "Register Map support" if KUNIT_ALL_TESTS bool
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI) default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI)
select IRQ_DOMAIN if REGMAP_IRQ select IRQ_DOMAIN if REGMAP_IRQ
select MDIO_BUS if REGMAP_MDIO select MDIO_BUS if REGMAP_MDIO
...@@ -23,6 +23,16 @@ config REGMAP_KUNIT ...@@ -23,6 +23,16 @@ config REGMAP_KUNIT
default KUNIT_ALL_TESTS default KUNIT_ALL_TESTS
select REGMAP_RAM select REGMAP_RAM
config REGMAP_BUILD
bool "Enable regmap build"
depends on KUNIT
select REGMAP
help
This option exists purely to allow the regmap KUnit tests to
be enabled without having to enable some driver that uses
regmap due to unfortunate issues with how KUnit tests are
normally enabled.
config REGMAP_AC97 config REGMAP_AC97
tristate tristate
......
...@@ -74,7 +74,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg, ...@@ -74,7 +74,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg,
rcu_read_unlock(); rcu_read_unlock();
entry = kmalloc((last - index + 1) * sizeof(unsigned long), entry = kmalloc((last - index + 1) * sizeof(unsigned long),
GFP_KERNEL); map->alloc_flags);
if (!entry) if (!entry)
return -ENOMEM; return -ENOMEM;
...@@ -92,7 +92,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg, ...@@ -92,7 +92,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg,
mas_lock(&mas); mas_lock(&mas);
mas_set_range(&mas, index, last); mas_set_range(&mas, index, last);
ret = mas_store_gfp(&mas, entry, GFP_KERNEL); ret = mas_store_gfp(&mas, entry, map->alloc_flags);
mas_unlock(&mas); mas_unlock(&mas);
...@@ -134,7 +134,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -134,7 +134,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
lower = kmemdup(entry, ((min - mas.index) * lower = kmemdup(entry, ((min - mas.index) *
sizeof(unsigned long)), sizeof(unsigned long)),
GFP_KERNEL); map->alloc_flags);
if (!lower) { if (!lower) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlocked; goto out_unlocked;
...@@ -148,7 +148,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -148,7 +148,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
upper = kmemdup(&entry[max + 1], upper = kmemdup(&entry[max + 1],
((mas.last - max) * ((mas.last - max) *
sizeof(unsigned long)), sizeof(unsigned long)),
GFP_KERNEL); map->alloc_flags);
if (!upper) { if (!upper) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlocked; goto out_unlocked;
...@@ -162,7 +162,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -162,7 +162,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
/* Insert new nodes with the saved data */ /* Insert new nodes with the saved data */
if (lower) { if (lower) {
mas_set_range(&mas, lower_index, lower_last); mas_set_range(&mas, lower_index, lower_last);
ret = mas_store_gfp(&mas, lower, GFP_KERNEL); ret = mas_store_gfp(&mas, lower, map->alloc_flags);
if (ret != 0) if (ret != 0)
goto out; goto out;
lower = NULL; lower = NULL;
...@@ -170,7 +170,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -170,7 +170,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
if (upper) { if (upper) {
mas_set_range(&mas, upper_index, upper_last); mas_set_range(&mas, upper_index, upper_last);
ret = mas_store_gfp(&mas, upper, GFP_KERNEL); ret = mas_store_gfp(&mas, upper, map->alloc_flags);
if (ret != 0) if (ret != 0)
goto out; goto out;
upper = NULL; upper = NULL;
...@@ -320,7 +320,7 @@ static int regcache_maple_insert_block(struct regmap *map, int first, ...@@ -320,7 +320,7 @@ static int regcache_maple_insert_block(struct regmap *map, int first,
unsigned long *entry; unsigned long *entry;
int i, ret; int i, ret;
entry = kcalloc(last - first + 1, sizeof(unsigned long), GFP_KERNEL); entry = kcalloc(last - first + 1, sizeof(unsigned long), map->alloc_flags);
if (!entry) if (!entry)
return -ENOMEM; return -ENOMEM;
...@@ -331,7 +331,7 @@ static int regcache_maple_insert_block(struct regmap *map, int first, ...@@ -331,7 +331,7 @@ static int regcache_maple_insert_block(struct regmap *map, int first,
mas_set_range(&mas, map->reg_defaults[first].reg, mas_set_range(&mas, map->reg_defaults[first].reg,
map->reg_defaults[last].reg); map->reg_defaults[last].reg);
ret = mas_store_gfp(&mas, entry, GFP_KERNEL); ret = mas_store_gfp(&mas, entry, map->alloc_flags);
mas_unlock(&mas); mas_unlock(&mas);
......
...@@ -22,7 +22,7 @@ struct regcache_rbtree_node { ...@@ -22,7 +22,7 @@ struct regcache_rbtree_node {
/* block of adjacent registers */ /* block of adjacent registers */
void *block; void *block;
/* Which registers are present */ /* Which registers are present */
long *cache_present; unsigned long *cache_present;
/* base register handled by this block */ /* base register handled by this block */
unsigned int base_reg; unsigned int base_reg;
/* number of registers available in the block */ /* number of registers available in the block */
...@@ -277,7 +277,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, ...@@ -277,7 +277,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
blk = krealloc(rbnode->block, blk = krealloc(rbnode->block,
blklen * map->cache_word_size, blklen * map->cache_word_size,
GFP_KERNEL); map->alloc_flags);
if (!blk) if (!blk)
return -ENOMEM; return -ENOMEM;
...@@ -286,7 +286,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, ...@@ -286,7 +286,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) { if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
present = krealloc(rbnode->cache_present, present = krealloc(rbnode->cache_present,
BITS_TO_LONGS(blklen) * sizeof(*present), BITS_TO_LONGS(blklen) * sizeof(*present),
GFP_KERNEL); map->alloc_flags);
if (!present) if (!present)
return -ENOMEM; return -ENOMEM;
...@@ -320,7 +320,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) ...@@ -320,7 +320,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
const struct regmap_range *range; const struct regmap_range *range;
int i; int i;
rbnode = kzalloc(sizeof(*rbnode), GFP_KERNEL); rbnode = kzalloc(sizeof(*rbnode), map->alloc_flags);
if (!rbnode) if (!rbnode)
return NULL; return NULL;
...@@ -346,13 +346,13 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) ...@@ -346,13 +346,13 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
} }
rbnode->block = kmalloc_array(rbnode->blklen, map->cache_word_size, rbnode->block = kmalloc_array(rbnode->blklen, map->cache_word_size,
GFP_KERNEL); map->alloc_flags);
if (!rbnode->block) if (!rbnode->block)
goto err_free; goto err_free;
rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen), rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen),
sizeof(*rbnode->cache_present), sizeof(*rbnode->cache_present),
GFP_KERNEL); map->alloc_flags);
if (!rbnode->cache_present) if (!rbnode->cache_present)
goto err_free_block; goto err_free_block;
......
...@@ -558,6 +558,29 @@ void regcache_cache_bypass(struct regmap *map, bool enable) ...@@ -558,6 +558,29 @@ void regcache_cache_bypass(struct regmap *map, bool enable)
} }
EXPORT_SYMBOL_GPL(regcache_cache_bypass); EXPORT_SYMBOL_GPL(regcache_cache_bypass);
/**
* regcache_reg_cached - Check if a register is cached
*
* @map: map to check
* @reg: register to check
*
* Reports if a register is cached.
*/
bool regcache_reg_cached(struct regmap *map, unsigned int reg)
{
unsigned int val;
int ret;
map->lock(map->lock_arg);
ret = regcache_read(map, reg, &val);
map->unlock(map->lock_arg);
return ret == 0;
}
EXPORT_SYMBOL_GPL(regcache_reg_cached);
void regcache_set_val(struct regmap *map, void *base, unsigned int idx, void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
unsigned int val) unsigned int val)
{ {
...@@ -587,14 +610,6 @@ void regcache_set_val(struct regmap *map, void *base, unsigned int idx, ...@@ -587,14 +610,6 @@ void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
cache[idx] = val; cache[idx] = val;
break; break;
} }
#ifdef CONFIG_64BIT
case 8: {
u64 *cache = base;
cache[idx] = val;
break;
}
#endif
default: default:
BUG(); BUG();
} }
...@@ -627,13 +642,6 @@ unsigned int regcache_get_val(struct regmap *map, const void *base, ...@@ -627,13 +642,6 @@ unsigned int regcache_get_val(struct regmap *map, const void *base,
return cache[idx]; return cache[idx];
} }
#ifdef CONFIG_64BIT
case 8: {
const u64 *cache = base;
return cache[idx];
}
#endif
default: default:
BUG(); BUG();
} }
......
...@@ -836,6 +836,45 @@ static void cache_drop(struct kunit *test) ...@@ -836,6 +836,45 @@ static void cache_drop(struct kunit *test)
regmap_exit(map); regmap_exit(map);
} }
static void cache_present(struct kunit *test)
{
struct regcache_types *t = (struct regcache_types *)test->param_value;
struct regmap *map;
struct regmap_config config;
struct regmap_ram_data *data;
unsigned int val;
int i;
config = test_regmap_config;
config.cache_type = t->type;
map = gen_regmap(&config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map))
return;
for (i = 0; i < BLOCK_TEST_SIZE; i++)
data->read[i] = false;
/* No defaults so no registers cached. */
for (i = 0; i < BLOCK_TEST_SIZE; i++)
KUNIT_ASSERT_FALSE(test, regcache_reg_cached(map, i));
/* We didn't trigger any reads */
for (i = 0; i < BLOCK_TEST_SIZE; i++)
KUNIT_ASSERT_FALSE(test, data->read[i]);
/* Fill the cache */
for (i = 0; i < BLOCK_TEST_SIZE; i++)
KUNIT_EXPECT_EQ(test, 0, regmap_read(map, i, &val));
/* Now everything should be cached */
for (i = 0; i < BLOCK_TEST_SIZE; i++)
KUNIT_ASSERT_TRUE(test, regcache_reg_cached(map, i));
regmap_exit(map);
}
struct raw_test_types { struct raw_test_types {
const char *name; const char *name;
...@@ -1177,6 +1216,7 @@ static struct kunit_case regmap_test_cases[] = { ...@@ -1177,6 +1216,7 @@ static struct kunit_case regmap_test_cases[] = {
KUNIT_CASE_PARAM(cache_sync_readonly, real_cache_types_gen_params), KUNIT_CASE_PARAM(cache_sync_readonly, real_cache_types_gen_params),
KUNIT_CASE_PARAM(cache_sync_patch, real_cache_types_gen_params), KUNIT_CASE_PARAM(cache_sync_patch, real_cache_types_gen_params),
KUNIT_CASE_PARAM(cache_drop, sparse_cache_types_gen_params), KUNIT_CASE_PARAM(cache_drop, sparse_cache_types_gen_params),
KUNIT_CASE_PARAM(cache_present, sparse_cache_types_gen_params),
KUNIT_CASE_PARAM(raw_read_defaults_single, raw_test_types_gen_params), KUNIT_CASE_PARAM(raw_read_defaults_single, raw_test_types_gen_params),
KUNIT_CASE_PARAM(raw_read_defaults, raw_test_types_gen_params), KUNIT_CASE_PARAM(raw_read_defaults, raw_test_types_gen_params),
......
...@@ -202,15 +202,6 @@ static int regmap_mmio_noinc_write(void *context, unsigned int reg, ...@@ -202,15 +202,6 @@ static int regmap_mmio_noinc_write(void *context, unsigned int reg,
writel(swab32(valp[i]), ctx->regs + reg); writel(swab32(valp[i]), ctx->regs + reg);
goto out_clk; goto out_clk;
} }
#ifdef CONFIG_64BIT
case 8:
{
const u64 *valp = (const u64 *)val;
for (i = 0; i < val_count; i++)
writeq(swab64(valp[i]), ctx->regs + reg);
goto out_clk;
}
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
goto out_clk; goto out_clk;
...@@ -227,11 +218,6 @@ static int regmap_mmio_noinc_write(void *context, unsigned int reg, ...@@ -227,11 +218,6 @@ static int regmap_mmio_noinc_write(void *context, unsigned int reg,
case 4: case 4:
writesl(ctx->regs + reg, (const u32 *)val, val_count); writesl(ctx->regs + reg, (const u32 *)val, val_count);
break; break;
#ifdef CONFIG_64BIT
case 8:
writesq(ctx->regs + reg, (const u64 *)val, val_count);
break;
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -363,11 +349,6 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg, ...@@ -363,11 +349,6 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg,
case 4: case 4:
readsl(ctx->regs + reg, (u32 *)val, val_count); readsl(ctx->regs + reg, (u32 *)val, val_count);
break; break;
#ifdef CONFIG_64BIT
case 8:
readsq(ctx->regs + reg, (u64 *)val, val_count);
break;
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
goto out_clk; goto out_clk;
...@@ -387,11 +368,6 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg, ...@@ -387,11 +368,6 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg,
case 4: case 4:
swab32_array(val, val_count); swab32_array(val, val_count);
break; break;
#ifdef CONFIG_64BIT
case 8:
swab64_array(val, val_count);
break;
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
......
...@@ -311,26 +311,6 @@ static void regmap_format_32_native(void *buf, unsigned int val, ...@@ -311,26 +311,6 @@ static void regmap_format_32_native(void *buf, unsigned int val,
memcpy(buf, &v, sizeof(v)); memcpy(buf, &v, sizeof(v));
} }
#ifdef CONFIG_64BIT
static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift)
{
put_unaligned_be64((u64) val << shift, buf);
}
static void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift)
{
put_unaligned_le64((u64) val << shift, buf);
}
static void regmap_format_64_native(void *buf, unsigned int val,
unsigned int shift)
{
u64 v = (u64) val << shift;
memcpy(buf, &v, sizeof(v));
}
#endif
static void regmap_parse_inplace_noop(void *buf) static void regmap_parse_inplace_noop(void *buf)
{ {
} }
...@@ -411,40 +391,6 @@ static unsigned int regmap_parse_32_native(const void *buf) ...@@ -411,40 +391,6 @@ static unsigned int regmap_parse_32_native(const void *buf)
return v; return v;
} }
#ifdef CONFIG_64BIT
static unsigned int regmap_parse_64_be(const void *buf)
{
return get_unaligned_be64(buf);
}
static unsigned int regmap_parse_64_le(const void *buf)
{
return get_unaligned_le64(buf);
}
static void regmap_parse_64_be_inplace(void *buf)
{
u64 v = get_unaligned_be64(buf);
memcpy(buf, &v, sizeof(v));
}
static void regmap_parse_64_le_inplace(void *buf)
{
u64 v = get_unaligned_le64(buf);
memcpy(buf, &v, sizeof(v));
}
static unsigned int regmap_parse_64_native(const void *buf)
{
u64 v;
memcpy(&v, buf, sizeof(v));
return v;
}
#endif
static void regmap_lock_hwlock(void *__map) static void regmap_lock_hwlock(void *__map)
{ {
struct regmap *map = __map; struct regmap *map = __map;
...@@ -1005,24 +951,6 @@ struct regmap *__regmap_init(struct device *dev, ...@@ -1005,24 +951,6 @@ struct regmap *__regmap_init(struct device *dev,
} }
break; break;
#ifdef CONFIG_64BIT
case 64:
switch (reg_endian) {
case REGMAP_ENDIAN_BIG:
map->format.format_reg = regmap_format_64_be;
break;
case REGMAP_ENDIAN_LITTLE:
map->format.format_reg = regmap_format_64_le;
break;
case REGMAP_ENDIAN_NATIVE:
map->format.format_reg = regmap_format_64_native;
break;
default:
goto err_hwlock;
}
break;
#endif
default: default:
goto err_hwlock; goto err_hwlock;
} }
...@@ -1086,28 +1014,6 @@ struct regmap *__regmap_init(struct device *dev, ...@@ -1086,28 +1014,6 @@ struct regmap *__regmap_init(struct device *dev,
goto err_hwlock; goto err_hwlock;
} }
break; break;
#ifdef CONFIG_64BIT
case 64:
switch (val_endian) {
case REGMAP_ENDIAN_BIG:
map->format.format_val = regmap_format_64_be;
map->format.parse_val = regmap_parse_64_be;
map->format.parse_inplace = regmap_parse_64_be_inplace;
break;
case REGMAP_ENDIAN_LITTLE:
map->format.format_val = regmap_format_64_le;
map->format.parse_val = regmap_parse_64_le;
map->format.parse_inplace = regmap_parse_64_le_inplace;
break;
case REGMAP_ENDIAN_NATIVE:
map->format.format_val = regmap_format_64_native;
map->format.parse_val = regmap_parse_64_native;
break;
default:
goto err_hwlock;
}
break;
#endif
} }
if (map->format.format_write) { if (map->format.format_write) {
...@@ -2158,9 +2064,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg, ...@@ -2158,9 +2064,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
u8 *u8p; u8 *u8p;
u16 *u16p; u16 *u16p;
u32 *u32p; u32 *u32p;
#ifdef CONFIG_64BIT
u64 *u64p;
#endif
int ret; int ret;
int i; int i;
...@@ -2180,13 +2083,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg, ...@@ -2180,13 +2083,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
if (write) if (write)
lastval = (unsigned int)u32p[val_count - 1]; lastval = (unsigned int)u32p[val_count - 1];
break; break;
#ifdef CONFIG_64BIT
case 8:
u64p = val;
if (write)
lastval = (unsigned int)u64p[val_count - 1];
break;
#endif
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -2224,11 +2120,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg, ...@@ -2224,11 +2120,6 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
case 4: case 4:
pr_cont("%x", u32p[i]); pr_cont("%x", u32p[i]);
break; break;
#ifdef CONFIG_64BIT
case 8:
pr_cont("%llx", u64p[i]);
break;
#endif
default: default:
break; break;
} }
...@@ -2436,11 +2327,6 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, ...@@ -2436,11 +2327,6 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
case 4: case 4:
ival = *(u32 *)(val + (i * val_bytes)); ival = *(u32 *)(val + (i * val_bytes));
break; break;
#ifdef CONFIG_64BIT
case 8:
ival = *(u64 *)(val + (i * val_bytes));
break;
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -3205,9 +3091,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, ...@@ -3205,9 +3091,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
for (i = 0; i < val_count * val_bytes; i += val_bytes) for (i = 0; i < val_count * val_bytes; i += val_bytes)
map->format.parse_inplace(val + i); map->format.parse_inplace(val + i);
} else { } else {
#ifdef CONFIG_64BIT
u64 *u64 = val;
#endif
u32 *u32 = val; u32 *u32 = val;
u16 *u16 = val; u16 *u16 = val;
u8 *u8 = val; u8 *u8 = val;
...@@ -3223,11 +3106,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, ...@@ -3223,11 +3106,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
goto out; goto out;
switch (map->format.val_bytes) { switch (map->format.val_bytes) {
#ifdef CONFIG_64BIT
case 8:
u64[i] = ival;
break;
#endif
case 4: case 4:
u32[i] = ival; u32[i] = ival;
break; break;
......
...@@ -1287,6 +1287,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min, ...@@ -1287,6 +1287,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min,
void regcache_cache_only(struct regmap *map, bool enable); void regcache_cache_only(struct regmap *map, bool enable);
void regcache_cache_bypass(struct regmap *map, bool enable); void regcache_cache_bypass(struct regmap *map, bool enable);
void regcache_mark_dirty(struct regmap *map); void regcache_mark_dirty(struct regmap *map);
bool regcache_reg_cached(struct regmap *map, unsigned int reg);
bool regmap_check_range_table(struct regmap *map, unsigned int reg, bool regmap_check_range_table(struct regmap *map, unsigned int reg,
const struct regmap_access_table *table); const struct regmap_access_table *table);
......
...@@ -556,17 +556,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_update_raw); ...@@ -556,17 +556,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_update_raw);
static int reg_raw_update_once(struct hdac_device *codec, unsigned int reg, static int reg_raw_update_once(struct hdac_device *codec, unsigned int reg,
unsigned int mask, unsigned int val) unsigned int mask, unsigned int val)
{ {
unsigned int orig; int err = 0;
int err;
if (!codec->regmap) if (!codec->regmap)
return reg_raw_update(codec, reg, mask, val); return reg_raw_update(codec, reg, mask, val);
mutex_lock(&codec->regmap_lock); mutex_lock(&codec->regmap_lock);
regcache_cache_only(codec->regmap, true); /* Discard any updates to already initialised registers. */
err = regmap_read(codec->regmap, reg, &orig); if (!regcache_reg_cached(codec->regmap, reg))
regcache_cache_only(codec->regmap, false);
if (err < 0)
err = regmap_update_bits(codec->regmap, reg, mask, val); err = regmap_update_bits(codec->regmap, reg, mask, val);
mutex_unlock(&codec->regmap_lock); mutex_unlock(&codec->regmap_lock);
return err; return err;
......
...@@ -33,5 +33,7 @@ CONFIG_DAMON_PADDR=y ...@@ -33,5 +33,7 @@ CONFIG_DAMON_PADDR=y
CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS=y
CONFIG_DAMON_DBGFS=y CONFIG_DAMON_DBGFS=y
CONFIG_REGMAP_BUILD=y
CONFIG_SECURITY=y CONFIG_SECURITY=y
CONFIG_SECURITY_APPARMOR=y CONFIG_SECURITY_APPARMOR=y
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