Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4a6be7bb
Commit
4a6be7bb
authored
Mar 14, 2012
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branches 'regmap/topic/patch' and 'regmap/topic/sync' into regmap-next
parents
7d9aca39
f9353e70
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
25 deletions
+83
-25
drivers/base/regmap/internal.h
drivers/base/regmap/internal.h
+1
-1
drivers/base/regmap/regcache-lzo.c
drivers/base/regmap/regcache-lzo.c
+8
-2
drivers/base/regmap/regcache-rbtree.c
drivers/base/regmap/regcache-rbtree.c
+22
-3
drivers/base/regmap/regcache.c
drivers/base/regmap/regcache.c
+50
-19
include/linux/regmap.h
include/linux/regmap.h
+2
-0
No files found.
drivers/base/regmap/internal.h
View file @
4a6be7bb
...
@@ -88,7 +88,7 @@ struct regcache_ops {
...
@@ -88,7 +88,7 @@ struct regcache_ops {
int
(
*
exit
)(
struct
regmap
*
map
);
int
(
*
exit
)(
struct
regmap
*
map
);
int
(
*
read
)(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
*
value
);
int
(
*
read
)(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
*
value
);
int
(
*
write
)(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
value
);
int
(
*
write
)(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
value
);
int
(
*
sync
)(
struct
regmap
*
map
);
int
(
*
sync
)(
struct
regmap
*
map
,
unsigned
int
min
,
unsigned
int
max
);
};
};
bool
regmap_writeable
(
struct
regmap
*
map
,
unsigned
int
reg
);
bool
regmap_writeable
(
struct
regmap
*
map
,
unsigned
int
reg
);
...
...
drivers/base/regmap/regcache-lzo.c
View file @
4a6be7bb
...
@@ -331,7 +331,8 @@ static int regcache_lzo_write(struct regmap *map,
...
@@ -331,7 +331,8 @@ static int regcache_lzo_write(struct regmap *map,
return
ret
;
return
ret
;
}
}
static
int
regcache_lzo_sync
(
struct
regmap
*
map
)
static
int
regcache_lzo_sync
(
struct
regmap
*
map
,
unsigned
int
min
,
unsigned
int
max
)
{
{
struct
regcache_lzo_ctx
**
lzo_blocks
;
struct
regcache_lzo_ctx
**
lzo_blocks
;
unsigned
int
val
;
unsigned
int
val
;
...
@@ -339,7 +340,12 @@ static int regcache_lzo_sync(struct regmap *map)
...
@@ -339,7 +340,12 @@ static int regcache_lzo_sync(struct regmap *map)
int
ret
;
int
ret
;
lzo_blocks
=
map
->
cache
;
lzo_blocks
=
map
->
cache
;
for_each_set_bit
(
i
,
lzo_blocks
[
0
]
->
sync_bmp
,
lzo_blocks
[
0
]
->
sync_bmp_nbits
)
{
i
=
min
;
for_each_set_bit_cont
(
i
,
lzo_blocks
[
0
]
->
sync_bmp
,
lzo_blocks
[
0
]
->
sync_bmp_nbits
)
{
if
(
i
>
max
)
continue
;
ret
=
regcache_read
(
map
,
i
,
&
val
);
ret
=
regcache_read
(
map
,
i
,
&
val
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
...
...
drivers/base/regmap/regcache-rbtree.c
View file @
4a6be7bb
...
@@ -357,7 +357,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
...
@@ -357,7 +357,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
return
0
;
return
0
;
}
}
static
int
regcache_rbtree_sync
(
struct
regmap
*
map
)
static
int
regcache_rbtree_sync
(
struct
regmap
*
map
,
unsigned
int
min
,
unsigned
int
max
)
{
{
struct
regcache_rbtree_ctx
*
rbtree_ctx
;
struct
regcache_rbtree_ctx
*
rbtree_ctx
;
struct
rb_node
*
node
;
struct
rb_node
*
node
;
...
@@ -365,12 +366,30 @@ static int regcache_rbtree_sync(struct regmap *map)
...
@@ -365,12 +366,30 @@ static int regcache_rbtree_sync(struct regmap *map)
unsigned
int
regtmp
;
unsigned
int
regtmp
;
unsigned
int
val
;
unsigned
int
val
;
int
ret
;
int
ret
;
int
i
;
int
i
,
base
,
end
;
rbtree_ctx
=
map
->
cache
;
rbtree_ctx
=
map
->
cache
;
for
(
node
=
rb_first
(
&
rbtree_ctx
->
root
);
node
;
node
=
rb_next
(
node
))
{
for
(
node
=
rb_first
(
&
rbtree_ctx
->
root
);
node
;
node
=
rb_next
(
node
))
{
rbnode
=
rb_entry
(
node
,
struct
regcache_rbtree_node
,
node
);
rbnode
=
rb_entry
(
node
,
struct
regcache_rbtree_node
,
node
);
for
(
i
=
0
;
i
<
rbnode
->
blklen
;
i
++
)
{
if
(
rbnode
->
base_reg
<
min
)
continue
;
if
(
rbnode
->
base_reg
>
max
)
break
;
if
(
rbnode
->
base_reg
+
rbnode
->
blklen
<
min
)
continue
;
if
(
min
>
rbnode
->
base_reg
)
base
=
min
-
rbnode
->
base_reg
;
else
base
=
0
;
if
(
max
<
rbnode
->
base_reg
+
rbnode
->
blklen
)
end
=
rbnode
->
base_reg
+
rbnode
->
blklen
-
max
;
else
end
=
rbnode
->
blklen
;
for
(
i
=
base
;
i
<
end
;
i
++
)
{
regtmp
=
rbnode
->
base_reg
+
i
;
regtmp
=
rbnode
->
base_reg
+
i
;
val
=
regcache_rbtree_get_register
(
rbnode
,
i
,
val
=
regcache_rbtree_get_register
(
rbnode
,
i
,
map
->
cache_word_size
);
map
->
cache_word_size
);
...
...
drivers/base/regmap/regcache.c
View file @
4a6be7bb
...
@@ -252,12 +252,11 @@ int regcache_write(struct regmap *map,
...
@@ -252,12 +252,11 @@ int regcache_write(struct regmap *map,
int
regcache_sync
(
struct
regmap
*
map
)
int
regcache_sync
(
struct
regmap
*
map
)
{
{
int
ret
=
0
;
int
ret
=
0
;
unsigned
int
val
;
unsigned
int
i
;
unsigned
int
i
;
const
char
*
name
;
const
char
*
name
;
unsigned
int
bypass
;
unsigned
int
bypass
;
BUG_ON
(
!
map
->
cache_ops
);
BUG_ON
(
!
map
->
cache_ops
||
!
map
->
cache_ops
->
sync
);
mutex_lock
(
&
map
->
lock
);
mutex_lock
(
&
map
->
lock
);
/* Remember the initial bypass state */
/* Remember the initial bypass state */
...
@@ -282,24 +281,11 @@ int regcache_sync(struct regmap *map)
...
@@ -282,24 +281,11 @@ int regcache_sync(struct regmap *map)
}
}
map
->
cache_bypass
=
0
;
map
->
cache_bypass
=
0
;
if
(
map
->
cache_ops
->
sync
)
{
ret
=
map
->
cache_ops
->
sync
(
map
,
0
,
map
->
max_register
);
ret
=
map
->
cache_ops
->
sync
(
map
);
}
else
{
if
(
ret
==
0
)
for
(
i
=
0
;
i
<
map
->
num_reg_defaults
;
i
++
)
{
map
->
cache_dirty
=
false
;
ret
=
regcache_read
(
map
,
i
,
&
val
);
if
(
ret
<
0
)
goto
out
;
map
->
cache_bypass
=
1
;
ret
=
_regmap_write
(
map
,
i
,
val
);
map
->
cache_bypass
=
0
;
if
(
ret
<
0
)
goto
out
;
dev_dbg
(
map
->
dev
,
"Synced register %#x, value %#x
\n
"
,
map
->
reg_defaults
[
i
].
reg
,
map
->
reg_defaults
[
i
].
def
);
}
}
out:
out:
trace_regcache_sync
(
map
->
dev
,
name
,
"stop"
);
trace_regcache_sync
(
map
->
dev
,
name
,
"stop"
);
/* Restore the bypass state */
/* Restore the bypass state */
...
@@ -310,6 +296,51 @@ int regcache_sync(struct regmap *map)
...
@@ -310,6 +296,51 @@ int regcache_sync(struct regmap *map)
}
}
EXPORT_SYMBOL_GPL
(
regcache_sync
);
EXPORT_SYMBOL_GPL
(
regcache_sync
);
/**
* regcache_sync_region: Sync part of the register cache with the hardware.
*
* @map: map to sync.
* @min: first register to sync
* @max: last register to sync
*
* Write all non-default register values in the specified region to
* the hardware.
*
* Return a negative value on failure, 0 on success.
*/
int
regcache_sync_region
(
struct
regmap
*
map
,
unsigned
int
min
,
unsigned
int
max
)
{
int
ret
=
0
;
const
char
*
name
;
unsigned
int
bypass
;
BUG_ON
(
!
map
->
cache_ops
||
!
map
->
cache_ops
->
sync
);
mutex_lock
(
&
map
->
lock
);
/* Remember the initial bypass state */
bypass
=
map
->
cache_bypass
;
name
=
map
->
cache_ops
->
name
;
dev_dbg
(
map
->
dev
,
"Syncing %s cache from %d-%d
\n
"
,
name
,
min
,
max
);
trace_regcache_sync
(
map
->
dev
,
name
,
"start region"
);
if
(
!
map
->
cache_dirty
)
goto
out
;
ret
=
map
->
cache_ops
->
sync
(
map
,
min
,
max
);
out:
trace_regcache_sync
(
map
->
dev
,
name
,
"stop region"
);
/* Restore the bypass state */
map
->
cache_bypass
=
bypass
;
mutex_unlock
(
&
map
->
lock
);
return
ret
;
}
/**
/**
* regcache_cache_only: Put a register map into cache only mode
* regcache_cache_only: Put a register map into cache only mode
*
*
...
...
include/linux/regmap.h
View file @
4a6be7bb
...
@@ -158,6 +158,8 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
...
@@ -158,6 +158,8 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
bool
*
change
);
bool
*
change
);
int
regcache_sync
(
struct
regmap
*
map
);
int
regcache_sync
(
struct
regmap
*
map
);
int
regcache_sync_region
(
struct
regmap
*
map
,
unsigned
int
min
,
unsigned
int
max
);
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment