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
Kirill Smelkov
linux
Commits
18f513db
Commit
18f513db
authored
Oct 28, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regmap/topic/multi' into regmap-next
parents
6cf3d823
e33fabd3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
drivers/base/regmap/regmap.c
drivers/base/regmap/regmap.c
+41
-0
include/linux/regmap.h
include/linux/regmap.h
+2
-0
No files found.
drivers/base/regmap/regmap.c
View file @
18f513db
...
...
@@ -1564,6 +1564,47 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
}
EXPORT_SYMBOL_GPL
(
regmap_bulk_write
);
/*
* regmap_multi_reg_write(): Write multiple registers to the device
*
* where the set of register are supplied in any order
*
* @map: Register map to write to
* @regs: Array of structures containing register,value to be written
* @num_regs: Number of registers to write
*
* This function is intended to be used for writing a large block of data
* atomically to the device in single transfer for those I2C client devices
* that implement this alternative block write mode.
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_multi_reg_write
(
struct
regmap
*
map
,
struct
reg_default
*
regs
,
int
num_regs
)
{
int
ret
=
0
,
i
;
for
(
i
=
0
;
i
<
num_regs
;
i
++
)
{
int
reg
=
regs
[
i
].
reg
;
if
(
reg
%
map
->
reg_stride
)
return
-
EINVAL
;
}
map
->
lock
(
map
->
lock_arg
);
for
(
i
=
0
;
i
<
num_regs
;
i
++
)
{
ret
=
_regmap_write
(
map
,
regs
[
i
].
reg
,
regs
[
i
].
def
);
if
(
ret
!=
0
)
goto
out
;
}
out:
map
->
unlock
(
map
->
lock_arg
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_multi_reg_write
);
/**
* regmap_raw_write_async(): Write raw values to one or more registers
* asynchronously
...
...
include/linux/regmap.h
View file @
18f513db
...
...
@@ -379,6 +379,8 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
const
void
*
val
,
size_t
val_len
);
int
regmap_bulk_write
(
struct
regmap
*
map
,
unsigned
int
reg
,
const
void
*
val
,
size_t
val_count
);
int
regmap_multi_reg_write
(
struct
regmap
*
map
,
struct
reg_default
*
regs
,
int
num_regs
);
int
regmap_raw_write_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
const
void
*
val
,
size_t
val_len
);
int
regmap_read
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
*
val
);
...
...
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