-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 280560 b: refs/heads/master c: 209a600 h: refs/heads/master v: v3
- Loading branch information
Mark Brown
committed
Dec 5, 2011
1 parent
5e1265c
commit 6a40289
Showing
11 changed files
with
171 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 8569d023a0db699c462337d471f7e92163142e37 | ||
refs/heads/master: 209a600623cf13a8168b2f6b83643db7825abb9a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Register cache access API - indexed caching support | ||
* | ||
* Copyright 2011 Wolfson Microelectronics plc | ||
* | ||
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/slab.h> | ||
|
||
#include "internal.h" | ||
|
||
static int regcache_indexed_read(struct regmap *map, unsigned int reg, | ||
unsigned int *value) | ||
{ | ||
int ret; | ||
|
||
ret = regcache_lookup_reg(map, reg); | ||
if (ret >= 0) | ||
*value = map->reg_defaults[ret].def; | ||
|
||
return ret; | ||
} | ||
|
||
static int regcache_indexed_write(struct regmap *map, unsigned int reg, | ||
unsigned int value) | ||
{ | ||
int ret; | ||
|
||
ret = regcache_lookup_reg(map, reg); | ||
if (ret < 0) | ||
return regcache_insert_reg(map, reg, value); | ||
map->reg_defaults[ret].def = value; | ||
return 0; | ||
} | ||
|
||
static int regcache_indexed_sync(struct regmap *map) | ||
{ | ||
unsigned int i; | ||
int ret; | ||
|
||
for (i = 0; i < map->num_reg_defaults; i++) { | ||
ret = _regmap_write(map, map->reg_defaults[i].reg, | ||
map->reg_defaults[i].def); | ||
if (ret < 0) | ||
return ret; | ||
dev_dbg(map->dev, "Synced register %#x, value %#x\n", | ||
map->reg_defaults[i].reg, | ||
map->reg_defaults[i].def); | ||
} | ||
return 0; | ||
} | ||
|
||
struct regcache_ops regcache_indexed_ops = { | ||
.type = REGCACHE_INDEXED, | ||
.name = "indexed", | ||
.read = regcache_indexed_read, | ||
.write = regcache_indexed_write, | ||
.sync = regcache_indexed_sync | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.