Skip to content

Commit

Permalink
Revert "regmap: Ensure range selector registers are updated after cac…
Browse files Browse the repository at this point in the history
…he sync"

This reverts commit 1985fab.

The reverted commit breaks at least some I2C-based soundcards, and
possibly much more. Thanks for pointing the finger, HiassofT.

See: #5763
Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell authored and popcornmix committed Dec 8, 2023
1 parent abc3624 commit e063007
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
return 0;
}

static int rbtree_all(const void *key, const struct rb_node *node)
{
return 0;
}

/**
* regcache_sync - Sync the register cache with the hardware.
*
Expand All @@ -356,7 +351,6 @@ int regcache_sync(struct regmap *map)
unsigned int i;
const char *name;
bool bypass;
struct rb_node *node;

if (WARN_ON(map->cache_type == REGCACHE_NONE))
return -EINVAL;
Expand Down Expand Up @@ -398,30 +392,6 @@ int regcache_sync(struct regmap *map)
/* Restore the bypass state */
map->cache_bypass = bypass;
map->no_sync_defaults = false;

/*
* If we did any paging with cache bypassed and a cached
* paging register then the register and cache state might
* have gone out of sync, force writes of all the paging
* registers.
*/
rb_for_each(node, 0, &map->range_tree, rbtree_all) {
struct regmap_range_node *this =
rb_entry(node, struct regmap_range_node, node);

/* If there's nothing in the cache there's nothing to sync */
ret = regcache_read(map, this->selector_reg, &i);
if (ret != 0)
continue;

ret = _regmap_write(map, this->selector_reg, i);
if (ret != 0) {
dev_err(map->dev, "Failed to write %x = %x: %d\n",
this->selector_reg, i, ret);
break;
}
}

map->unlock(map->lock_arg);

regmap_async_complete(map);
Expand Down

0 comments on commit e063007

Please sign in to comment.