mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
regmap: cache: Store caches in native register format where possible
This allows the cached data to be sent directly to the device when we sync it. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
8a819ff8ab
commit
eb4cb76ff0
1 changed files with 14 additions and 2 deletions
|
@ -45,8 +45,8 @@ static int regcache_hw_init(struct regmap *map)
|
||||||
tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL);
|
tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL);
|
||||||
if (!tmp_buf)
|
if (!tmp_buf)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ret = regmap_bulk_read(map, 0, tmp_buf,
|
ret = regmap_raw_read(map, 0, tmp_buf,
|
||||||
map->num_reg_defaults_raw);
|
map->num_reg_defaults_raw);
|
||||||
map->cache_bypass = cache_bypass;
|
map->cache_bypass = cache_bypass;
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
kfree(tmp_buf);
|
kfree(tmp_buf);
|
||||||
|
@ -421,6 +421,13 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
|
||||||
if (regcache_get_val(map, base, idx) == val)
|
if (regcache_get_val(map, base, idx) == val)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* Use device native format if possible */
|
||||||
|
if (map->format.format_val) {
|
||||||
|
map->format.format_val(base + (map->cache_word_size * idx),
|
||||||
|
val, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (map->cache_word_size) {
|
switch (map->cache_word_size) {
|
||||||
case 1: {
|
case 1: {
|
||||||
u8 *cache = base;
|
u8 *cache = base;
|
||||||
|
@ -449,6 +456,11 @@ unsigned int regcache_get_val(struct regmap *map, const void *base,
|
||||||
if (!base)
|
if (!base)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* Use device native format if possible */
|
||||||
|
if (map->format.parse_val)
|
||||||
|
return map->format.parse_val(base +
|
||||||
|
(map->cache_word_size * idx));
|
||||||
|
|
||||||
switch (map->cache_word_size) {
|
switch (map->cache_word_size) {
|
||||||
case 1: {
|
case 1: {
|
||||||
const u8 *cache = base;
|
const u8 *cache = base;
|
||||||
|
|
Loading…
Add table
Reference in a new issue