Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
d25263d9
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d25263d9
编写于
3月 05, 2016
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regmap/topic/update-bits' into regmap-next
上级
0b74f06f
b821957a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
88 addition
and
226 deletion
+88
-226
drivers/base/regmap/regmap.c
drivers/base/regmap/regmap.c
+39
-178
include/linux/regmap.h
include/linux/regmap.h
+49
-48
未找到文件。
drivers/base/regmap/regmap.c
浏览文件 @
d25263d9
...
...
@@ -1698,100 +1698,63 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
EXPORT_SYMBOL_GPL
(
regmap_raw_write
);
/**
* regmap_field_write(): Write a value to a single register field
*
* @field: Register field to write to
* @val: Value to be written
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_field_write
(
struct
regmap_field
*
field
,
unsigned
int
val
)
{
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
,
field
->
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_field_write
);
/**
* regmap_field_update_bits(): Perform a read/modify/write cycle
* on the register field
* regmap_field_update_bits_base():
* Perform a read/modify/write cycle on the register field
* with change, async, force option
*
* @field: Register field to write to
* @mask: Bitmask to change
* @val: Value to be written
* @change: Boolean indicating if a write was done
* @async: Boolean indicating asynchronously
* @force: Boolean indicating use force update
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_field_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
)
int
regmap_field_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
)
{
mask
=
(
mask
<<
field
->
shift
)
&
field
->
mask
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
,
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_field_update_bits
);
/**
* regmap_fields_write(): Write a value to a single register field with port ID
*
* @field: Register field to write to
* @id: port ID
* @val: Value to be written
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_fields_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
)
{
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
field
->
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_fields_write
);
int
regmap_fields_force_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
)
{
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
return
regmap_write_bits
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
field
->
mask
,
val
<<
field
->
shift
);
return
regmap_update_bits_base
(
field
->
regmap
,
field
->
reg
,
mask
,
val
<<
field
->
shift
,
change
,
async
,
force
);
}
EXPORT_SYMBOL_GPL
(
regmap_field
s_force_writ
e
);
EXPORT_SYMBOL_GPL
(
regmap_field
_update_bits_bas
e
);
/**
* regmap_fields_update_bits(): Perform a read/modify/write cycle
* on the register field
* regmap_fields_update_bits_base():
* Perform a read/modify/write cycle on the register field
* with change, async, force option
*
* @field: Register field to write to
* @id: port ID
* @mask: Bitmask to change
* @val: Value to be written
* @change: Boolean indicating if a write was done
* @async: Boolean indicating asynchronously
* @force: Boolean indicating use force update
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_fields_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
)
int
regmap_fields_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
)
{
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
mask
=
(
mask
<<
field
->
shift
)
&
field
->
mask
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
mask
,
val
<<
field
->
shift
);
return
regmap_update_bits_base
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
mask
,
val
<<
field
->
shift
,
change
,
async
,
force
);
}
EXPORT_SYMBOL_GPL
(
regmap_fields_update_bits
);
EXPORT_SYMBOL_GPL
(
regmap_fields_update_bits
_base
);
/*
* regmap_bulk_write(): Write multiple registers to the device
...
...
@@ -2660,138 +2623,36 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
}
/**
* regmap_update_bits: Perform a read/modify/write cycle on the register map
*
* @map: Register map to update
* @reg: Register to update
* @mask: Bitmask to change
* @val: New value for bitmask
*
* Returns zero for success, a negative number on error.
*/
int
regmap_update_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
{
int
ret
;
map
->
lock
(
map
->
lock_arg
);
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
NULL
,
false
);
map
->
unlock
(
map
->
lock_arg
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_update_bits
);
/**
* regmap_write_bits: Perform a read/modify/write cycle on the register map
*
* @map: Register map to update
* @reg: Register to update
* @mask: Bitmask to change
* @val: New value for bitmask
*
* Returns zero for success, a negative number on error.
*/
int
regmap_write_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
{
int
ret
;
map
->
lock
(
map
->
lock_arg
);
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
NULL
,
true
);
map
->
unlock
(
map
->
lock_arg
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_write_bits
);
/**
* regmap_update_bits_async: Perform a read/modify/write cycle on the register
* map asynchronously
*
* @map: Register map to update
* @reg: Register to update
* @mask: Bitmask to change
* @val: New value for bitmask
*
* With most buses the read must be done synchronously so this is most
* useful for devices with a cache which do not need to interact with
* the hardware to determine the current register value.
*
* Returns zero for success, a negative number on error.
*/
int
regmap_update_bits_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
{
int
ret
;
map
->
lock
(
map
->
lock_arg
);
map
->
async
=
true
;
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
NULL
,
false
);
map
->
async
=
false
;
map
->
unlock
(
map
->
lock_arg
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_update_bits_async
);
/**
* regmap_update_bits_check: Perform a read/modify/write cycle on the
* register map and report if updated
*
* @map: Register map to update
* @reg: Register to update
* @mask: Bitmask to change
* @val: New value for bitmask
* @change: Boolean indicating if a write was done
*
* Returns zero for success, a negative number on error.
*/
int
regmap_update_bits_check
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
)
{
int
ret
;
map
->
lock
(
map
->
lock_arg
);
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
change
,
false
);
map
->
unlock
(
map
->
lock_arg
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_update_bits_check
);
/**
* regmap_update_bits_check_async: Perform a read/modify/write cycle on the
* register map asynchronously and report if
* updated
* regmap_update_bits_base:
* Perform a read/modify/write cycle on the
* register map with change, async, force option
*
* @map: Register map to update
* @reg: Register to update
* @mask: Bitmask to change
* @val: New value for bitmask
* @change: Boolean indicating if a write was done
* @async: Boolean indicating asynchronously
* @force: Boolean indicating use force update
*
* if async was true,
* With most buses the read must be done synchronously so this is most
* useful for devices with a cache which do not need to interact with
* the hardware to determine the current register value.
*
* Returns zero for success, a negative number on error.
*/
int
regmap_update_bits_
check_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
chang
e
)
int
regmap_update_bits_
base
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
forc
e
)
{
int
ret
;
map
->
lock
(
map
->
lock_arg
);
map
->
async
=
true
;
map
->
async
=
async
;
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
change
,
f
als
e
);
ret
=
_regmap_update_bits
(
map
,
reg
,
mask
,
val
,
change
,
f
orc
e
);
map
->
async
=
false
;
...
...
@@ -2799,7 +2660,7 @@ int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_update_bits_
check_async
);
EXPORT_SYMBOL_GPL
(
regmap_update_bits_
base
);
void
regmap_async_complete_cb
(
struct
regmap_async
*
async
,
int
ret
)
{
...
...
include/linux/regmap.h
浏览文件 @
d25263d9
...
...
@@ -65,6 +65,36 @@ struct reg_sequence {
unsigned
int
delay_us
;
};
#define regmap_update_bits(map, reg, mask, val) \
regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
#define regmap_update_bits_async(map, reg, mask, val)\
regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
#define regmap_update_bits_check(map, reg, mask, val, change)\
regmap_update_bits_base(map, reg, mask, val, change, false, false)
#define regmap_update_bits_check_async(map, reg, mask, val, change)\
regmap_update_bits_base(map, reg, mask, val, change, true, false)
#define regmap_write_bits(map, reg, mask, val) \
regmap_update_bits_base(map, reg, mask, val, NULL, false, true)
#define regmap_field_write(field, val) \
regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
#define regmap_field_force_write(field, val) \
regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
#define regmap_field_update_bits(field, mask, val)\
regmap_field_update_bits_base(field, mask, val, NULL, false, false)
#define regmap_field_force_update_bits(field, mask, val) \
regmap_field_update_bits_base(field, mask, val, NULL, false, true)
#define regmap_fields_write(field, id, val) \
regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
#define regmap_fields_force_write(field, id, val) \
regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
#define regmap_fields_update_bits(field, id, mask, val)\
regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
#define regmap_fields_force_update_bits(field, id, mask, val) \
regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
#ifdef CONFIG_REGMAP
enum
regmap_endian
{
...
...
@@ -691,18 +721,9 @@ int regmap_raw_read(struct regmap *map, unsigned int reg,
void
*
val
,
size_t
val_len
);
int
regmap_bulk_read
(
struct
regmap
*
map
,
unsigned
int
reg
,
void
*
val
,
size_t
val_count
);
int
regmap_update_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_write_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_update_bits_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_update_bits_check
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
);
int
regmap_update_bits_check_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
);
int
regmap_update_bits_base
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
);
int
regmap_get_val_bytes
(
struct
regmap
*
map
);
int
regmap_get_max_register
(
struct
regmap
*
map
);
int
regmap_get_reg_stride
(
struct
regmap
*
map
);
...
...
@@ -770,18 +791,14 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev,
void
devm_regmap_field_free
(
struct
device
*
dev
,
struct
regmap_field
*
field
);
int
regmap_field_read
(
struct
regmap_field
*
field
,
unsigned
int
*
val
);
int
regmap_field_write
(
struct
regmap_field
*
field
,
unsigned
int
val
);
int
regmap_field_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_fields_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
);
int
regmap_fields_force_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
);
int
regmap_field_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
);
int
regmap_fields_read
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
*
val
);
int
regmap_fields_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_fields_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
);
/**
* Description of an IRQ for the generic regmap irq_chip.
...
...
@@ -945,42 +962,26 @@ static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
return
-
EINVAL
;
}
static
inline
int
regmap_update_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
{
WARN_ONCE
(
1
,
"regmap API is disabled"
);
return
-
EINVAL
;
}
static
inline
int
regmap_write_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
static
inline
int
regmap_update_bits_base
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
)
{
WARN_ONCE
(
1
,
"regmap API is disabled"
);
return
-
EINVAL
;
}
static
inline
int
regmap_
update_bits_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
)
static
inline
int
regmap_
field_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
)
{
WARN_ONCE
(
1
,
"regmap API is disabled"
);
return
-
EINVAL
;
}
static
inline
int
regmap_update_bits_check
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
)
{
WARN_ONCE
(
1
,
"regmap API is disabled"
);
return
-
EINVAL
;
}
static
inline
int
regmap_update_bits_check_async
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
)
static
inline
int
regmap_fields_update_bits_base
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
,
bool
*
change
,
bool
async
,
bool
force
)
{
WARN_ONCE
(
1
,
"regmap API is disabled"
);
return
-
EINVAL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录